Root/
Source at commit 519 created 13 years 7 months ago. By meklort, Moved GraphicsEnabler into a module. Untested | |
---|---|
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 "modules.h"␊ |
14 | ␊ |
15 | ␊ |
16 | #define kGraphicsEnabler␉"GraphicsEnabler"␊ |
17 | ␊ |
18 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4);␊ |
19 | ␊ |
20 | void GraphicsEnabler_start()␊ |
21 | {␊ |
22 | ␉register_hook_callback(kGraphicsEnabler, &GraphicsEnabler_hook);␊ |
23 | }␊ |
24 | ␊ |
25 | ␊ |
26 | void GraphicsEnabler_hook(void* arg1, void* arg2, void* arg3, void* arg4)␊ |
27 | {␊ |
28 | ␉pci_dt_t* current = arg1;␊ |
29 | ␉char *devicepath = get_pci_dev_path(current);␊ |
30 | ␊ |
31 | ␉bool do_gfx_devprop = false;␊ |
32 | ␉getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
33 | ␊ |
34 | ␉if (do_gfx_devprop)␊ |
35 | ␉␉switch (current->vendor_id)␊ |
36 | ␉{␊ |
37 | ␉␉case PCI_VENDOR_ID_ATI:␊ |
38 | ␉␉␉verbose("ATI VGA Controller [%04x:%04x] :: %s \n", ␊ |
39 | ␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
40 | ␉␉␉setup_ati_devprop(current); ␊ |
41 | ␉␉␉break;␊ |
42 | ␉␉␉␊ |
43 | ␉␉case PCI_VENDOR_ID_INTEL: ␊ |
44 | ␉␉␉/* message to be removed once support for these cards is added */␊ |
45 | ␉␉␉verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n", ␊ |
46 | ␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
47 | ␉␉␉break;␊ |
48 | ␉␉␉␊ |
49 | ␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
50 | ␉␉␉setup_nvidia_devprop(current);␊ |
51 | ␉␉␉break;␊ |
52 | ␉}␊ |
53 | ␉␊ |
54 | }␊ |
55 |