18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_X86_MPSPEC_DEF_H
38c2ecf20Sopenharmony_ci#define _ASM_X86_MPSPEC_DEF_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci * Structure definitions for SMP machines following the
78c2ecf20Sopenharmony_ci * Intel Multiprocessing Specification 1.1 and 1.4.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * This tag identifies where the SMP configuration
128c2ecf20Sopenharmony_ci * information is.
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define SMP_MAGIC_IDENT	(('_'<<24) | ('P'<<16) | ('M'<<8) | '_')
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32
188c2ecf20Sopenharmony_ci# define MAX_MPC_ENTRY 1024
198c2ecf20Sopenharmony_ci#endif
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Intel MP Floating Pointer Structure */
228c2ecf20Sopenharmony_cistruct mpf_intel {
238c2ecf20Sopenharmony_ci	char signature[4];		/* "_MP_"			*/
248c2ecf20Sopenharmony_ci	unsigned int physptr;		/* Configuration table address	*/
258c2ecf20Sopenharmony_ci	unsigned char length;		/* Our length (paragraphs)	*/
268c2ecf20Sopenharmony_ci	unsigned char specification;	/* Specification version	*/
278c2ecf20Sopenharmony_ci	unsigned char checksum;		/* Checksum (makes sum 0)	*/
288c2ecf20Sopenharmony_ci	unsigned char feature1;		/* Standard or configuration ?	*/
298c2ecf20Sopenharmony_ci	unsigned char feature2;		/* Bit7 set for IMCR|PIC	*/
308c2ecf20Sopenharmony_ci	unsigned char feature3;		/* Unused (0)			*/
318c2ecf20Sopenharmony_ci	unsigned char feature4;		/* Unused (0)			*/
328c2ecf20Sopenharmony_ci	unsigned char feature5;		/* Unused (0)			*/
338c2ecf20Sopenharmony_ci};
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define MPC_SIGNATURE "PCMP"
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_cistruct mpc_table {
388c2ecf20Sopenharmony_ci	char signature[4];
398c2ecf20Sopenharmony_ci	unsigned short length;		/* Size of table */
408c2ecf20Sopenharmony_ci	char spec;			/* 0x01 */
418c2ecf20Sopenharmony_ci	char checksum;
428c2ecf20Sopenharmony_ci	char oem[8];
438c2ecf20Sopenharmony_ci	char productid[12];
448c2ecf20Sopenharmony_ci	unsigned int oemptr;		/* 0 if not present */
458c2ecf20Sopenharmony_ci	unsigned short oemsize;		/* 0 if not present */
468c2ecf20Sopenharmony_ci	unsigned short oemcount;
478c2ecf20Sopenharmony_ci	unsigned int lapic;		/* APIC address */
488c2ecf20Sopenharmony_ci	unsigned int reserved;
498c2ecf20Sopenharmony_ci};
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* Followed by entries */
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#define	MP_PROCESSOR		0
548c2ecf20Sopenharmony_ci#define	MP_BUS			1
558c2ecf20Sopenharmony_ci#define	MP_IOAPIC		2
568c2ecf20Sopenharmony_ci#define	MP_INTSRC		3
578c2ecf20Sopenharmony_ci#define	MP_LINTSRC		4
588c2ecf20Sopenharmony_ci/* Used by IBM NUMA-Q to describe node locality */
598c2ecf20Sopenharmony_ci#define	MP_TRANSLATION		192
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define CPU_ENABLED		1	/* Processor is available */
628c2ecf20Sopenharmony_ci#define CPU_BOOTPROCESSOR	2	/* Processor is the boot CPU */
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define CPU_STEPPING_MASK	0x000F
658c2ecf20Sopenharmony_ci#define CPU_MODEL_MASK		0x00F0
668c2ecf20Sopenharmony_ci#define CPU_FAMILY_MASK		0x0F00
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_cistruct mpc_cpu {
698c2ecf20Sopenharmony_ci	unsigned char type;
708c2ecf20Sopenharmony_ci	unsigned char apicid;		/* Local APIC number */
718c2ecf20Sopenharmony_ci	unsigned char apicver;		/* Its versions */
728c2ecf20Sopenharmony_ci	unsigned char cpuflag;
738c2ecf20Sopenharmony_ci	unsigned int cpufeature;
748c2ecf20Sopenharmony_ci	unsigned int featureflag;	/* CPUID feature value */
758c2ecf20Sopenharmony_ci	unsigned int reserved[2];
768c2ecf20Sopenharmony_ci};
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistruct mpc_bus {
798c2ecf20Sopenharmony_ci	unsigned char type;
808c2ecf20Sopenharmony_ci	unsigned char busid;
818c2ecf20Sopenharmony_ci	unsigned char bustype[6];
828c2ecf20Sopenharmony_ci};
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/* List of Bus Type string values, Intel MP Spec. */
858c2ecf20Sopenharmony_ci#define BUSTYPE_EISA	"EISA"
868c2ecf20Sopenharmony_ci#define BUSTYPE_ISA	"ISA"
878c2ecf20Sopenharmony_ci#define BUSTYPE_INTERN	"INTERN"	/* Internal BUS */
888c2ecf20Sopenharmony_ci#define BUSTYPE_MCA	"MCA"		/* Obsolete */
898c2ecf20Sopenharmony_ci#define BUSTYPE_VL	"VL"		/* Local bus */
908c2ecf20Sopenharmony_ci#define BUSTYPE_PCI	"PCI"
918c2ecf20Sopenharmony_ci#define BUSTYPE_PCMCIA	"PCMCIA"
928c2ecf20Sopenharmony_ci#define BUSTYPE_CBUS	"CBUS"
938c2ecf20Sopenharmony_ci#define BUSTYPE_CBUSII	"CBUSII"
948c2ecf20Sopenharmony_ci#define BUSTYPE_FUTURE	"FUTURE"
958c2ecf20Sopenharmony_ci#define BUSTYPE_MBI	"MBI"
968c2ecf20Sopenharmony_ci#define BUSTYPE_MBII	"MBII"
978c2ecf20Sopenharmony_ci#define BUSTYPE_MPI	"MPI"
988c2ecf20Sopenharmony_ci#define BUSTYPE_MPSA	"MPSA"
998c2ecf20Sopenharmony_ci#define BUSTYPE_NUBUS	"NUBUS"
1008c2ecf20Sopenharmony_ci#define BUSTYPE_TC	"TC"
1018c2ecf20Sopenharmony_ci#define BUSTYPE_VME	"VME"
1028c2ecf20Sopenharmony_ci#define BUSTYPE_XPRESS	"XPRESS"
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci#define MPC_APIC_USABLE		0x01
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_cistruct mpc_ioapic {
1078c2ecf20Sopenharmony_ci	unsigned char type;
1088c2ecf20Sopenharmony_ci	unsigned char apicid;
1098c2ecf20Sopenharmony_ci	unsigned char apicver;
1108c2ecf20Sopenharmony_ci	unsigned char flags;
1118c2ecf20Sopenharmony_ci	unsigned int apicaddr;
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_cistruct mpc_intsrc {
1158c2ecf20Sopenharmony_ci	unsigned char type;
1168c2ecf20Sopenharmony_ci	unsigned char irqtype;
1178c2ecf20Sopenharmony_ci	unsigned short irqflag;
1188c2ecf20Sopenharmony_ci	unsigned char srcbus;
1198c2ecf20Sopenharmony_ci	unsigned char srcbusirq;
1208c2ecf20Sopenharmony_ci	unsigned char dstapic;
1218c2ecf20Sopenharmony_ci	unsigned char dstirq;
1228c2ecf20Sopenharmony_ci};
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_cienum mp_irq_source_types {
1258c2ecf20Sopenharmony_ci	mp_INT = 0,
1268c2ecf20Sopenharmony_ci	mp_NMI = 1,
1278c2ecf20Sopenharmony_ci	mp_SMI = 2,
1288c2ecf20Sopenharmony_ci	mp_ExtINT = 3
1298c2ecf20Sopenharmony_ci};
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci#define MP_IRQPOL_DEFAULT	0x0
1328c2ecf20Sopenharmony_ci#define MP_IRQPOL_ACTIVE_HIGH	0x1
1338c2ecf20Sopenharmony_ci#define MP_IRQPOL_RESERVED	0x2
1348c2ecf20Sopenharmony_ci#define MP_IRQPOL_ACTIVE_LOW	0x3
1358c2ecf20Sopenharmony_ci#define MP_IRQPOL_MASK		0x3
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci#define MP_IRQTRIG_DEFAULT	0x0
1388c2ecf20Sopenharmony_ci#define MP_IRQTRIG_EDGE		0x4
1398c2ecf20Sopenharmony_ci#define MP_IRQTRIG_RESERVED	0x8
1408c2ecf20Sopenharmony_ci#define MP_IRQTRIG_LEVEL	0xc
1418c2ecf20Sopenharmony_ci#define MP_IRQTRIG_MASK		0xc
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci#define MP_APIC_ALL	0xFF
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_cistruct mpc_lintsrc {
1468c2ecf20Sopenharmony_ci	unsigned char type;
1478c2ecf20Sopenharmony_ci	unsigned char irqtype;
1488c2ecf20Sopenharmony_ci	unsigned short irqflag;
1498c2ecf20Sopenharmony_ci	unsigned char srcbusid;
1508c2ecf20Sopenharmony_ci	unsigned char srcbusirq;
1518c2ecf20Sopenharmony_ci	unsigned char destapic;
1528c2ecf20Sopenharmony_ci	unsigned char destapiclint;
1538c2ecf20Sopenharmony_ci};
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#define MPC_OEM_SIGNATURE "_OEM"
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_cistruct mpc_oemtable {
1588c2ecf20Sopenharmony_ci	char signature[4];
1598c2ecf20Sopenharmony_ci	unsigned short length;		/* Size of table */
1608c2ecf20Sopenharmony_ci	char  rev;			/* 0x01 */
1618c2ecf20Sopenharmony_ci	char  checksum;
1628c2ecf20Sopenharmony_ci	char  mpc[8];
1638c2ecf20Sopenharmony_ci};
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/*
1668c2ecf20Sopenharmony_ci *	Default configurations
1678c2ecf20Sopenharmony_ci *
1688c2ecf20Sopenharmony_ci *	1	2 CPU ISA 82489DX
1698c2ecf20Sopenharmony_ci *	2	2 CPU EISA 82489DX neither IRQ 0 timer nor IRQ 13 DMA chaining
1708c2ecf20Sopenharmony_ci *	3	2 CPU EISA 82489DX
1718c2ecf20Sopenharmony_ci *	4	2 CPU MCA 82489DX
1728c2ecf20Sopenharmony_ci *	5	2 CPU ISA+PCI
1738c2ecf20Sopenharmony_ci *	6	2 CPU EISA+PCI
1748c2ecf20Sopenharmony_ci *	7	2 CPU MCA+PCI
1758c2ecf20Sopenharmony_ci */
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_cienum mp_bustype {
1788c2ecf20Sopenharmony_ci	MP_BUS_ISA = 1,
1798c2ecf20Sopenharmony_ci	MP_BUS_EISA,
1808c2ecf20Sopenharmony_ci	MP_BUS_PCI,
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci#endif /* _ASM_X86_MPSPEC_DEF_H */
183