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#include "gma.h"
6#include "nvidia.h"
7#include "modules.h"
8
9
10extern bool setup_ati_devprop(pci_dt_t *ati_dev);
11extern void set_eth_builtin(pci_dt_t *eth_dev);
12extern void notify_usb_dev(pci_dt_t *pci_dev);
13extern void force_enable_hpet(pci_dt_t *lpc_dev);
14
15extern pci_dt_t *dram_controller_dev;
16
17void setup_pci_devs(pci_dt_t *pci_dt)
18{
19char *devicepath;
20bool do_eth_devprop, do_gfx_devprop, do_enable_hpet, do_igp_devprop;
21pci_dt_t *current = pci_dt;
22
23do_eth_devprop = do_gfx_devprop = do_enable_hpet = false;
24
25getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);
26getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig);
27 getBoolForKey(kIGPEnabler, &do_igp_devprop, &bootInfo->chameleonConfig);
28getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);
29
30while (current)
31{
32devicepath = get_pci_dev_path(current);
33
34switch (current->class_id)
35{
36case PCI_CLASS_BRIDGE_HOST:
37if (current->dev.addr == PCIADDR(0, 0, 0))
38dram_controller_dev = current;
39break;
40
41case PCI_CLASS_NETWORK_ETHERNET:
42if (do_eth_devprop)
43set_eth_builtin(current);
44break;
45
46case PCI_CLASS_DISPLAY_VGA:
47if (do_gfx_devprop){
48switch (current->vendor_id)
49{
50case PCI_VENDOR_ID_ATI:
51setup_ati_devprop(current);
52break;
53
54case PCI_VENDOR_ID_INTEL:
55setup_gma_devprop(current);
56break;
57
58case PCI_VENDOR_ID_NVIDIA:
59setup_nvidia_devprop(current);
60break;
61}
62break;
63 } else if (do_igp_devprop){
64 setup_gma_devprop(current);
65 break;
66 }
67
68case PCI_CLASS_SERIAL_USB:
69notify_usb_dev(current);
70break;
71
72case PCI_CLASS_BRIDGE_ISA:
73if (do_enable_hpet)
74force_enable_hpet(current);
75break;
76}
77
78execute_hook("PCIDevice", current, NULL, NULL, NULL);
79
80setup_pci_devs(current->children);
81current = current->next;
82}
83}
84

Archive Download this file

Revision: 2264