1 | #include "libsaio.h"␊ |
2 | #include "boot.h"␊ |
3 | #include "bootstruct.h"␊ |
4 | #include "pci.h"␊ |
5 | #include "nvidia.h"␊ |
6 | #include "modules.h"␊ |
7 | #include "gma.h" //Azi:autoresolution␊ |
8 | ␊ |
9 | ␊ |
10 | extern bool setup_ati_devprop(pci_dt_t *ati_dev);␊ |
11 | extern void set_eth_builtin(pci_dt_t *eth_dev);␊ |
12 | extern void notify_usb_dev(pci_dt_t *pci_dev);␊ |
13 | extern void force_enable_hpet(pci_dt_t *lpc_dev);␊ |
14 | ␊ |
15 | extern pci_dt_t *dram_controller_dev;␊ |
16 | ␊ |
17 | void setup_pci_devs(pci_dt_t *pci_dt)␊ |
18 | {␊ |
19 | ␉char *devicepath;␊ |
20 | ␉bool do_eth_devprop, do_gfx_devprop, do_enable_hpet;␊ |
21 | ␉pci_dt_t *current = pci_dt;␊ |
22 | ␊ |
23 | ␉do_eth_devprop = do_gfx_devprop = do_enable_hpet = false;␊ |
24 | ␊ |
25 | ␉getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->bootConfig);␊ |
26 | ␉getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->bootConfig);␊ |
27 | ␉getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->bootConfig);␊ |
28 | ␊ |
29 | ␉while (current)␊ |
30 | ␉{␊ |
31 | ␉␉devicepath = get_pci_dev_path(current);␊ |
32 | ␊ |
33 | ␉␉switch (current->class_id)␊ |
34 | ␉␉{␊ |
35 | ␉␉␉case PCI_CLASS_BRIDGE_HOST:␊ |
36 | ␉␉␉␉␉if (current->dev.addr == PCIADDR(0, 0, 0))␊ |
37 | ␉␉␉␉␉␉dram_controller_dev = current;␊ |
38 | ␉␉␉␉break;␊ |
39 | ␉␉␉␉␊ |
40 | ␉␉␉case PCI_CLASS_NETWORK_ETHERNET: ␊ |
41 | ␉␉␉␉if (do_eth_devprop)␊ |
42 | ␉␉␉␉␉set_eth_builtin(current);␊ |
43 | ␉␉␉␉break;␊ |
44 | ␉␉␉␉␊ |
45 | ␉␉␉case PCI_CLASS_DISPLAY_VGA:␊ |
46 | ␉␉␉␉if (do_gfx_devprop)␊ |
47 | ␉␉␉␉␉switch (current->vendor_id)␊ |
48 | ␉␉␉␉␉{␊ |
49 | ␉␉␉␉␉␉case PCI_VENDOR_ID_ATI:␊ |
50 | ␉␉␉␉␉␉␉setup_ati_devprop(current); ␊ |
51 | ␉␉␉␉␉␉␉break;␊ |
52 | ␉␉␉␉␉␊ |
53 | ␉␉␉␉␉␉case PCI_VENDOR_ID_INTEL: // AutoResolution␊ |
54 | ␉␉␉␉␉␉␉verbose("Intel Graphics Controller [%04x:%04x] :: %s \n",␊ |
55 | ␉␉␉␉␉␉␉␉␉current->vendor_id, current->device_id, devicepath);␊ |
56 | ␉␉␉␉␉␉␉setup_gma_devprop(current);␊ |
57 | ␉␉␉␉␉␉␉break;␊ |
58 | ␉␉␉␉␉␉␉//message to be removed once support for these cards is added ␊ |
59 | ␉␉␉␉␉␉␉//verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n", ␊ |
60 | ␉␉␉␉␉␉␉//␉␉current->vendor_id, current->device_id, devicepath);␊ |
61 | ␉␉␉␉␉␉␉//break;␊ |
62 | ␉␉␉␉␉␊ |
63 | ␉␉␉␉␉␉case PCI_VENDOR_ID_NVIDIA: ␊ |
64 | ␉␉␉␉␉␉␉setup_nvidia_devprop(current);␊ |
65 | ␉␉␉␉␉␉␉break;␊ |
66 | ␉␉␉␉␉}␊ |
67 | ␉␉␉␉break;␊ |
68 | ␊ |
69 | ␉␉␉case PCI_CLASS_SERIAL_USB:␊ |
70 | ␉␉␉␉notify_usb_dev(current);␊ |
71 | ␉␉␉␉break;␊ |
72 | ␊ |
73 | ␉␉␉case PCI_CLASS_BRIDGE_ISA:␊ |
74 | ␉␉␉␉if (do_enable_hpet)␊ |
75 | ␉␉␉␉␉force_enable_hpet(current);␊ |
76 | ␉␉␉␉break;␊ |
77 | ␉␉}␊ |
78 | ␉␉␊ |
79 | ␉␉execute_hook("PCIDevice", current, NULL, NULL, NULL);␊ |
80 | ␉␉␊ |
81 | ␉␉setup_pci_devs(current->children);␊ |
82 | ␉␉current = current->next;␊ |
83 | ␉}␊ |
84 | }␊ |
85 | |