source: branches/minix3-book/drivers/libpci/pci_intel.h@ 23

Last change on this file since 23 was 4, checked in by Mattia Monga, 14 years ago

Importazione sorgenti libro

File size: 1.9 KB
Line 
1/*
2pci_intel.h
3
4Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
5*/
6
7#define PCII_CONFADD 0xCF8
8#define PCIIC_CODE 0x80000000
9#define PCIIC_BUSNUM_MASK 0xff0000
10#define PCIIC_BUSNUM_SHIFT 16
11#define PCIIC_DEVNUM_MASK 0xf800
12#define PCIIC_DEVNUM_SHIFT 11
13#define PCIIC_FUNCNUM_MASK 0x700
14#define PCIIC_FUNCNUM_SHIFT 8
15#define PCIIC_REGNUM_MASK 0xfc
16#define PCIIC_REGNUM_SHIFT 2
17#define PCII_CONFDATA 0xCFC
18
19#define PCII_SELREG_(bus, dev, func, reg) \
20 (PCIIC_CODE | \
21 (((bus) << PCIIC_BUSNUM_SHIFT) & PCIIC_BUSNUM_MASK) | \
22 (((dev) << PCIIC_DEVNUM_SHIFT) & PCIIC_DEVNUM_MASK) | \
23 (((func) << PCIIC_FUNCNUM_SHIFT) & PCIIC_FUNCNUM_MASK) | \
24 ((((reg)/4) << PCIIC_REGNUM_SHIFT) & PCIIC_REGNUM_MASK))
25#define PCII_UNSEL (0)
26
27#define PCII_RREG8_(bus, dev, func, reg) \
28 (pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
29 pci_inb(PCII_CONFDATA+((reg)&3)))
30#define PCII_RREG16_(bus, dev, func, reg) \
31 (PCII_RREG8_(bus, dev, func, reg) | \
32 (PCII_RREG8_(bus, dev, func, reg+1) << 8))
33#define PCII_RREG32_(bus, dev, func, reg) \
34 (PCII_RREG16_(bus, dev, func, reg) | \
35 (PCII_RREG16_(bus, dev, func, reg+2) << 16))
36
37#define PCII_WREG8_(bus, dev, func, reg, val) \
38 (pci_outl(PCII_CONFADD, PCII_SELREG_(bus, dev, func, reg)), \
39 pci_outb(PCII_CONFDATA+((reg)&3), (val)))
40#define PCII_WREG16_(bus, dev, func, reg, val) \
41 (PCII_WREG8_(bus, dev, func, reg, (val)), \
42 (PCII_WREG8_(bus, dev, func, reg+1, (val) >> 8)))
43#define PCII_WREG32_(bus, dev, func, reg, val) \
44 (PCII_WREG16_(bus, dev, func, reg, (val)), \
45 (PCII_WREG16_(bus, dev, func, reg+2, (val) >> 16)))
46
47/* PIIX configuration registers */
48#define PIIX_PIRQRCA 0x60
49#define PIIX_IRQ_DI 0x80
50#define PIIX_IRQ_MASK 0x0F
51
52/* PIIX extensions to the PIC */
53#define PIIX_ELCR1 0x4D0
54#define PIIX_ELCR2 0x4D1
55
56/*
57 * $PchId: pci_intel.h,v 1.1 2000/08/12 11:20:17 philip Exp $
58 */
Note: See TracBrowser for help on using the repository browser.