Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/pci_setup.c

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

Archive Download this file

Revision: 136