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 "pci.h"␊ |
10 | #include "bootstruct.h"␊ |
11 | #include "nvidia.h"␊ |
12 | #include "ati.h"␊ |
13 | #include "gma.h"␊ |
14 | #include "modules.h"␊ |
15 | ␊ |
16 | ␊ |
17 | #define kGraphicsEnabler␉"EnableGFXModule"␊ |
18 | ␊ |
19 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);␊ |
20 | ␊ |
21 | void GraphicsEnabler_start()␊ |
22 | {␊ |
23 | ␉bool enable = true;␊ |
24 | ␉getBoolForKey(kGraphicsEnabler, &enable, &bootInfo->bootConfig);␊ |
25 | ␉␊ |
26 | ␉␊ |
27 | ␉if (enable)␊ |
28 | ␉{␊ |
29 | ␉␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
30 | ␉}␊ |
31 | }␊ |
32 | ␊ |
33 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)␊ |
34 | {␉␊ |
35 | ␉pci_dt_t* current = arg1;␊ |
36 | ␉␊ |
37 | ␉if(current && current->class_id == PCI_CLASS_DISPLAY_VGA)␊ |
38 | ␉{␊ |
39 | ␉␉char *devicepath = get_pci_dev_path(current);␊ |
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: ␊ |
50 | ␉␉␉␉setup_gma_devprop(current);␊ |
51 | ␉␉␉␉break;␊ |
52 | ␉␉␉␉␉␊ |
53 | ␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
54 | ␉␉␉␉setup_nvidia_devprop(current);␊ |
55 | ␉␉␉␉break;␊ |
56 | ␉␉␉default:␊ |
57 | ␉␉␉␉break;␊ |
58 | ␉␉}␉␉␊ |
59 | ␉␉ ␊ |
60 | ␉}␊ |
61 | } |