2 BusCBUS = 0, /* Corollary CBUS */
3 BusCBUSII, /* Corollary CBUS II */
4 BusEISA, /* Extended ISA */
5 BusFUTURE, /* IEEE Futurebus */
6 BusINTERN, /* Internal bus */
7 BusISA, /* Industry Standard Architecture */
8 BusMBI, /* Multibus I */
9 BusMBII, /* Multibus II */
10 BusMCA, /* Micro Channel Architecture */
13 BusNUBUS, /* Apple Macintosh NuBus */
14 BusPCI, /* Peripheral Component Interconnect */
15 BusPCMCIA, /* PC Memory Card International Association */
16 BusTC, /* DEC TurboChannel */
17 BusVL, /* VESA Local bus */
19 BusXPRESS, /* Express System Bus */
23 #define MKBUS(t,b,d,f) (((t)<<24)|(((b)&0xFF)<<16)|(((d)&0x1F)<<11)|(((f)&0x07)<<8))
24 #define BUSFNO(tbdf) (((tbdf)>>8)&0x07)
25 #define BUSDNO(tbdf) (((tbdf)>>11)&0x1F)
26 #define BUSBNO(tbdf) (((tbdf)>>16)&0xFF)
27 #define BUSTYPE(tbdf) ((tbdf)>>24)
28 #define BUSBDF(tbdf) ((tbdf)&0x00FFFF00)
33 enum { /* type 0 & type 1 pre-defined header */
34 PciVID = 0x00, /* vendor ID */
35 PciDID = 0x02, /* device ID */
36 PciPCR = 0x04, /* command */
37 PciPSR = 0x06, /* status */
38 PciRID = 0x08, /* revision ID */
39 PciCCRp = 0x09, /* programming interface class code */
40 PciCCRu = 0x0A, /* sub-class code */
41 PciCCRb = 0x0B, /* base class code */
42 PciCLS = 0x0C, /* cache line size */
43 PciLTR = 0x0D, /* latency timer */
44 PciHDT = 0x0E, /* header type */
45 PciBST = 0x0F, /* BIST */
48 /* ccrb (base class code) values; controller types */
50 Pcibcpci1 = 0, /* pci 1.0; no class codes defined */
51 Pcibcstore = 1, /* mass storage */
52 Pcibcnet = 2, /* network */
53 Pcibcdisp = 3, /* display */
54 Pcibcmmedia = 4, /* multimedia */
55 Pcibcmem = 5, /* memory */
56 Pcibcbridge = 6, /* bridge */
57 Pcibccomm = 7, /* simple comms (e.g., serial) */
58 Pcibcbasesys = 8, /* base system */
59 Pcibcinput = 9, /* input */
60 Pcibcdock = 0xa, /* docking stations */
61 Pcibcproc = 0xb, /* processors */
62 Pcibcserial = 0xc, /* serial bus (e.g., USB) */
63 Pcibcwireless = 0xd, /* wireless */
64 Pcibcintell = 0xe, /* intelligent i/o */
65 Pcibcsatcom = 0xf, /* satellite comms */
66 Pcibccrypto = 0x10, /* encryption/decryption */
67 Pcibcdacq = 0x11, /* data acquisition & signal proc. */
70 /* ccru (sub-class code) values; common cases only */
73 Pciscscsi = 0, /* SCSI */
74 Pciscide = 1, /* IDE (ATA) */
77 Pciscether = 0, /* Ethernet */
80 Pciscvga = 0, /* VGA */
81 Pciscxga = 1, /* XGA */
85 Pcischostpci = 0, /* host/pci */
86 Pciscpcicpci = 1, /* pci/pci */
89 Pciscserial = 0, /* 16450, etc. */
90 Pciscmultiser = 1, /* multiport serial */
93 Pciscusb = 3, /* USB */
96 enum { /* type 0 pre-defined header */
97 PciCIS = 0x28, /* cardbus CIS pointer */
98 PciSVID = 0x2C, /* subsystem vendor ID */
99 PciSID = 0x2E, /* subsystem ID */
100 PciEBAR0 = 0x30, /* expansion ROM base address */
101 PciMGNT = 0x3E, /* burst period length */
102 PciMLT = 0x3F, /* maximum latency between bursts */
105 enum { /* type 1 pre-defined header */
106 PciPBN = 0x18, /* primary bus number */
107 PciSBN = 0x19, /* secondary bus number */
108 PciUBN = 0x1A, /* subordinate bus number */
109 PciSLTR = 0x1B, /* secondary latency timer */
110 PciIBR = 0x1C, /* I/O base */
111 PciILR = 0x1D, /* I/O limit */
112 PciSPSR = 0x1E, /* secondary status */
113 PciMBR = 0x20, /* memory base */
114 PciMLR = 0x22, /* memory limit */
115 PciPMBR = 0x24, /* prefetchable memory base */
116 PciPMLR = 0x26, /* prefetchable memory limit */
117 PciPUBR = 0x28, /* prefetchable base upper 32 bits */
118 PciPULR = 0x2C, /* prefetchable limit upper 32 bits */
119 PciIUBR = 0x30, /* I/O base upper 16 bits */
120 PciIULR = 0x32, /* I/O limit upper 16 bits */
121 PciEBAR1 = 0x28, /* expansion ROM base address */
122 PciBCR = 0x3E, /* bridge control register */
125 enum { /* type 2 pre-defined header */
128 PciCBPBN = 0x18, /* primary bus number */
129 PciCBSBN = 0x19, /* secondary bus number */
130 PciCBUBN = 0x1A, /* subordinate bus number */
131 PciCBSLTR = 0x1B, /* secondary latency timer */
136 PciCBIBR0 = 0x2C, /* I/O base */
137 PciCBILR0 = 0x30, /* I/O limit */
138 PciCBIBR1 = 0x34, /* I/O base */
139 PciCBILR1 = 0x38, /* I/O limit */
140 PciCBSVID = 0x40, /* subsystem vendor ID */
141 PciCBSID = 0x42, /* subsystem ID */
142 PciCBLMBAR = 0x44, /* legacy mode base address */
145 typedef struct Pcisiz Pcisiz;
153 typedef struct Pcidev Pcidev;
156 int tbdf; /* type+bus+device+function */
157 ushort vid; /* vendor ID */
158 ushort did; /* device ID */
170 ulong bar; /* base address */
178 uchar intl; /* interrupt line */
181 Pcidev* link; /* next device on this bno */
183 Pcidev* bridge; /* down a bus */
189 int pmrb; /* power management register block */
193 #define PCIWADDR(va) (PADDR(va)+PCIWINDOW)
200 AddrEfuse = PHYSIO+0x1008c,
201 Addrpci = PHYSIO+0x40000, /* for registers below */
202 Addrpcibase = PHYSIO+0x41800, /* for registers below */
203 AddrMpp = PHYSIO+0x10000,
204 AddrSdio = PHYSIO+0x90000,
214 /* registers; if we actually use these, change to soc.pci(base)->reg */
215 PciBAR0 = Addrpcibase + 4, /* base address */
216 PciBAR1 = Addrpcibase + 8,
218 PciCP = Addrpci + 0x64, /* capabilities pointer */
220 PciINTL = Addrpci + 0x3c, /* interrupt line */
221 PciINTP = PciINTL + 1, /* interrupt pin */
229 Irqlo, Irqhi, Irqbridge,
233 /* main interrupt cause low register bit #s (LE) */
234 IRQ0hisum, /* summary of main intr high cause reg */
243 IRQ0pex0int, /* pex = pci-express */
267 /* main interrupt cause high register bit #s (LE) */
292 /* bridged-interrupt causes */
301 * interrupt controller
303 typedef struct IntrReg IntrReg;
307 ulong irq; /* main intr cause reg (ro) */
315 * CPU control & status (archkw.c and trap.c)
317 typedef struct CpucsReg CpucsReg;
324 ulong irq; /* mbus(-l) bridge interrupt cause */
325 ulong irqmask; /* ⋯ mask */
326 ulong mempm; /* memory power mgmt. control */
327 ulong clockgate; /* clock enable bits */
330 ulong l2cfg; /* turn l2 cache on or off, set coherency */
344 Cfgvecinithi = 1<<1, /* boot at 0xffff0000, not 0; default 1 */
345 Cfgbigendreset = 3<<1, /* init. as big-endian at reset; default 0 */
346 Cfgiprefetch = 1<<16, /* instruction prefetch enable */
347 Cfgdprefetch = 1<<17, /* data prefetch enable */
350 Reset = 1<<1, /* reset cpu core */
353 RstoutPex = 1<<0, /* assert RSTOUTn at pci-e reset */
354 RstoutWatchdog = 1<<1, /* assert RSTOUTn at watchdog timeout */
355 RstoutSoft = 1<<2, /* assert RSTOUTn at sw reset */
358 ResetSystem = 1<<0, /* assert RSTOUTn pin on SoftRstOutEn */
362 L2exists = 1<<3, /* l2 cache doesn't ignore cpu */
363 L2writethru = 1<<4, /* always WT, else see PTE C & B */
367 /* from 88f6281 func'l specs (MV-S104860-00), tables 2 & 3, chapter 2 */
368 Targdram = 0, /* ddr sdram */
370 Targcesasram = 3, /* security accelerator sram */
373 Attrcs0 = 0xe, /* chip select 0 (low dram) */
374 Attrcs1 = 0xd, /* chip select 1 (high dram) */
382 typedef struct Pciex Pciex;
384 ushort venid; /* 0x11ab means Marvell */
385 ushort devid; /* 0x6281 means 6281 */
388 ulong bistcache; /* bist hdr type & cache-line size */
396 ushort ssvenid; /* 0x11ab means Marvell */
397 ushort ssdevid; /* 0x11ab means Marvell */
401 ulong intrpinline; /* interrupt pin & line */
402 ulong pmcap; /* power mgmt. capability header */
403 ulong pmcsr; /* power mgmt. control & status */
405 ulong msictl; /* msi message control */
415 uchar _pad[0x40100-0x40074];
416 ulong errrep; /* advanced error report header */
417 ulong uncorrerr; /* uncorrectable error status */
418 ulong uncorrerrmask; /* uncorrectable error mask */
419 ulong uncorrerrsev; /* uncorrectable error severity */
420 ulong correrr; /* correctable error status */
421 ulong correrrmask; /* correctable error mask */
422 ulong errcap; /* advanced error capability & ctl. */
423 ulong hdrlog[4]; /* header log */
424 /* continues with more rubbish at 0x41a00. some day... */