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"␊ |
15 | #include "modules.h"␊ |
16 | ␊ |
17 | ␊ |
18 | ␊ |
19 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
20 | ␊ |
21 | void GraphicsEnablerLegacy_start()␊ |
22 | {␊ |
23 | ␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
24 | }␊ |
25 | ␊ |
26 | ␊ |
27 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
28 | {␊ |
29 | ␉pci_dt_t* current = arg1;␊ |
30 | ␉␊ |
31 | ␉if(current->class_id != PCI_CLASS_DISPLAY_VGA) return;␊ |
32 | ␉␊ |
33 | ␉char *devicepath = get_pci_dev_path(current);␊ |
34 | ␊ |
35 | ␉bool do_gfx_devprop = false;␊ |
36 | ␉getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
37 | ␊ |
38 | ␉if (do_gfx_devprop)␊ |
39 | ␉{␊ |
40 | ␉␉switch (current->vendor_id)␊ |
41 | ␉␉{␊ |
42 | ␉␉␉case PCI_VENDOR_ID_ATI:␊ |
43 | ␉␉␉␉verbose("ATI VGA Controller [%04x:%04x] :: %s \n", ␊ |
44 | ␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
45 | ␉␉␉␉setup_ati_devprop(current); ␊ |
46 | ␉␉␉␉break;␊ |
47 | ␊ |
48 | ␉␉␉case PCI_VENDOR_ID_INTEL: // AutoResolution␊ |
49 | ␉␉␉␉verbose("Intel Graphics Controller [%04x:%04x] :: %s \n",␊ |
50 | ␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
51 | ␉␉␉␉setup_gma_devprop(current);␊ |
52 | ␉␉␉␉break;␊ |
53 | ␉␉␉␉//message to be removed once support for these cards is added ␊ |
54 | ␉␉␉␉//verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n", ␊ |
55 | ␉␉␉␉//␉␉current->vendor_id, current->device_id, devicepath);␊ |
56 | ␉␉␉␉//break;␊ |
57 | ␊ |
58 | ␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
59 | ␉␉␉␉setup_nvidia_devprop(current);␊ |
60 | ␉␉␉␉break;␊ |
61 | ␉␉}␊ |
62 | ␉}␊ |
63 | }␊ |
64 | |