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