Root/
Source at commit 554 created 13 years 6 months ago. By meklort, Grapics enabler enabled by default. removed device_numbers. | |
---|---|
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 | ␊ |
19 | void GraphicsEnabler_hook(pci_dt_t* current, void* arg2, void* arg3, void* arg4);␊ |
20 | ␊ |
21 | void GraphicsEnabler_start()␊ |
22 | {␊ |
23 | ␉register_hook_callback("PCIDevice", &GraphicsEnabler_hook);␊ |
24 | }␊ |
25 | ␊ |
26 | ␊ |
27 | void GraphicsEnabler_hook(pci_dt_t* current, void* arg2, void* arg3, void* arg4)␊ |
28 | {␉␊ |
29 | ␉if(current && current->class_id == PCI_CLASS_DISPLAY_VGA)␊ |
30 | ␉{␊ |
31 | ␉␉char *devicepath = get_pci_dev_path(current);␊ |
32 | ␊ |
33 | ␉␉bool do_gfx_devprop = true;␊ |
34 | ␉␉getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
35 | ␉␉␊ |
36 | ␉␉␊ |
37 | ␉␉if (do_gfx_devprop)␊ |
38 | ␉␉{␊ |
39 | ␉␉␉switch (current->vendor_id)␊ |
40 | ␉␉␉{␊ |
41 | ␉␉␉␉case PCI_VENDOR_ID_ATI:␊ |
42 | ␉␉␉␉␉verbose("ATI VGA Controller [%04x:%04x] :: %s \n", ␊ |
43 | ␉␉␉␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
44 | ␉␉␉␉␉setup_ati_devprop(current); ␊ |
45 | ␉␉␉␉␉break;␊ |
46 | ␉␉␉␉␉␊ |
47 | ␉␉␉␉case PCI_VENDOR_ID_INTEL: ␊ |
48 | ␉␉␉␉␉//message to be removed once support for these cards is added␊ |
49 | ␉␉␉␉␉verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n", ␊ |
50 | ␉␉␉␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
51 | ␉␉␉␉␉break;␊ |
52 | ␉␉␉␉␉␊ |
53 | ␉␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
54 | ␉␉␉␉␉setup_nvidia_devprop(current);␊ |
55 | ␉␉␉␉␉break;␊ |
56 | ␉␉␉}␊ |
57 | ␉␉}␊ |
58 | ␉␉ ␊ |
59 | ␉}␊ |
60 | }␊ |
61 |