Chameleon

Chameleon Svn Source Tree

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

Source at commit 150 created 13 years 11 months ago.
By meklort, USBLecayOff patch. Runs immediately before kernel is started / after last file is loaded
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);
9//extern int ehci_acquire(pci_dt_t *pci_dev);
10//extern int uhci_reset(pci_dt_t *pci_dev);
11extern void notify_usb_dev(pci_dt_t *pci_dev);
12extern void force_enable_hpet(pci_dt_t *lpc_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_NETWORK_ETHERNET:
33if (do_eth_devprop)
34set_eth_builtin(current);
35break;
36
37case PCI_CLASS_DISPLAY_VGA:
38if (do_gfx_devprop)
39switch (current->vendor_id)
40{
41case PCI_VENDOR_ID_ATI:
42verbose("ATI VGA Controller [%04x:%04x] :: %s \n",
43current->vendor_id, current->device_id, devicepath);
44setup_ati_devprop(current);
45break;
46
47case PCI_VENDOR_ID_INTEL:
48/* message to be removed once support for these cards is added */
49verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n",
50current->vendor_id, current->device_id, devicepath);
51break;
52
53case PCI_VENDOR_ID_NVIDIA:
54setup_nvidia_devprop(current);
55break;
56}
57break;
58
59case PCI_CLASS_SERIAL_USB:
60notify_usb_dev(current);
61/*
62switch (pci_config_read8(current->dev.addr, PCI_CLASS_PROG))
63{
64// EHCI
65case 0x20:
66 if (fix_ehci)
67ehci_acquire(current);
68break;
69
70// UHCI
71case 0x00:
72 if (fix_uhci)
73uhci_reset(current);
74break;
75}
76*/
77break;
78
79case PCI_CLASS_BRIDGE_ISA:
80if (do_enable_hpet)
81force_enable_hpet(current);
82break;
83}
84
85setup_pci_devs(current->children);
86current = current->next;
87}
88}
89

Archive Download this file

Revision: 150