00001 #ifndef _PCI911_PLX_H_
00002 #define _PCI911_PLX_H_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #define VULONG volatile unsigned long
00013 #define VUSHORT volatile unsigned short
00014 #define VUCHAR volatile unsigned char
00015
00016
00017 #define PCI9060_UNIT0_BASE 0xA0000000
00018 #define PCI9060_UNIT1_BASE 0x11100000
00019
00020
00021 #define PLX_UNIT0_MEMBASE 0x10000000
00022 #define PLX_UNIT1_MEMBASE 0x11000000
00023
00024 #define PLX_UNIT0_IOBASE 0x20000000
00025 #define PLX_UNIT1_IOBASE 0x22000000
00026
00027
00028 #define NUM_PCI_BUSES 2
00029 #define MAX_PLX_UNITNUM 1
00030 #define NUM_PCI_SLOTS 8
00031 #define SLOTS_PER_BRIDGE 4
00032 #define PCI_MAX_FUNCTIONS 8
00033
00034
00035 #define INTA 0
00036 #define INTB 1
00037 #define INTC 2
00038 #define INTD 3
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #define PCI_WORD_REG(n,m) ((VULONG *)(n + m))
00050 #define PCI_SHORT_REG(n,m) ((VUSHORT *)(n + m))
00051 #define PCI_CHAR_REG(n,m) ((VUCHAR *)(n + m))
00052
00053
00054
00055
00056 #define PCI_VENDOR_ID(n) PCI_SHORT_REG(n,0x00)
00057 #define PCI_DEVICE_ID(n) PCI_SHORT_REG(n,0x02)
00058 #define PCI_COMMAND(n) PCI_SHORT_REG(n,0x04)
00059 #define PCI_STATUS(n) PCI_SHORT_REG(n,0x06)
00060 #define PCI_REV_ID(n) PCI_CHAR_REG(n,0x08)
00061
00062 #define PCI_CLASS_CODE(n) PCI_WORD_REG(n,0x08)
00063 #define PCI_CACHE_LINE_SZ(n) PCI_CHAR_REG(n,0x0c)
00064 #define PCI_LATENCY_TIMER(n) PCI_CHAR_REG(n,0x0d)
00065 #define PCI_HEADER_TYPE(n) PCI_CHAR_REG(n,0x0e)
00066 #define PCI_BIST(n) PCI_CHAR_REG(n,0x0f)
00067 #define PCI_BASE_MMAP_REG(n) PCI_WORD_REG(n,0x10)
00068 #define PCI_BASE_IOMAP_REG(n) PCI_WORD_REG(n,0x14)
00069 #define PCI_BASE_LOCAL_MEM(n) PCI_WORD_REG(n,0x18)
00070 #define PCI_BASE_EXP_ROM(n) PCI_WORD_REG(n,0x30)
00071 #define PCI_INT_LINE(n) PCI_CHAR_REG(n,0x3c)
00072 #define PCI_MIN_GNT(n) PCI_CHAR_REG(n,0x3e)
00073 #define PCI_MAX_LAT(n) PCI_CHAR_REG(n,0x3f)
00074
00075
00076
00077
00078
00079
00080
00081
00082 #define RANGE_PTOL_MEM(n) PCI_WORD_REG(n,0x80)
00083 #define LOCAL_BASE_PTOL_MEM(n) PCI_WORD_REG(n,0x84)
00084 #define RANGE_PTOL_ROM(n) PCI_WORD_REG(n,0x90)
00085 #define BREQO_CONTROL(n) PCI_WORD_REG(n,0x94)
00086 #define BUS_REGION_DESC_PTOL(n) PCI_WORD_REG(n,0x98)
00087 #define RANGE_MTOP(n) PCI_WORD_REG(n,0x9c)
00088 #define LOCAL_BASE_MTOPM(n) PCI_WORD_REG(n,0xa0)
00089 #define LOCAL_BASE_MTOPI(n) PCI_WORD_REG(n,0xa4)
00090 #define PCI_BASE_MTOP(n) PCI_WORD_REG(n,0xa8)
00091 #define PCI_CONFIG_ADDR_REG(n) PCI_WORD_REG(n,0xac)
00092
00093
00094
00095 #define PTOL_MBOX0(n) PCI_WORD_REG(n,0xc0)
00096 #define PTOL_MBOX1(n) PCI_WORD_REG(n,0xc4)
00097 #define PTOL_MBOX2(n) PCI_WORD_REG(n,0xc8)
00098 #define PTOL_MBOX3(n) PCI_WORD_REG(n,0xcc)
00099 #define LTOP_MBOX4(n) PCI_WORD_REG(n,0xd0)
00100 #define LTOP_MBOX5(n) PCI_WORD_REG(n,0xd4)
00101 #define LTOP_MBOX6(n) PCI_WORD_REG(n,0xd8)
00102 #define LTOP_MBOX7(n) PCI_WORD_REG(n,0xdc)
00103 #define PTOL_DOORBELL(n) PCI_WORD_REG(n,0xe0)
00104 #define LTOP_DOORBELL(n) PCI_WORD_REG(n,0xe4)
00105 #define PCI_INT_CSTAT(n) PCI_WORD_REG(n,0xe8)
00106 #define PCI_EEPROM_CTL(n) PCI_WORD_REG(n,0xec)
00107
00108 #define PTOL_DOORBELL_PCI_OFFSET 0x60
00109
00110
00111
00112 #define DMA_CH0_MODE(n) PCI_WORD_REG(n,0x100)
00113 #define DMA_CH0_PADDR(n) PCI_WORD_REG(n,0x104)
00114 #define DMA_CH0_LADDR(n) PCI_WORD_REG(n,0x108)
00115 #define DMA_CH0_BCOUNT(n) PCI_WORD_REG(n,0x10c)
00116 #define DMA_CH0_DPTR(n) PCI_WORD_REG(n,0x110)
00117 #define DMA_CH1_MODE(n) PCI_WORD_REG(n,0x114)
00118 #define DMA_CH1_PADDR(n) PCI_WORD_REG(n,0x118)
00119 #define DMA_CH1_LADDR(n) PCI_WORD_REG(n,0x11c)
00120 #define DMA_CH1_BCOUNT(n) PCI_WORD_REG(n,0x120)
00121 #define DMA_CH1_DPTR(n) PCI_WORD_REG(n,0x124)
00122 #define DMA_CMD_STAT(n) PCI_WORD_REG(n,0x128)
00123 #define DMA_ARB_REG0(n) PCI_WORD_REG(n,0x12c)
00124 #define DMA_ARB_REG1(n) PCI_WORD_REG(n,0x130)
00125
00126
00127 #define PCI_CMD_IOSPACE (1 << 0)
00128 #define PCI_CMD_MEMSPACE (1 << 1)
00129 #define PCI_CMD_MASTER_ENAB (1 << 2)
00130 #define PCI_CMD_PARITY_RESP (1 << 6)
00131 #define PCI_CMD_SERR_ENAB (1 << 8)
00132 #define PCI_CMD_FASTBB_ENAB (1 << 9)
00133
00134
00135 #define PCI_STAT_FASTBB_CAP (1 << 7)
00136 #define PCI_DATA_PARITY_ERR (1 << 8)
00137 #define PCI_TARGET_ABORT (1 << 11)
00138 #define PCI_RCV_TARGET_ABORT (1 << 12)
00139 #define PCI_RCV_MASTER_ABORT (1 << 13)
00140 #define PCI_SIGNALLED_SERR (1 << 14)
00141 #define PCI_BUS_PARITY_ERR (1 << 15)
00142
00143
00144 #define PCI_DEVSEL_TIMING(n) ((*PCI_STATUS(n) & 0x0600) >> 9)
00145
00146
00147 #define PCI_REG_LEVEL_PROG_IF(n) ((*PCI_CLASS_CODE(n) & 0x0000ff00) >> 8)
00148 #define PCI_SUB_CLASS_ENCODING(n) ((*PCI_CLASS_CODE(n) & 0x00ff0000) >> 16)
00149 #define PCI_BASE_CLASS_ENCODING(n) ((*PCI_CLASS_CODE(n) & 0xff000000) >> 24)
00150
00151
00152 #define PCI_DEVICE_SUPPORTS_BIST (1 << 7)
00153 #define PCI_POST_BIST_RESULTS(n,x) (*PCI_BIST(n) |= (x & 0x0f))
00154 #define PCI_BIST_INTERRUPT (1 << 6)
00155
00156
00157 #define SIGNALLED_SYSTEM_ERROR (1 << 14)
00158 #define RCVD_MASTER_ABORT (1 << 13)
00159 #define RCVD_TARGET_ABORT (1 << 12)
00160 #define SIGNALLED_TARGET_ABORT (1 << 11)
00161 #define LOCAL_INT_ACTIVE (1 << 15)
00162 #define LSERR_INT_ENABLE (1 << 0)
00163 #define LOCAL_INT_ENABLE (1 << 16)
00164 #define PCI_INT_ENABLE (1 << 8)
00165 #define LOCAL_DOORBELL_ENABLE (1 << 17)
00166 #define PCI_DOORBELL_ENABLE (1 << 9)
00167 #define DMA_CH0_INT_ENABLE (1 << 18)
00168 #define DMA_CH1_INT_ENABLE (1 << 19)
00169 #define LOCAL_DOORBELL_INT (1 << 20)
00170 #define DMA_CH0_INT (1 << 21)
00171 #define DMA_CH1_INT (1 << 22)
00172 #define BIST_INT (1 << 23)
00173 #define CPU_MASTER_ABORT (1 << 24)
00174 #define DMA0_MASTER_ABORT (1 << 25)
00175 #define DMA1_MASTER_ABORT (1 << 26)
00176 #define RETRIES_TARGET_ABORT (1 << 27)
00177 #define DMA0_DONE (1 << 4)
00178 #define DMA1_DONE (1 << 12)
00179 #define CLEAR_CH0_INTS (1 << 3)
00180 #define CLEAR_CH1_INTS (1 << 11)
00181 #define MAX_RETRIES_256 (1 << 12)
00182 #define DMA_CH0_ENABLE (1 << 0)
00183 #define DMA_CH1_ENABLE (1 << 8)
00184 #define DMA_CH0_START (1 << 1)
00185 #define DMA_CH1_START (1 << 9)
00186 #define DMA_CH0_ABORT (1 << 2)
00187 #define DMA_CH1_ABORT (1 << 10)
00188 #define DMA_WRITE (1 << 3)
00189 #define BIST_NOT_SUPPORTED (0 << 0)
00190 #define PCI_BURST_TIME (0xff)
00191
00192
00193
00194 #define CLEAR_SIG_SERR(n) (*PCI_STATUS(n) |= SIGNALLED_SYSTEM_ERROR)
00195 #define CLEAR_SIG_ABORT(n) (*PCI_STATUS(n) |= SIGNALLED_TARGET_ABORT)
00196 #define CLEAR_MASTER_ABORT(n) (*PCI_STATUS(n) |= RCVD_MASTER_ABORT)
00197 #define CLEAR_TARGET_ABORT(n) (*PCI_STATUS(n) |= RCVD_TARGET_ABORT)
00198 #define CLEAR_BUS_PARITY_ERROR(n) (*PCI_STATUS(n) |= PCI_BUS_PARITY_ERR)
00199 #define CLR_DMA_CH0(n) (*DMA_CMD_STAT(n) |= CLEAR_CH0_INTS)
00200 #define CLR_DMA_CH1(n) (*DMA_CMD_STAT(n) |= CLEAR_CH1_INTS)
00201 #define DISABLE_DMA_CH0(n) (*DMA_CMD_STAT(n) &= ~(DMA_CH0_ENABLE))
00202 #define DISABLE_DMA_CH1(n) (*DMA_CMD_STAT(n) &= ~(DMA_CH1_ENABLE))
00203 #define ENABLE_DMA_CH0(n) (*DMA_CMD_STAT(n) |= DMA_CH0_ENABLE)
00204 #define ENABLE_DMA_CH1(n) (*DMA_CMD_STAT(n) |= DMA_CH1_ENABLE)
00205 #define START_DMA_CH0(n) (*DMA_CMD_STAT(n) |= DMA_CH0_START)
00206 #define START_DMA_CH1(n) (*DMA_CMD_STAT(n) |= DMA_CH1_START)
00207 #define ABORT_DMA_CH0(n) (*DMA_CMD_STAT(n) |= DMA_CH0_ABORT)
00208 #define ABORT_DMA_CH1(n) (*DMA_CMD_STAT(n) |= DMA_CH1_ABORT)
00209 #define DMA_CH0_WRITE(n) (*DMA_CH0_DPTR(n) |= DMA_WRITE)
00210 #define DMA_CH0_READ(n) (*DMA_CH0_DPTR(n) &= ~(DMA_WRITE))
00211 #define DMA_CH1_WRITE(n) (*DMA_CH1_DPTR(n) |= DMA_WRITE)
00212 #define DMA_CH1_READ(n) (*DMA_CH1_DPTR(n) &= ~(DMA_WRITE))
00213 #define PCI_INIT_DONE(n) (*PCI_EEPROM_CTL(n) |= (1 << 31))
00214 #define IS_DONE_SET(n) (*PCI_EEPROM_CTL(n) & (1 << 31))
00215 #define DISABLE_LSERR(n) (*PCI_INT_CSTAT(n) &= ~(LSERR_INT_ENABLE))
00216 #define ENABLE_LSERR(n) (*PCI_INT_CSTAT(n) |= LSERR_INT_ENABLE)
00217 #define PCI_IO_BASEADDR() (0x20000000)
00218 #define PCI_MEM_BASEADDR() (0x00000000)
00219
00220
00221 #define PCI_IACK (unsigned char)0x0
00222 #define PCI_SPECIAL (unsigned char)0x1
00223 #define PCI_IO_RD (unsigned char)0x2
00224 #define PCI_IO_WR (unsigned char)0x3
00225 #define PCI_MEM_RD (unsigned char)0x6
00226 #define PCI_MEM_WR (unsigned char)0x7
00227 #define PCI_CFG_RD (unsigned char)0xa
00228 #define PCI_CFG_WR (unsigned char)0xb
00229 #define PCI_MEM_RD_MULT (unsigned char)0xc
00230 #define PCI_DUAL_ADDR (unsigned char)0xd
00231 #define PCI_MEM_RD_LINE (unsigned char)0xe
00232 #define PCI_MEM_WR_INV (unsigned char)0xf
00233
00234 #define DMA_READ_CODE (PCI_MEM_RD << 0)
00235 #define DMA_WRITE_CODE (PCI_MEM_WR << 4)
00236 #define MASTER_READ_CODE (PCI_MEM_RD << 8)
00237 #define MASTER_WRITE_CODE (PCI_MEM_WR << 12)
00238
00239 #define RANGE_DRAM_32 0xfe000000
00240 #define RANGE_DRAM_8 0xff800000
00241 #define RANGE_DRAM_2 0xffe00000
00242
00243 #define BASE_DRAM 0x10000001
00244 #define NO_IO_SPACE 0x00000000
00245 #define PCI_MEMORY_SPACE 0x00000000
00246
00247
00248 #define BREQO_ENABLE (1 << 4)
00249 #define DEADLOCK_TIMEOUT 0x4
00250 #define ROM_REMAP_ADDR (0xf << 28)
00251
00252
00253 #define MEM_BUS_32BIT 0x3
00254 #define MEM_USE_RDY_INPUT (1 << 6)
00255 #define MEM_USE_BTERM_INPUT (1 << 7)
00256 #define ROM_BUS_8BIT (0x0 << 16)
00257 #define ROM_USE_RDY_INPUT (1 << 22)
00258 #define MEM_BURST_ENABLE (1 << 24)
00259 #define ROM_BURST_DISABLE (0 << 26)
00260 #define NO_TRDY_WHEN_TXFULL (1 << 27)
00261 #define RETRY_TIMEOUT (8 << 28)
00262
00263
00264 #define PCI_MEM_MASTER_ENAB (1 << 0)
00265 #define PCI_IO_MASTER_DISAB (0 << 1)
00266 #define PCI_IO_MASTER_ENAB (1 << 1)
00267 #define PCI_LOCK_ENAB (1 << 2)
00268 #define PCI_PREFETCH_DISAB (0 << 3)
00269 #define PCI_RELEASE_FIFO_FULL (0 << 4)
00270 #define PCI_REMAP_ADDR (0x0000 < 16)
00271
00272 #define PCI_CONFIG_DISAB (0 << 31)
00273
00274 #define ROM_DECODE_ENABLE (1 << 0)
00275 #define ROM_DECODE_DISABLE (0 << 0)
00276
00277 #define TEST_VAL (unsigned long) 0x43564d45
00278 #define DRAM_2MEG 0x10200000
00279 #define DRAM_8MEG 0x10800000
00280 #define DRAM_32MEG 0x12000000
00281
00282
00283 #define LOCAL_BUS_32BIT 0x3
00284 #define USE_RDY_INPUT (1 << 6)
00285 #define USE_BTERM_INPUT (1 << 7)
00286 #define DMA_BURSTING_ENABLE (1 << 8)
00287 #define DMA_BURSTING_DISABLE (0 << 8)
00288 #define DMA_CHAINING_DISABLED (0 << 9)
00289 #define DMA_INT_ENDOFTRANSFER (1 << 10)
00290
00291
00292 #define DMA_ARB0_VALUE 0x0
00293
00294
00295 #define DMA_ARB1_VALUE 0x0
00296
00297
00298
00299 #define DMA_MODE_VALUE LOCAL_BUS_32BIT | USE_RDY_INPUT
00300
00301
00302
00303
00304
00305
00306
00307 typedef struct
00308 {
00309 unsigned short vendor_id;
00310 unsigned short device_id;
00311 unsigned short command;
00312 unsigned short status;
00313 unsigned char revision_id;
00314 unsigned char prog_if;
00315 unsigned char sub_class;
00316 unsigned char base_class;
00317 unsigned char cache_line_size;
00318 unsigned char latency_timer;
00319 unsigned char header_type;
00320 unsigned char bist;
00321 unsigned long pcibase_mm_regs;
00322 unsigned long pcibase_im_regs;
00323 unsigned long pcibase_local;
00324 unsigned long reserved1[5];
00325 unsigned long pcibase_exp_rom;
00326 unsigned long reserved2[2];
00327 unsigned char int_line;
00328 unsigned char int_pin;
00329 unsigned char min_gnt;
00330 unsigned char max_lat;
00331 } PCI_CONFIG_SPACE;
00332
00333
00334
00335 #define VENDOR_STAR 0x1111
00336 #define SUNNY_P1 0x0001
00337 #define SUNNY_P2 0x0002
00338 #define SUNNY_98 0x0003
00339 #define REVISION 0
00340 #define BASE_CLASS 0xff
00341 #define SUB_CLASS 0x00
00342
00343 #define LOCAL_TO_PCI_OFFSET 0x40000000
00344
00345
00346 #define VENDOR_ID_OFFSET 0x00
00347 #define DEVICE_ID_OFFSET 0x02
00348 #define COMMAND_OFFSET 0x04
00349 #define STATUS_OFFSET 0x06
00350 #define REVISION_OFFSET 0x08
00351 #define PROG_IF_OFFSET 0x09
00352 #define SUB_CLASS_OFFSET 0x0a
00353 #define BASE_CLASS_OFFSET 0x0b
00354 #define CACHE_LINE_OFFSET 0x0c
00355 #define LATENCY_TIMER_OFFSET 0x0d
00356 #define HEADER_TYPE_OFFSET 0x0e
00357 #define BIST_OFFSET 0x0f
00358 #define REGION0_BASE_OFFSET 0x10
00359 #define REGION1_BASE_OFFSET 0x14
00360 #define REGION2_BASE_OFFSET 0x18
00361 #define REGION3_BASE_OFFSET 0x1c
00362 #define REGION4_BASE_OFFSET 0x20
00363 #define REGION5_BASE_OFFSET 0x24
00364 #define EXP_ROM_OFFSET 0x30
00365 #define INT_LINE_OFFSET 0x3c
00366 #define INT_PIN_OFFSET 0x3d
00367 #define MIN_GNT_OFFSET 0x3e
00368 #define MAX_LAT_OFFSET 0x3f
00369
00370 #endif