/shark/tags/rel_0_4/drivers/pci/linuxpci.h |
---|
46,6 → 46,10 |
#ifndef LINUX_PCI_H |
#define LINUX_PCI_H |
#include "ll/sys/cdefs.h" |
__BEGIN_DECLS |
/* |
* Under PCI, each device has 256 bytes of configuration address space, |
* of which the first 64 bytes are standardized as follows: |
1076,4 → 1080,6 |
extern const char *pci_strclass (unsigned int class); |
extern const char *pci_strvendor (unsigned int vendor); |
__END_DECLS |
#endif /* LINUX_PCI_H */ |
/shark/tags/rel_0_4/drivers/pci/pci.h |
---|
9,10 → 9,10 |
#ifndef __PCI_H__ |
#define __PCI_H__ |
#ifdef __cplusplus |
extern "C" { |
#endif |
#include "ll/sys/cdefs.h" |
__BEGIN_DECLS |
#define N_MAX_DEVS 10 |
typedef struct pci_regs { |
72,9 → 72,7 |
struct pci_regs *pci_class(DWORD class_code, WORD index, BYTE *bus, BYTE *dev); |
struct pci_regs *pci_device(WORD vendor, WORD device, WORD index, BYTE *bus, BYTE *dev); |
#ifdef __cplusplus |
}; |
#endif |
__END_DECLS |
#endif |
/shark/tags/rel_0_4/drivers/pci/makefile |
---|
3,6 → 3,7 |
ifndef BASE |
BASE=../.. |
endif |
include $(BASE)/config/config.mk |
LIBRARY = hpci |
/shark/tags/rel_0_4/drivers/pci/pci.c |
---|
3,15 → 3,13 |
#include <ll/i386/hw-arch.h> |
#include <ll/i386/hw-io.h> |
#include <ll/i386/cons.h> |
#include <ll/stdlib.h> |
#include <drivers/llpci.h> |
#include <drivers/pci.h> |
#include <drivers/linuxpci.h> |
#include <kernel/log.h> |
static int ndev = 0; |
static struct pci_des pci_devs[N_MAX_DEVS]; |
29,7 → 27,7 |
if (pcibios_present() == 0) return -1; |
ndev = 0; |
for (bus = 0; bus <= 0; bus++) { |
for (bus = 0; bus <= 1; bus++) { |
for (dev = 0; dev <= 0xFF; dev++) { |
present = 0; |
if ((dev & 0x07) == 0) { |
108,7 → 106,10 |
{ |
if (pci_class(class_code, index, bus, dev) != NULL) { |
cprintf("PCIBIOS_FIND_CLASS: found at bus %d, dev %d\n", *bus, *dev); |
#ifdef DEBUG_PCI |
printk(KERN_DEBUG "PCIBIOS_FIND_CLASS:" |
"found at bus %d, dev %d\n", *bus, *dev); |
#endif |
return PCIBIOS_SUCCESSFUL; |
} else { |
return PCIBIOS_DEVICE_NOT_FOUND; |
122,14 → 123,15 |
int i; |
struct pci_regs *r; |
cprintf(" DevLib PCI support\n\n"); |
cprintf(" PCI config type %d\n", pcibios_present()); |
cprintf(" %d PCI devices found:\n\n", ndev); |
printk(KERN_INFO "DevLib PCI support\n\n"); |
printk(KERN_INFO "PCI config type %d\n", pcibios_present()); |
printk(KERN_INFO "%d PCI devices found:\n\n", ndev); |
for(i = 0; i < ndev; i++) { |
cprintf(" %d: bus %d dev %d\n",i , pci_devs[i].bus, pci_devs[i].dev); |
r = (struct pci_regs *) pci_devs[i].mem; |
cprintf(" Vendor: %s", pci_strvendor(r->VendorId)); |
cprintf(" Class: %s\n", pci_strclass(r->ClassCode << 8)); |
printk(KERN_INFO "%d: bus %d dev %d\n", |
i, pci_devs[i].bus, pci_devs[i].dev); |
printk(KERN_INFO "Vendor: %s", pci_strvendor(r->VendorId)); |
printk(KERN_INFO "Class: %s\n", pci_strclass(r->ClassCode << 8)); |
} |
} |
/shark/tags/rel_0_4/drivers/pci/pci_scan.c |
---|
3,17 → 3,15 |
#include <ll/i386/hw-arch.h> |
#include <ll/i386/hw-io.h> |
#include <ll/i386/cons.h> |
#include <ll/i386/error.h> |
#include <ll/i386/mem.h> |
#include <ll/stdlib.h> |
#include <drivers/llpci.h> |
#include <drivers/pci.h> |
#include <drivers/linuxpci.h> |
#include <kernel/log.h> |
//#define DEBUG_PCISCAN |
static struct pci_dev pci_devs[N_MAX_DEVS]; |
static struct pci_bus pci_root; |
146,7 → 144,9 |
*/ |
child = kmalloc(sizeof(*child), GFP_ATOMIC); |
if(child==NULL) { |
error(KERN_ERR "pci: out of memory for bridge.\n"); |
#ifdef DEBUG_PCISCAN |
printk(KERN_ERR "pci: out of memory for bridge.\n"); |
#endif |
continue; |
} |
memset(child, 0, sizeof(*child)); |
221,11 → 221,15 |
pcibios_init(); |
if (!pci_present()) { |
error("PCI: No PCI bus detected\n"); |
#ifdef DEBUG_PCISCAN |
printk("PCI: No PCI bus detected\n"); |
#endif |
return; |
} |
error("PCI: Probing PCI hardware\n"); |
#ifdef DEBUG_PCISCAN |
printk("PCI: Probing PCI hardware\n"); |
#endif |
memset(&pci_root, 0, sizeof(pci_root)); |
pci_root.subordinate = pci_scan_bus(&pci_root); |
} |