xref: /minix3/minix/drivers/bus/pci/pci.h (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /*
2*433d6423SLionel Sambuc pci.h
3*433d6423SLionel Sambuc 
4*433d6423SLionel Sambuc Created:	Jan 2000 by Philip Homburg <philip@cs.vu.nl>
5*433d6423SLionel Sambuc */
6*433d6423SLionel Sambuc 
7*433d6423SLionel Sambuc #include <minix/drivers.h>
8*433d6423SLionel Sambuc #include <minix/driver.h>
9*433d6423SLionel Sambuc #include <minix/rs.h>
10*433d6423SLionel Sambuc 
11*433d6423SLionel Sambuc /* tempory functions: to be replaced later (see pci_intel.h) */
12*433d6423SLionel Sambuc unsigned pci_inb(u16_t port);
13*433d6423SLionel Sambuc unsigned pci_inw(u16_t port);
14*433d6423SLionel Sambuc unsigned pci_inl(u16_t port);
15*433d6423SLionel Sambuc 
16*433d6423SLionel Sambuc void pci_outb(u16_t port, u8_t value);
17*433d6423SLionel Sambuc void pci_outw(u16_t port, u16_t value);
18*433d6423SLionel Sambuc void pci_outl(u16_t port, u32_t value);
19*433d6423SLionel Sambuc 
20*433d6423SLionel Sambuc struct pci_vendor
21*433d6423SLionel Sambuc {
22*433d6423SLionel Sambuc 	u16_t vid;
23*433d6423SLionel Sambuc 	char *name;
24*433d6423SLionel Sambuc };
25*433d6423SLionel Sambuc 
26*433d6423SLionel Sambuc struct pci_device
27*433d6423SLionel Sambuc {
28*433d6423SLionel Sambuc 	u16_t vid;
29*433d6423SLionel Sambuc 	u16_t did;
30*433d6423SLionel Sambuc 	char *name;
31*433d6423SLionel Sambuc };
32*433d6423SLionel Sambuc 
33*433d6423SLionel Sambuc struct pci_baseclass
34*433d6423SLionel Sambuc {
35*433d6423SLionel Sambuc 	u8_t baseclass;
36*433d6423SLionel Sambuc 	char *name;
37*433d6423SLionel Sambuc };
38*433d6423SLionel Sambuc 
39*433d6423SLionel Sambuc struct pci_subclass
40*433d6423SLionel Sambuc {
41*433d6423SLionel Sambuc 	u8_t baseclass;
42*433d6423SLionel Sambuc 	u8_t subclass;
43*433d6423SLionel Sambuc 	u16_t infclass;
44*433d6423SLionel Sambuc 	char *name;
45*433d6423SLionel Sambuc };
46*433d6423SLionel Sambuc 
47*433d6423SLionel Sambuc struct pci_intel_ctrl
48*433d6423SLionel Sambuc {
49*433d6423SLionel Sambuc 	u16_t vid;
50*433d6423SLionel Sambuc 	u16_t did;
51*433d6423SLionel Sambuc };
52*433d6423SLionel Sambuc 
53*433d6423SLionel Sambuc struct pci_isabridge
54*433d6423SLionel Sambuc {
55*433d6423SLionel Sambuc 	u16_t vid;
56*433d6423SLionel Sambuc 	u16_t did;
57*433d6423SLionel Sambuc 	int checkclass;
58*433d6423SLionel Sambuc 	int type;
59*433d6423SLionel Sambuc };
60*433d6423SLionel Sambuc 
61*433d6423SLionel Sambuc struct pci_pcibridge
62*433d6423SLionel Sambuc {
63*433d6423SLionel Sambuc 	u16_t vid;
64*433d6423SLionel Sambuc 	u16_t did;
65*433d6423SLionel Sambuc 	int type;
66*433d6423SLionel Sambuc };
67*433d6423SLionel Sambuc 
68*433d6423SLionel Sambuc struct pci_acl
69*433d6423SLionel Sambuc {
70*433d6423SLionel Sambuc 	int inuse;
71*433d6423SLionel Sambuc 	struct rs_pci acl;
72*433d6423SLionel Sambuc };
73*433d6423SLionel Sambuc 
74*433d6423SLionel Sambuc #define NR_DRIVERS	NR_SYS_PROCS
75*433d6423SLionel Sambuc 
76*433d6423SLionel Sambuc #define PCI_IB_PIIX	1	/* Intel PIIX compatible ISA bridge */
77*433d6423SLionel Sambuc #define PCI_IB_VIA	2	/* VIA compatible ISA bridge */
78*433d6423SLionel Sambuc #define PCI_IB_AMD	3	/* AMD compatible ISA bridge */
79*433d6423SLionel Sambuc #define PCI_IB_SIS	4	/* SIS compatible ISA bridge */
80*433d6423SLionel Sambuc 
81*433d6423SLionel Sambuc #define PCI_PPB_STD	1	/* Standard PCI-to-PCI bridge */
82*433d6423SLionel Sambuc #define PCI_PPB_CB	2	/* Cardbus bridge */
83*433d6423SLionel Sambuc /* Still needed? */
84*433d6423SLionel Sambuc #define PCI_AGPB_VIA	3	/* VIA compatible AGP bridge */
85*433d6423SLionel Sambuc 
86*433d6423SLionel Sambuc extern struct pci_vendor pci_vendor_table[];
87*433d6423SLionel Sambuc extern struct pci_device pci_device_table[];
88*433d6423SLionel Sambuc extern struct pci_baseclass pci_baseclass_table[];
89*433d6423SLionel Sambuc extern struct pci_subclass pci_subclass_table[];
90*433d6423SLionel Sambuc #if 0
91*433d6423SLionel Sambuc extern struct pci_intel_ctrl pci_intel_ctrl[];
92*433d6423SLionel Sambuc #endif
93*433d6423SLionel Sambuc extern struct pci_isabridge pci_isabridge[];
94*433d6423SLionel Sambuc extern struct pci_pcibridge pci_pcibridge[];
95*433d6423SLionel Sambuc 
96*433d6423SLionel Sambuc /* Function prototypes. */
97*433d6423SLionel Sambuc int sef_cb_init_fresh(int type, sef_init_info_t *info);
98*433d6423SLionel Sambuc int map_service(struct rprocpub *rpub);
99*433d6423SLionel Sambuc int pci_reserve_a(int devind, endpoint_t proc, struct rs_pci *aclp);
100*433d6423SLionel Sambuc void pci_release(endpoint_t proc);
101*433d6423SLionel Sambuc int pci_first_dev_a(struct rs_pci *aclp, int *devindp, u16_t *vidp,
102*433d6423SLionel Sambuc 	u16_t *didp);
103*433d6423SLionel Sambuc int pci_next_dev_a(struct rs_pci *aclp, int *devindp, u16_t *vidp, u16_t
104*433d6423SLionel Sambuc 	*didp);
105*433d6423SLionel Sambuc 
106*433d6423SLionel Sambuc int pci_attr_r8_s(int devind, int port, u8_t *vp);
107*433d6423SLionel Sambuc int pci_attr_r32_s(int devind, int port, u32_t *vp);
108*433d6423SLionel Sambuc int pci_get_bar_s(int devind, int port, u32_t *base, u32_t *size, int
109*433d6423SLionel Sambuc 	*ioflag);
110*433d6423SLionel Sambuc int pci_slot_name_s(int devind, char **cpp);
111*433d6423SLionel Sambuc int pci_ids_s(int devind, u16_t *vidp, u16_t *didp);
112*433d6423SLionel Sambuc 
113*433d6423SLionel Sambuc /*
114*433d6423SLionel Sambuc  * $PchId: pci.h,v 1.4 2001/12/06 20:21:22 philip Exp $
115*433d6423SLionel Sambuc  */
116