00001 #ifndef DEVICES_PCI_H
00002
00003 #define DEVICES_PCI_H
00004
00005 #include <stdint.h>
00006 #include <stddef.h>
00007
00008
00009
00010
00011 #define PCI_MAJOR_EARLY 0
00012 #define PCI_MINOR_VGA 1
00013
00014 #define PCI_MAJOR_MASS_STORAGE 1
00015 #define PCI_MINOR_SCSI 0
00016 #define PCI_MINOR_IDE 1
00017 #define PCI_MINOR_FLOPPY 2
00018 #define PCI_MINOR_IPI 3
00019 #define PCI_MINOR_RAID 4
00020 #define PCI_MINOR_MS_OTHER 0x80
00021
00022 #define PCI_MAJOR_NETWORK 2
00023 #define PCI_MINOR_ETHERNET 0
00024 #define PCI_MINOR_TOKENRING 1
00025 #define PCI_MINOR_FDDI 2
00026 #define PCI_MINOR_ATM 3
00027 #define PCI_MINOR_ISDN 4
00028 #define PCI_MINOR_NET_OTHER 0x80
00029
00030 #define PCI_MAJOR_DISPLAY 3
00031 #define PCI_MAJOR_MULTIMEDIA 4
00032 #define PCI_MAJOR_MEMORY 5
00033
00034 #define PCI_MAJOR_BRIDGE 6
00035 #define PCI_MINOR_HOST 0
00036 #define PCI_MINOR_ISA 1
00037 #define PCI_MINOR_EISA 2
00038 #define PCI_MINOR_MCA 3
00039 #define PCI_MINOR_PCI 4
00040 #define PCI_MINOR_PCMCIA 5
00041 #define PCI_MINOR_NUBUS 6
00042 #define PCI_MINOR_CARDBUS 7
00043 #define PCI_MINOR_RACEWAY 8
00044
00045 #define PCI_MAJOR_SIMPLE_COMM 7
00046
00047 #define PCI_MAJOR_BASE_PERIPHERAL 8
00048 #define PCI_MINOR_PIC 0
00049 #define PCI_MINOR_DMA 1
00050 #define PCI_MINOR_TIMER 2
00051 #define PCI_MINOR_RTC 3
00052 #define PCI_MINOR_HOTPLUG 4
00053
00054
00055 #define PCI_MAJOR_INPUT 9
00056 #define PCI_MAJOR_DOCK 10
00057 #define PCI_MAJOR_PROCESSOR 11
00058 #define PCI_MINOR_386 0
00059 #define PCI_MINOR_486 1
00060 #define PCI_MINOR_PENTIUM 2
00061 #define PCI_MINOR_ALPHA 0x10
00062 #define PCI_MINOR_PPC 0x20
00063 #define PCI_MINOR_MIPS 0x30
00064 #define PCI_MINOR_COPROC 0x40
00065
00066 #define PCI_MAJOR_SERIALBUS 12
00067 #define PCI_MINOR_FIREWIRE 0
00068 #define PCI_MINOR_ACCESS 1
00069 #define PCI_MINOR_SSA 2
00070 #define PCI_MINOR_USB 3
00071 #define PCI_USB_IFACE_UHCI 0
00072 #define PCI_USB_IFACE_OHCI 0x10
00073 #define PCI_USB_IFACE_EHCI 0x20
00074 #define PCI_MINOR_FIBRE 4
00075 #define PCI_MAJOR_UNDEF 0xff
00076
00077 typedef void pci_handler_func (void *AUX);
00078
00079
00080 struct pci_io;
00081
00082
00083 struct pci_dev;
00084
00085 void pci_init (void);
00086 struct pci_dev *pci_get_device (int vendor, int device, int func, int n);
00087 struct pci_dev *pci_get_dev_by_class (int major, int minor, int iface, int n);
00088 struct pci_io *pci_io_enum (struct pci_dev *, struct pci_io *last);
00089 void pci_register_irq (struct pci_dev *, pci_handler_func *, void *AUX);
00090 void pci_unregister_irq (struct pci_dev *);
00091 size_t pci_io_size (struct pci_io *);
00092
00093 void pci_write_config8 (struct pci_dev *, int reg, uint8_t);
00094 void pci_write_config16 (struct pci_dev *, int reg, uint16_t);
00095 void pci_write_config32 (struct pci_dev *, int reg, uint32_t);
00096 uint8_t pci_read_config8 (struct pci_dev *, int reg);
00097 uint16_t pci_read_config16 (struct pci_dev *, int reg);
00098 uint32_t pci_read_config32 (struct pci_dev *, int reg);
00099
00100 void pci_reg_write32 (struct pci_io *, int reg, uint32_t);
00101 void pci_reg_write16 (struct pci_io *, int reg, uint16_t);
00102 void pci_reg_write8 (struct pci_io *, int reg, uint8_t);
00103 uint32_t pci_reg_read32 (struct pci_io *, int reg);
00104 uint16_t pci_reg_read16 (struct pci_io *, int reg);
00105 uint8_t pci_reg_read8 (struct pci_io *, int reg);
00106
00107 void pci_read_in (struct pci_io *, int off, size_t sz, void *buf);
00108 void pci_write_out (struct pci_io *, int off, size_t sz, const void *buf);
00109 void pci_print_stats (void);
00110 void pci_mask_irq (struct pci_dev *);
00111 void pci_unmask_irq (struct pci_dev *);
00112
00113 #endif