162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 362306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 462306a36Sopenharmony_ci * for more details. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * mc.h: Definitions for SGI Memory Controller 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * Copyright (C) 1996 David S. Miller 962306a36Sopenharmony_ci * Copyright (C) 1999 Ralf Baechle 1062306a36Sopenharmony_ci * Copyright (C) 1999 Silicon Graphics, Inc. 1162306a36Sopenharmony_ci */ 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#ifndef _SGI_MC_H 1462306a36Sopenharmony_ci#define _SGI_MC_H 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_cistruct sgimc_regs { 1762306a36Sopenharmony_ci u32 _unused0; 1862306a36Sopenharmony_ci volatile u32 cpuctrl0; /* CPU control register 0, readwrite */ 1962306a36Sopenharmony_ci#define SGIMC_CCTRL0_REFS 0x0000000f /* REFS mask */ 2062306a36Sopenharmony_ci#define SGIMC_CCTRL0_EREFRESH 0x00000010 /* Memory refresh enable */ 2162306a36Sopenharmony_ci#define SGIMC_CCTRL0_EPERRGIO 0x00000020 /* GIO parity error enable */ 2262306a36Sopenharmony_ci#define SGIMC_CCTRL0_EPERRMEM 0x00000040 /* Main mem parity error enable */ 2362306a36Sopenharmony_ci#define SGIMC_CCTRL0_EPERRCPU 0x00000080 /* CPU bus parity error enable */ 2462306a36Sopenharmony_ci#define SGIMC_CCTRL0_WDOG 0x00000100 /* Watchdog timer enable */ 2562306a36Sopenharmony_ci#define SGIMC_CCTRL0_SYSINIT 0x00000200 /* System init bit */ 2662306a36Sopenharmony_ci#define SGIMC_CCTRL0_GFXRESET 0x00000400 /* Graphics interface reset */ 2762306a36Sopenharmony_ci#define SGIMC_CCTRL0_EISALOCK 0x00000800 /* Lock CPU from memory for EISA */ 2862306a36Sopenharmony_ci#define SGIMC_CCTRL0_EPERRSCMD 0x00001000 /* SysCMD bus parity error enable */ 2962306a36Sopenharmony_ci#define SGIMC_CCTRL0_IENAB 0x00002000 /* Allow interrupts from MC */ 3062306a36Sopenharmony_ci#define SGIMC_CCTRL0_ESNOOP 0x00004000 /* Snooping I/O enable */ 3162306a36Sopenharmony_ci#define SGIMC_CCTRL0_EPROMWR 0x00008000 /* Prom writes from cpu enable */ 3262306a36Sopenharmony_ci#define SGIMC_CCTRL0_WRESETPMEM 0x00010000 /* Perform warm reset, preserves mem */ 3362306a36Sopenharmony_ci#define SGIMC_CCTRL0_LENDIAN 0x00020000 /* Put MC in little-endian mode */ 3462306a36Sopenharmony_ci#define SGIMC_CCTRL0_WRESETDMEM 0x00040000 /* Warm reset, destroys mem contents */ 3562306a36Sopenharmony_ci#define SGIMC_CCTRL0_CMEMBADPAR 0x02000000 /* Generate bad perr from cpu to mem */ 3662306a36Sopenharmony_ci#define SGIMC_CCTRL0_R4KNOCHKPARR 0x04000000 /* Don't chk parity on mem data reads */ 3762306a36Sopenharmony_ci#define SGIMC_CCTRL0_GIOBTOB 0x08000000 /* Allow GIO back to back writes */ 3862306a36Sopenharmony_ci u32 _unused1; 3962306a36Sopenharmony_ci volatile u32 cpuctrl1; /* CPU control register 1, readwrite */ 4062306a36Sopenharmony_ci#define SGIMC_CCTRL1_EGIOTIMEO 0x00000010 /* GIO bus timeout enable */ 4162306a36Sopenharmony_ci#define SGIMC_CCTRL1_FIXEDEHPC 0x00001000 /* Fixed HPC endianness */ 4262306a36Sopenharmony_ci#define SGIMC_CCTRL1_LITTLEHPC 0x00002000 /* Little endian HPC */ 4362306a36Sopenharmony_ci#define SGIMC_CCTRL1_FIXEDEEXP0 0x00004000 /* Fixed EXP0 endianness */ 4462306a36Sopenharmony_ci#define SGIMC_CCTRL1_LITTLEEXP0 0x00008000 /* Little endian EXP0 */ 4562306a36Sopenharmony_ci#define SGIMC_CCTRL1_FIXEDEEXP1 0x00010000 /* Fixed EXP1 endianness */ 4662306a36Sopenharmony_ci#define SGIMC_CCTRL1_LITTLEEXP1 0x00020000 /* Little endian EXP1 */ 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci u32 _unused2; 4962306a36Sopenharmony_ci volatile u32 watchdogt; /* Watchdog reg rdonly, write clears */ 5062306a36Sopenharmony_ci 5162306a36Sopenharmony_ci u32 _unused3; 5262306a36Sopenharmony_ci volatile u32 systemid; /* MC system ID register, readonly */ 5362306a36Sopenharmony_ci#define SGIMC_SYSID_MASKREV 0x0000000f /* Revision of MC controller */ 5462306a36Sopenharmony_ci#define SGIMC_SYSID_EPRESENT 0x00000010 /* Indicates presence of EISA bus */ 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci u32 _unused4[3]; 5762306a36Sopenharmony_ci volatile u32 divider; /* Divider reg for RPSS */ 5862306a36Sopenharmony_ci 5962306a36Sopenharmony_ci u32 _unused5; 6062306a36Sopenharmony_ci u32 eeprom; /* EEPROM byte reg for r4k */ 6162306a36Sopenharmony_ci#define SGIMC_EEPROM_PRE 0x00000001 /* eeprom chip PRE pin assertion */ 6262306a36Sopenharmony_ci#define SGIMC_EEPROM_CSEL 0x00000002 /* Active high, eeprom chip select */ 6362306a36Sopenharmony_ci#define SGIMC_EEPROM_SECLOCK 0x00000004 /* EEPROM serial clock */ 6462306a36Sopenharmony_ci#define SGIMC_EEPROM_SDATAO 0x00000008 /* Serial EEPROM data-out */ 6562306a36Sopenharmony_ci#define SGIMC_EEPROM_SDATAI 0x00000010 /* Serial EEPROM data-in */ 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci u32 _unused6[3]; 6862306a36Sopenharmony_ci volatile u32 rcntpre; /* Preload refresh counter */ 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci u32 _unused7; 7162306a36Sopenharmony_ci volatile u32 rcounter; /* Readonly refresh counter */ 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci u32 _unused8[13]; 7462306a36Sopenharmony_ci volatile u32 giopar; /* Parameter word for GIO64 */ 7562306a36Sopenharmony_ci#define SGIMC_GIOPAR_HPC64 0x00000001 /* HPC talks to GIO using 64-bits */ 7662306a36Sopenharmony_ci#define SGIMC_GIOPAR_GFX64 0x00000002 /* GFX talks to GIO using 64-bits */ 7762306a36Sopenharmony_ci#define SGIMC_GIOPAR_EXP064 0x00000004 /* EXP(slot0) talks using 64-bits */ 7862306a36Sopenharmony_ci#define SGIMC_GIOPAR_EXP164 0x00000008 /* EXP(slot1) talks using 64-bits */ 7962306a36Sopenharmony_ci#define SGIMC_GIOPAR_EISA64 0x00000010 /* EISA bus talks 64-bits to GIO */ 8062306a36Sopenharmony_ci#define SGIMC_GIOPAR_HPC264 0x00000020 /* 2nd HPX talks 64-bits to GIO */ 8162306a36Sopenharmony_ci#define SGIMC_GIOPAR_RTIMEGFX 0x00000040 /* GFX device has realtime attr */ 8262306a36Sopenharmony_ci#define SGIMC_GIOPAR_RTIMEEXP0 0x00000080 /* EXP(slot0) has realtime attr */ 8362306a36Sopenharmony_ci#define SGIMC_GIOPAR_RTIMEEXP1 0x00000100 /* EXP(slot1) has realtime attr */ 8462306a36Sopenharmony_ci#define SGIMC_GIOPAR_MASTEREISA 0x00000200 /* EISA bus can act as bus master */ 8562306a36Sopenharmony_ci#define SGIMC_GIOPAR_ONEBUS 0x00000400 /* Exists one GIO64 pipelined bus */ 8662306a36Sopenharmony_ci#define SGIMC_GIOPAR_MASTERGFX 0x00000800 /* GFX can act as a bus master */ 8762306a36Sopenharmony_ci#define SGIMC_GIOPAR_MASTEREXP0 0x00001000 /* EXP(slot0) can bus master */ 8862306a36Sopenharmony_ci#define SGIMC_GIOPAR_MASTEREXP1 0x00002000 /* EXP(slot1) can bus master */ 8962306a36Sopenharmony_ci#define SGIMC_GIOPAR_PLINEEXP0 0x00004000 /* EXP(slot0) has pipeline attr */ 9062306a36Sopenharmony_ci#define SGIMC_GIOPAR_PLINEEXP1 0x00008000 /* EXP(slot1) has pipeline attr */ 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci u32 _unused9; 9362306a36Sopenharmony_ci volatile u32 cputp; /* CPU bus arb time period */ 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci u32 _unused10[3]; 9662306a36Sopenharmony_ci volatile u32 lbursttp; /* Time period for long bursts */ 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci /* MC chip can drive up to 4 bank 4 SIMMs each. All SIMMs in bank must 9962306a36Sopenharmony_ci * be the same size. The size encoding for supported SIMMs is bellow */ 10062306a36Sopenharmony_ci u32 _unused11[9]; 10162306a36Sopenharmony_ci volatile u32 mconfig0; /* Memory config register zero */ 10262306a36Sopenharmony_ci u32 _unused12; 10362306a36Sopenharmony_ci volatile u32 mconfig1; /* Memory config register one */ 10462306a36Sopenharmony_ci#define SGIMC_MCONFIG_BASEADDR 0x000000ff /* Base address of bank*/ 10562306a36Sopenharmony_ci#define SGIMC_MCONFIG_RMASK 0x00001f00 /* Ram config bitmask */ 10662306a36Sopenharmony_ci#define SGIMC_MCONFIG_BVALID 0x00002000 /* Bank is valid */ 10762306a36Sopenharmony_ci#define SGIMC_MCONFIG_SBANKS 0x00004000 /* Number of subbanks */ 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci u32 _unused13; 11062306a36Sopenharmony_ci volatile u32 cmacc; /* Mem access config for CPU */ 11162306a36Sopenharmony_ci u32 _unused14; 11262306a36Sopenharmony_ci volatile u32 gmacc; /* Mem access config for GIO */ 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci /* This define applies to both cmacc and gmacc registers above. */ 11562306a36Sopenharmony_ci#define SGIMC_MACC_ALIASBIG 0x20000000 /* 512MB home for alias */ 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci /* Error address/status regs from GIO and CPU perspectives. */ 11862306a36Sopenharmony_ci u32 _unused15; 11962306a36Sopenharmony_ci volatile u32 cerr; /* Error address reg for CPU */ 12062306a36Sopenharmony_ci u32 _unused16; 12162306a36Sopenharmony_ci volatile u32 cstat; /* Status reg for CPU */ 12262306a36Sopenharmony_ci#define SGIMC_CSTAT_RD 0x00000100 /* read parity error */ 12362306a36Sopenharmony_ci#define SGIMC_CSTAT_PAR 0x00000200 /* CPU parity error */ 12462306a36Sopenharmony_ci#define SGIMC_CSTAT_ADDR 0x00000400 /* memory bus error bad addr */ 12562306a36Sopenharmony_ci#define SGIMC_CSTAT_SYSAD_PAR 0x00000800 /* sysad parity error */ 12662306a36Sopenharmony_ci#define SGIMC_CSTAT_SYSCMD_PAR 0x00001000 /* syscmd parity error */ 12762306a36Sopenharmony_ci#define SGIMC_CSTAT_BAD_DATA 0x00002000 /* bad data identifier */ 12862306a36Sopenharmony_ci#define SGIMC_CSTAT_PAR_MASK 0x00001f00 /* parity error mask */ 12962306a36Sopenharmony_ci#define SGIMC_CSTAT_RD_PAR (SGIMC_CSTAT_RD | SGIMC_CSTAT_PAR) 13062306a36Sopenharmony_ci 13162306a36Sopenharmony_ci u32 _unused17; 13262306a36Sopenharmony_ci volatile u32 gerr; /* Error address reg for GIO */ 13362306a36Sopenharmony_ci u32 _unused18; 13462306a36Sopenharmony_ci volatile u32 gstat; /* Status reg for GIO */ 13562306a36Sopenharmony_ci#define SGIMC_GSTAT_RD 0x00000100 /* read parity error */ 13662306a36Sopenharmony_ci#define SGIMC_GSTAT_WR 0x00000200 /* write parity error */ 13762306a36Sopenharmony_ci#define SGIMC_GSTAT_TIME 0x00000400 /* GIO bus timed out */ 13862306a36Sopenharmony_ci#define SGIMC_GSTAT_PROM 0x00000800 /* write to PROM when PROM_EN not set */ 13962306a36Sopenharmony_ci#define SGIMC_GSTAT_ADDR 0x00001000 /* parity error on addr cycle */ 14062306a36Sopenharmony_ci#define SGIMC_GSTAT_BC 0x00002000 /* parity error on byte count cycle */ 14162306a36Sopenharmony_ci#define SGIMC_GSTAT_PIO_RD 0x00004000 /* read data parity on pio */ 14262306a36Sopenharmony_ci#define SGIMC_GSTAT_PIO_WR 0x00008000 /* write data parity on pio */ 14362306a36Sopenharmony_ci 14462306a36Sopenharmony_ci /* Special hard bus locking registers. */ 14562306a36Sopenharmony_ci u32 _unused19; 14662306a36Sopenharmony_ci volatile u32 syssembit; /* Uni-bit system semaphore */ 14762306a36Sopenharmony_ci u32 _unused20; 14862306a36Sopenharmony_ci volatile u32 mlock; /* Global GIO memory access lock */ 14962306a36Sopenharmony_ci u32 _unused21; 15062306a36Sopenharmony_ci volatile u32 elock; /* Locks EISA from GIO accesses */ 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci /* GIO dma control registers. */ 15362306a36Sopenharmony_ci u32 _unused22[15]; 15462306a36Sopenharmony_ci volatile u32 gio_dma_trans; /* DMA mask to translation GIO addrs */ 15562306a36Sopenharmony_ci u32 _unused23; 15662306a36Sopenharmony_ci volatile u32 gio_dma_sbits; /* DMA GIO addr substitution bits */ 15762306a36Sopenharmony_ci u32 _unused24; 15862306a36Sopenharmony_ci volatile u32 dma_intr_cause; /* DMA IRQ cause indicator bits */ 15962306a36Sopenharmony_ci u32 _unused25; 16062306a36Sopenharmony_ci volatile u32 dma_ctrl; /* Main DMA control reg */ 16162306a36Sopenharmony_ci 16262306a36Sopenharmony_ci /* DMA TLB entry 0 */ 16362306a36Sopenharmony_ci u32 _unused26[5]; 16462306a36Sopenharmony_ci volatile u32 dtlb_hi0; 16562306a36Sopenharmony_ci u32 _unused27; 16662306a36Sopenharmony_ci volatile u32 dtlb_lo0; 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci /* DMA TLB entry 1 */ 16962306a36Sopenharmony_ci u32 _unused28; 17062306a36Sopenharmony_ci volatile u32 dtlb_hi1; 17162306a36Sopenharmony_ci u32 _unused29; 17262306a36Sopenharmony_ci volatile u32 dtlb_lo1; 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci /* DMA TLB entry 2 */ 17562306a36Sopenharmony_ci u32 _unused30; 17662306a36Sopenharmony_ci volatile u32 dtlb_hi2; 17762306a36Sopenharmony_ci u32 _unused31; 17862306a36Sopenharmony_ci volatile u32 dtlb_lo2; 17962306a36Sopenharmony_ci 18062306a36Sopenharmony_ci /* DMA TLB entry 3 */ 18162306a36Sopenharmony_ci u32 _unused32; 18262306a36Sopenharmony_ci volatile u32 dtlb_hi3; 18362306a36Sopenharmony_ci u32 _unused33; 18462306a36Sopenharmony_ci volatile u32 dtlb_lo3; 18562306a36Sopenharmony_ci 18662306a36Sopenharmony_ci u32 _unused34[0x0392]; 18762306a36Sopenharmony_ci 18862306a36Sopenharmony_ci u32 _unused35; 18962306a36Sopenharmony_ci volatile u32 rpsscounter; /* Chirps at 100ns */ 19062306a36Sopenharmony_ci 19162306a36Sopenharmony_ci u32 _unused36[0x1000/4-2*4]; 19262306a36Sopenharmony_ci 19362306a36Sopenharmony_ci u32 _unused37; 19462306a36Sopenharmony_ci volatile u32 maddronly; /* Address DMA goes at */ 19562306a36Sopenharmony_ci u32 _unused38; 19662306a36Sopenharmony_ci volatile u32 maddrpdeflts; /* Same as above, plus set defaults */ 19762306a36Sopenharmony_ci u32 _unused39; 19862306a36Sopenharmony_ci volatile u32 dmasz; /* DMA count */ 19962306a36Sopenharmony_ci u32 _unused40; 20062306a36Sopenharmony_ci volatile u32 ssize; /* DMA stride size */ 20162306a36Sopenharmony_ci u32 _unused41; 20262306a36Sopenharmony_ci volatile u32 gmaddronly; /* Set GIO DMA but don't start trans */ 20362306a36Sopenharmony_ci u32 _unused42; 20462306a36Sopenharmony_ci volatile u32 dmaddnpgo; /* Set GIO DMA addr + start transfer */ 20562306a36Sopenharmony_ci u32 _unused43; 20662306a36Sopenharmony_ci volatile u32 dmamode; /* DMA mode config bit settings */ 20762306a36Sopenharmony_ci u32 _unused44; 20862306a36Sopenharmony_ci volatile u32 dmaccount; /* Zoom and byte count for DMA */ 20962306a36Sopenharmony_ci u32 _unused45; 21062306a36Sopenharmony_ci volatile u32 dmastart; /* Pedal to the metal. */ 21162306a36Sopenharmony_ci u32 _unused46; 21262306a36Sopenharmony_ci volatile u32 dmarunning; /* DMA op is in progress */ 21362306a36Sopenharmony_ci u32 _unused47; 21462306a36Sopenharmony_ci volatile u32 maddrdefstart; /* Set dma addr, defaults, and kick it */ 21562306a36Sopenharmony_ci}; 21662306a36Sopenharmony_ci 21762306a36Sopenharmony_ciextern struct sgimc_regs *sgimc; 21862306a36Sopenharmony_ci#define SGIMC_BASE 0x1fa00000 /* physical */ 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_ci/* Base location of the two ram banks found in IP2[0268] machines. */ 22162306a36Sopenharmony_ci#define SGIMC_SEG0_BADDR 0x08000000 22262306a36Sopenharmony_ci#define SGIMC_SEG1_BADDR 0x20000000 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci/* Maximum size of the above banks are per machine. */ 22562306a36Sopenharmony_ci#define SGIMC_SEG0_SIZE_ALL 0x10000000 /* 256MB */ 22662306a36Sopenharmony_ci#define SGIMC_SEG1_SIZE_IP20_IP22 0x08000000 /* 128MB */ 22762306a36Sopenharmony_ci#define SGIMC_SEG1_SIZE_IP26_IP28 0x20000000 /* 512MB */ 22862306a36Sopenharmony_ci 22962306a36Sopenharmony_ciextern void sgimc_init(void); 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci#endif /* _SGI_MC_H */ 232