1 | /*␊ |
2 | * GraphicsEnabler Module␊ |
3 | *␉Enabled many nvidia and ati cards to be used out of the box in ␊ |
4 | *␉OS X. This was converted from boot2 code to a boot2 module.␊ |
5 | *␊ |
6 | */␊ |
7 | ␊ |
8 | //#include "libsaio.h"␊ |
9 | //#include "bootstruct.h"␊ |
10 | #include "boot.h"␊ |
11 | #include "pci.h"␊ |
12 | #include "nvidia.h"␊ |
13 | #include "ati.h"␊ |
14 | #include "gma.h" //Azi:autoresolution␊ |
15 | #include "modules.h"␊ |
16 | ␊ |
17 | ␊ |
18 | //#define kGraphicsEnabler␉"GraphicsEnabler"␊ |
19 | ␊ |
20 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
21 | ␊ |
22 | void GraphicsEnabler_start()␊ |
23 | {␊ |
24 | ␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
25 | }␊ |
26 | ␊ |
27 | ␊ |
28 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
29 | {␊ |
30 | ␉pci_dt_t* current = arg1;␊ |
31 | ␉␊ |
32 | ␉if(current->class_id != PCI_CLASS_DISPLAY_VGA) return;␊ |
33 | ␉␊ |
34 | ␉char *devicepath = get_pci_dev_path(current);␊ |
35 | ␊ |
36 | ␉bool do_gfx_devprop = false;␊ |
37 | ␉getBoolForKey(kGraphicsEnablerKey, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
38 | ␊ |
39 | ␉if (do_gfx_devprop)␊ |
40 | ␉{␊ |
41 | ␉␉switch (current->vendor_id)␊ |
42 | ␉␉{␊ |
43 | ␉␉␉case PCI_VENDOR_ID_ATI:␊ |
44 | ␉␉␉␉verbose("ATI VGA Controller [%04x:%04x] :: %s \n", ␊ |
45 | ␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
46 | ␉␉␉␉setup_ati_devprop(current); ␊ |
47 | ␉␉␉␉break;␊ |
48 | ␊ |
49 | ␉␉␉case PCI_VENDOR_ID_INTEL: // AutoResolution␊ |
50 | ␉␉␉␉verbose("Intel Graphics Controller [%04x:%04x] :: %s \n",␊ |
51 | ␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
52 | ␉␉␉␉setup_gma_devprop(current);␊ |
53 | ␉␉␉␉break;␊ |
54 | ␉␉␉␉//message to be removed once support for these cards is added ␊ |
55 | ␉␉␉␉//verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n", ␊ |
56 | ␉␉␉␉//␉␉current->vendor_id, current->device_id, devicepath);␊ |
57 | ␉␉␉␉//break;␊ |
58 | ␊ |
59 | ␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
60 | ␉␉␉␉setup_nvidia_devprop(current);␊ |
61 | ␉␉␉␉break;␊ |
62 | ␉␉}␊ |
63 | ␉}␊ |
64 | }␊ |
65 | |