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