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 | #include "device_inject.h"␊ |
16 | ␊ |
17 | ␊ |
18 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);␊ |
19 | void GraphicsEnabler_start(void);␊ |
20 | ␊ |
21 | void GraphicsEnabler_start(void)␊ |
22 | {␊ |
23 | ␉register_device_inject();␊ |
24 | ␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
25 | }␊ |
26 | ␊ |
27 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)␊ |
28 | {␉␊ |
29 | ␉pci_dt_t* current = arg1;␊ |
30 | ␉␊ |
31 | ␉if(current && current->class_id == PCI_CLASS_DISPLAY_VGA)␊ |
32 | ␉{␊ |
33 | ␊ |
34 | ␉␉switch (current->vendor_id)␊ |
35 | ␉␉{␊ |
36 | ␉␉␉case PCI_VENDOR_ID_ATI:␊ |
37 | ␉␉␉␉␊ |
38 | ␉␉␉␉setup_ati_devprop(current);␊ |
39 | ␉␉␉␉break;␊ |
40 | ␉␉␉␉␊ |
41 | ␉␉␉case PCI_VENDOR_ID_INTEL: ␊ |
42 | ␉␉␉␉setup_gma_devprop(current);␊ |
43 | ␉␉␉␉break;␊ |
44 | ␊ |
45 | ␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
46 | ␉␉␉␉setup_nvidia_devprop(current);␊ |
47 | ␉␉␉␉break;␊ |
48 | ␉␉␉default:␊ |
49 | ␉␉␉␉break;␊ |
50 | ␉␉}␉␉␊ |
51 | ␊ |
52 | ␉}␊ |
53 | } |