18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Definitions for the SGI CRIME (CPU, Rendering, Interconnect and Memory
38c2ecf20Sopenharmony_ci * Engine)
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
68c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
78c2ecf20Sopenharmony_ci * for more details.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Copyright (C) 2000 Harald Koerfgen
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef __ASM_CRIME_H__
138c2ecf20Sopenharmony_ci#define __ASM_CRIME_H__
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci/*
168c2ecf20Sopenharmony_ci * Address map
178c2ecf20Sopenharmony_ci */
188c2ecf20Sopenharmony_ci#define CRIME_BASE	0x14000000	/* physical */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistruct sgi_crime {
218c2ecf20Sopenharmony_ci	volatile unsigned long id;
228c2ecf20Sopenharmony_ci#define CRIME_ID_MASK			0xff
238c2ecf20Sopenharmony_ci#define CRIME_ID_IDBITS			0xf0
248c2ecf20Sopenharmony_ci#define CRIME_ID_IDVALUE		0xa0
258c2ecf20Sopenharmony_ci#define CRIME_ID_REV			0x0f
268c2ecf20Sopenharmony_ci#define CRIME_REV_PETTY			0x00
278c2ecf20Sopenharmony_ci#define CRIME_REV_11			0x11
288c2ecf20Sopenharmony_ci#define CRIME_REV_13			0x13
298c2ecf20Sopenharmony_ci#define CRIME_REV_14			0x14
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	volatile unsigned long control;
328c2ecf20Sopenharmony_ci#define CRIME_CONTROL_MASK		0x3fff
338c2ecf20Sopenharmony_ci#define CRIME_CONTROL_TRITON_SYSADC	0x2000
348c2ecf20Sopenharmony_ci#define CRIME_CONTROL_CRIME_SYSADC	0x1000
358c2ecf20Sopenharmony_ci#define CRIME_CONTROL_HARD_RESET	0x0800
368c2ecf20Sopenharmony_ci#define CRIME_CONTROL_SOFT_RESET	0x0400
378c2ecf20Sopenharmony_ci#define CRIME_CONTROL_DOG_ENA		0x0200
388c2ecf20Sopenharmony_ci#define CRIME_CONTROL_ENDIANESS		0x0100
398c2ecf20Sopenharmony_ci#define CRIME_CONTROL_ENDIAN_BIG	0x0100
408c2ecf20Sopenharmony_ci#define CRIME_CONTROL_ENDIAN_LITTLE	0x0000
418c2ecf20Sopenharmony_ci#define CRIME_CONTROL_CQUEUE_HWM	0x000f
428c2ecf20Sopenharmony_ci#define CRIME_CONTROL_CQUEUE_SHFT	0
438c2ecf20Sopenharmony_ci#define CRIME_CONTROL_WBUF_HWM		0x00f0
448c2ecf20Sopenharmony_ci#define CRIME_CONTROL_WBUF_SHFT		8
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci	volatile unsigned long istat;
478c2ecf20Sopenharmony_ci	volatile unsigned long imask;
488c2ecf20Sopenharmony_ci	volatile unsigned long soft_int;
498c2ecf20Sopenharmony_ci	volatile unsigned long hard_int;
508c2ecf20Sopenharmony_ci#define MACE_VID_IN1_INT		BIT(0)
518c2ecf20Sopenharmony_ci#define MACE_VID_IN2_INT		BIT(1)
528c2ecf20Sopenharmony_ci#define MACE_VID_OUT_INT		BIT(2)
538c2ecf20Sopenharmony_ci#define MACE_ETHERNET_INT		BIT(3)
548c2ecf20Sopenharmony_ci#define MACE_SUPERIO_INT		BIT(4)
558c2ecf20Sopenharmony_ci#define MACE_MISC_INT			BIT(5)
568c2ecf20Sopenharmony_ci#define MACE_AUDIO_INT			BIT(6)
578c2ecf20Sopenharmony_ci#define MACE_PCI_BRIDGE_INT		BIT(7)
588c2ecf20Sopenharmony_ci#define MACEPCI_SCSI0_INT		BIT(8)
598c2ecf20Sopenharmony_ci#define MACEPCI_SCSI1_INT		BIT(9)
608c2ecf20Sopenharmony_ci#define MACEPCI_SLOT0_INT		BIT(10)
618c2ecf20Sopenharmony_ci#define MACEPCI_SLOT1_INT		BIT(11)
628c2ecf20Sopenharmony_ci#define MACEPCI_SLOT2_INT		BIT(12)
638c2ecf20Sopenharmony_ci#define MACEPCI_SHARED0_INT		BIT(13)
648c2ecf20Sopenharmony_ci#define MACEPCI_SHARED1_INT		BIT(14)
658c2ecf20Sopenharmony_ci#define MACEPCI_SHARED2_INT		BIT(15)
668c2ecf20Sopenharmony_ci#define CRIME_GBE0_INT			BIT(16)
678c2ecf20Sopenharmony_ci#define CRIME_GBE1_INT			BIT(17)
688c2ecf20Sopenharmony_ci#define CRIME_GBE2_INT			BIT(18)
698c2ecf20Sopenharmony_ci#define CRIME_GBE3_INT			BIT(19)
708c2ecf20Sopenharmony_ci#define CRIME_CPUERR_INT		BIT(20)
718c2ecf20Sopenharmony_ci#define CRIME_MEMERR_INT		BIT(21)
728c2ecf20Sopenharmony_ci#define CRIME_RE_EMPTY_E_INT		BIT(22)
738c2ecf20Sopenharmony_ci#define CRIME_RE_FULL_E_INT		BIT(23)
748c2ecf20Sopenharmony_ci#define CRIME_RE_IDLE_E_INT		BIT(24)
758c2ecf20Sopenharmony_ci#define CRIME_RE_EMPTY_L_INT		BIT(25)
768c2ecf20Sopenharmony_ci#define CRIME_RE_FULL_L_INT		BIT(26)
778c2ecf20Sopenharmony_ci#define CRIME_RE_IDLE_L_INT		BIT(27)
788c2ecf20Sopenharmony_ci#define CRIME_SOFT0_INT			BIT(28)
798c2ecf20Sopenharmony_ci#define CRIME_SOFT1_INT			BIT(29)
808c2ecf20Sopenharmony_ci#define CRIME_SOFT2_INT			BIT(30)
818c2ecf20Sopenharmony_ci#define CRIME_SYSCORERR_INT		CRIME_SOFT2_INT
828c2ecf20Sopenharmony_ci#define CRIME_VICE_INT			BIT(31)
838c2ecf20Sopenharmony_ci/* Masks for deciding who handles the interrupt */
848c2ecf20Sopenharmony_ci#define CRIME_MACE_INT_MASK		0x8f
858c2ecf20Sopenharmony_ci#define CRIME_MACEISA_INT_MASK		0x70
868c2ecf20Sopenharmony_ci#define CRIME_MACEPCI_INT_MASK		0xff00
878c2ecf20Sopenharmony_ci#define CRIME_CRIME_INT_MASK		0xffff0000
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	volatile unsigned long watchdog;
908c2ecf20Sopenharmony_ci#define CRIME_DOG_POWER_ON_RESET	0x00010000
918c2ecf20Sopenharmony_ci#define CRIME_DOG_WARM_RESET		0x00080000
928c2ecf20Sopenharmony_ci#define CRIME_DOG_TIMEOUT		(CRIME_DOG_POWER_ON_RESET|CRIME_DOG_WARM_RESET)
938c2ecf20Sopenharmony_ci#define CRIME_DOG_VALUE			0x00007fff
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci	volatile unsigned long timer;
968c2ecf20Sopenharmony_ci#define CRIME_MASTER_FREQ		66666500	/* Crime upcounter frequency */
978c2ecf20Sopenharmony_ci#define CRIME_NS_PER_TICK		15		/* for delay_calibrate */
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci	volatile unsigned long cpu_error_addr;
1008c2ecf20Sopenharmony_ci#define CRIME_CPU_ERROR_ADDR_MASK	0x3ffffffff
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci	volatile unsigned long cpu_error_stat;
1038c2ecf20Sopenharmony_ci#define CRIME_CPU_ERROR_MASK		0x7		/* cpu error stat is 3 bits */
1048c2ecf20Sopenharmony_ci#define CRIME_CPU_ERROR_CPU_ILL_ADDR	0x4
1058c2ecf20Sopenharmony_ci#define CRIME_CPU_ERROR_VICE_WRT_PRTY	0x2
1068c2ecf20Sopenharmony_ci#define CRIME_CPU_ERROR_CPU_WRT_PRTY	0x1
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci	unsigned long _pad0[54];
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci	volatile unsigned long mc_ctrl;
1118c2ecf20Sopenharmony_ci	volatile unsigned long bank_ctrl[8];
1128c2ecf20Sopenharmony_ci#define CRIME_MEM_BANK_CONTROL_MASK		0x11f	/* 9 bits 7:5 reserved */
1138c2ecf20Sopenharmony_ci#define CRIME_MEM_BANK_CONTROL_ADDR		0x01f
1148c2ecf20Sopenharmony_ci#define CRIME_MEM_BANK_CONTROL_SDRAM_SIZE	0x100
1158c2ecf20Sopenharmony_ci#define CRIME_MAXBANKS				8
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci	volatile unsigned long mem_ref_counter;
1188c2ecf20Sopenharmony_ci#define CRIME_MEM_REF_COUNTER_MASK	0x3ff		/* 10bit */
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci	volatile unsigned long mem_error_stat;
1218c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_STAT_MASK	0x0ff7ffff	/* 28-bit register */
1228c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_MACE_ID		0x0000007f
1238c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_MACE_ACCESS	0x00000080
1248c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_RE_ID		0x00007f00
1258c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_RE_ACCESS	0x00008000
1268c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_GBE_ACCESS	0x00010000
1278c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_VICE_ACCESS	0x00020000
1288c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_CPU_ACCESS	0x00040000
1298c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_RESERVED	0x00080000
1308c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_SOFT_ERR	0x00100000
1318c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_HARD_ERR	0x00200000
1328c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_MULTIPLE	0x00400000
1338c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_ECC		0x01800000
1348c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_MEM_ECC_RD	0x00800000
1358c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_MEM_ECC_RMW	0x01000000
1368c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_INV		0x0e000000
1378c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_INV_MEM_ADDR_RD 0x02000000
1388c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_INV_MEM_ADDR_WR 0x04000000
1398c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_INV_MEM_ADDR_RMW 0x08000000
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	volatile unsigned long mem_error_addr;
1428c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_ADDR_MASK	0x3fffffff
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci	volatile unsigned long mem_ecc_syn;
1458c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_ECC_SYN_MASK	0xffffffff
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci	volatile unsigned long mem_ecc_chk;
1488c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_ECC_CHK_MASK	0xffffffff
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci	volatile unsigned long mem_ecc_repl;
1518c2ecf20Sopenharmony_ci#define CRIME_MEM_ERROR_ECC_REPL_MASK	0xffffffff
1528c2ecf20Sopenharmony_ci};
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ciextern struct sgi_crime __iomem *crime;
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci#define CRIME_HI_MEM_BASE	0x40000000	/* this is where whole 1G of RAM is mapped */
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci#endif /* __ASM_CRIME_H__ */
159