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 | void GraphicsEnabler_start(void);␊ |
21 | ␊ |
22 | void GraphicsEnabler_start(void)␊ |
23 | {␊ |
24 | ␉bool enable = true;␊ |
25 | ␉getBoolForKey(kGraphicsEnabler, &enable, DEFAULT_BOOT_CONFIG);␊ |
26 | ␉␊ |
27 | ␉␊ |
28 | ␉if (enable)␊ |
29 | ␉{␊ |
30 | ␉␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
31 | ␉}␊ |
32 | }␊ |
33 | ␊ |
34 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)␊ |
35 | {␉␊ |
36 | ␉pci_dt_t* current = arg1;␊ |
37 | ␉␊ |
38 | ␉if(current && current->class_id == PCI_CLASS_DISPLAY_VGA)␊ |
39 | ␉{␊ |
40 | ␉␉char *devicepath = get_pci_dev_path(current);␊ |
41 | ␊ |
42 | ␉␉switch (current->vendor_id)␊ |
43 | ␉␉{␊ |
44 | ␉␉␉case PCI_VENDOR_ID_ATI:␊ |
45 | ␉␉␉␉verbose("ATI VGA Controller [%04x:%04x] :: %s \n", ␊ |
46 | ␉␉␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
47 | ␉␉␉␉setup_ati_devprop(current);␊ |
48 | ␉␉␉␉break;␊ |
49 | ␉␉␉␉␊ |
50 | ␉␉␉case PCI_VENDOR_ID_INTEL: ␊ |
51 | ␉␉␉␉setup_gma_devprop(current);␊ |
52 | ␉␉␉␉break;␊ |
53 | ␉␉␉␉␉␊ |
54 | ␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
55 | ␉␉␉␉setup_nvidia_devprop(current);␊ |
56 | ␉␉␉␉break;␊ |
57 | ␉␉␉default:␊ |
58 | ␉␉␉␉break;␊ |
59 | ␉␉}␉␉␊ |
60 | ␉␉ ␊ |
61 | ␉}␊ |
62 | } |