1 | /*␊ |
2 | * ATIGraphicsEnabler Module ---␊ |
3 | *␉ Enables many ati "HD ??" cards to be used out of the box in OS X.␊ |
4 | * This was converted from ( > r784) boot2 code 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 | ␊ |
14 | #define kGraphicsEnablerKey␉"GraphicsEnabler"␊ |
15 | ␊ |
16 | extern bool setup_ati_devprop(pci_dt_t *ati_dev);␊ |
17 | ␊ |
18 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
19 | ␊ |
20 | ␊ |
21 | void AMDGraphicsEnabler_start()␊ |
22 | {␊ |
23 | ␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
24 | }␊ |
25 | ␊ |
26 | ␊ |
27 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
28 | {␊ |
29 | ␉pci_dt_t* current = arg1;␊ |
30 | ␉␊ |
31 | ␉if (current->class_id != PCI_CLASS_DISPLAY_VGA) return;␊ |
32 | ␉␊ |
33 | ␉char *devicepath = get_pci_dev_path(current);␊ |
34 | ␉␊ |
35 | ␉bool do_gfx_devprop = true;␊ |
36 | ␉getBoolForKey(kGraphicsEnablerKey, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
37 | ␉␊ |
38 | ␉// AMD ?? i don't find any vga 1022 vendor!.. thou ATI isn't used anymore!␊ |
39 | ␉if (do_gfx_devprop && (current->vendor_id == PCI_VENDOR_ID_ATI))␊ |
40 | ␉{␊ |
41 | ␉␉verbose("ATI VGA Controller [%04x:%04x] :: %s \n", ␊ |
42 | ␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
43 | ␉␉setup_ati_devprop(current);␊ |
44 | ␉}␊ |
45 | ␉else␊ |
46 | ␉␉verbose("[%04x:%04x] :: %s, is not a AMD/ATI VGA Controller.\n",// amd ??␊ |
47 | ␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
48 | }␊ |
49 | |