1433d6423SLionel Sambuc /* 2433d6423SLionel Sambuc pci.h 3433d6423SLionel Sambuc 4433d6423SLionel Sambuc Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl> 5433d6423SLionel Sambuc */ 6433d6423SLionel Sambuc 7433d6423SLionel Sambuc struct pci_isabridge 8433d6423SLionel Sambuc { 9433d6423SLionel Sambuc u16_t vid; 10433d6423SLionel Sambuc u16_t did; 11433d6423SLionel Sambuc int checkclass; 12433d6423SLionel Sambuc int type; 13433d6423SLionel Sambuc }; 14433d6423SLionel Sambuc 15433d6423SLionel Sambuc struct pci_acl 16433d6423SLionel Sambuc { 17433d6423SLionel Sambuc int inuse; 18433d6423SLionel Sambuc struct rs_pci acl; 19433d6423SLionel Sambuc }; 20433d6423SLionel Sambuc 21433d6423SLionel Sambuc #define NR_DRIVERS NR_SYS_PROCS 22433d6423SLionel Sambuc 23433d6423SLionel Sambuc #define PCI_IB_PIIX 1 /* Intel PIIX compatible ISA bridge */ 24433d6423SLionel Sambuc #define PCI_IB_VIA 2 /* VIA compatible ISA bridge */ 25433d6423SLionel Sambuc #define PCI_IB_AMD 3 /* AMD compatible ISA bridge */ 26433d6423SLionel Sambuc #define PCI_IB_SIS 4 /* SIS compatible ISA bridge */ 27433d6423SLionel Sambuc 28433d6423SLionel Sambuc #define PCI_PPB_STD 1 /* Standard PCI-to-PCI bridge */ 29433d6423SLionel Sambuc #define PCI_PPB_CB 2 /* Cardbus bridge */ 30433d6423SLionel Sambuc /* Still needed? */ 31433d6423SLionel Sambuc #define PCI_AGPB_VIA 3 /* VIA compatible AGP bridge */ 32433d6423SLionel Sambuc 336e7bb628SLionel Sambuc extern int debug; 346e7bb628SLionel Sambuc 35433d6423SLionel Sambuc extern struct pci_isabridge pci_isabridge[]; 366e7bb628SLionel Sambuc extern struct pci_acl pci_acl[NR_DRIVERS]; 37433d6423SLionel Sambuc 38433d6423SLionel Sambuc /* Function prototypes. */ 39*5d831176SLionel Sambuc int sef_cb_init(int type, sef_init_info_t *info); 40433d6423SLionel Sambuc int map_service(struct rprocpub *rpub); 416e7bb628SLionel Sambuc 42*5d831176SLionel Sambuc int _pci_grant_access(int devind, endpoint_t proc); 436e7bb628SLionel Sambuc int _pci_reserve(int devind, endpoint_t proc, struct rs_pci *aclp); 446e7bb628SLionel Sambuc void _pci_release(endpoint_t proc); 456e7bb628SLionel Sambuc 466e7bb628SLionel Sambuc int _pci_first_dev(struct rs_pci *aclp, int *devindp, u16_t *vidp, 47433d6423SLionel Sambuc u16_t *didp); 486e7bb628SLionel Sambuc int _pci_next_dev(struct rs_pci *aclp, int *devindp, u16_t *vidp, u16_t 49433d6423SLionel Sambuc *didp); 506e7bb628SLionel Sambuc int _pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp); 51433d6423SLionel Sambuc 526e7bb628SLionel Sambuc void _pci_rescan_bus(u8_t busnr); 536e7bb628SLionel Sambuc const char *_pci_dev_name(u16_t vid, u16_t did); 546e7bb628SLionel Sambuc 556e7bb628SLionel Sambuc 566e7bb628SLionel Sambuc int _pci_get_bar(int devind, int port, u32_t *base, u32_t *size, int 57433d6423SLionel Sambuc *ioflag); 586e7bb628SLionel Sambuc int _pci_slot_name(int devind, char **cpp); 596e7bb628SLionel Sambuc int _pci_ids(int devind, u16_t *vidp, u16_t *didp); 60433d6423SLionel Sambuc 616e7bb628SLionel Sambuc /* PCI Config Read functions */ 626e7bb628SLionel Sambuc int _pci_attr_r8(int devind, int port, u8_t *vp); 636e7bb628SLionel Sambuc int _pci_attr_r16(int devind, int port, u16_t *vp); 646e7bb628SLionel Sambuc int _pci_attr_r32(int devind, int port, u32_t *vp); 656e7bb628SLionel Sambuc 666e7bb628SLionel Sambuc /* PCI Config Write functions */ 676e7bb628SLionel Sambuc int _pci_attr_w8(int devind, int port, u8_t value); 686e7bb628SLionel Sambuc int _pci_attr_w16(int devind, int port, u16_t value); 696e7bb628SLionel Sambuc int _pci_attr_w32(int devind, int port, u32_t value); 703641562fSLionel Sambuc 713641562fSLionel Sambuc /* minix hooks into NetBSD PCI IDS DB */ 723641562fSLionel Sambuc typedef uint32_t pcireg_t; 733641562fSLionel Sambuc const char *pci_baseclass_name(pcireg_t reg); 743641562fSLionel Sambuc const char *pci_subclass_name(pcireg_t reg); 75