1 | /*␊ |
2 | *␉AMDGraphicsEnabler Module␊ |
3 | *␉␉Enables many AMD/ATI HD cards to be used out of the box in OS X.␊ |
4 | *␉␉This was converted from boot2 code ( > r784) to a boot2 module.␊ |
5 | *␊ |
6 | */␊ |
7 | ␊ |
8 | #include "saio_internal.h"␊ |
9 | #include "bootstruct.h"␊ |
10 | #include "pci.h"␊ |
11 | #include "modules.h"␊ |
12 | ␊ |
13 | #define kGraphicsEnablerKey "GraphicsEnabler"␊ |
14 | ␊ |
15 | extern bool setup_ati_devprop(pci_dt_t *ati_dev);␊ |
16 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
17 | ␊ |
18 | ␊ |
19 | void AMDGraphicsEnabler_start()␊ |
20 | {␊ |
21 | ␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
22 | }␊ |
23 | ␊ |
24 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
25 | {␊ |
26 | ␉pci_dt_t* current = arg1;␊ |
27 | ␉␊ |
28 | ␉if (current->class_id != PCI_CLASS_DISPLAY_VGA) return;␊ |
29 | ␉␊ |
30 | ␉char *devicepath = get_pci_dev_path(current);␊ |
31 | ␉␊ |
32 | ␉bool do_gfx_devprop = true;␊ |
33 | ␉getBoolForKey(kGraphicsEnablerKey, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
34 | ␉␊ |
35 | ␉if (do_gfx_devprop && (current->vendor_id == PCI_VENDOR_ID_ATI))␊ |
36 | ␉{␊ |
37 | ␉␉verbose("AMD/ATI VGA Controller [%04x:%04x] :: %s \n",␊ |
38 | ␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
39 | ␉␉setup_ati_devprop(current);␊ |
40 | ␉}␊ |
41 | ␉else␊ |
42 | ␉␉verbose("[%04x:%04x] :: %s, is not a AMD/ATI VGA Controller.\n",␊ |
43 | ␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
44 | }␊ |
45 | |