Chameleon

Chameleon Svn Source Tree

Root/branches/Chimera/i386/libsaio/pci_setup.c

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

Archive Download this file

Revision: 757