1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Adapted from coreboot src/arch/x86/include/arch/smp/mpspec.h
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+
7*4882a593Smuzhiyun */
8*4882a593Smuzhiyun
9*4882a593Smuzhiyun #ifndef __ASM_MPSPEC_H
10*4882a593Smuzhiyun #define __ASM_MPSPEC_H
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun /*
13*4882a593Smuzhiyun * Structure definitions for SMP machines following the
14*4882a593Smuzhiyun * Intel MultiProcessor Specification 1.4
15*4882a593Smuzhiyun */
16*4882a593Smuzhiyun
17*4882a593Smuzhiyun #define MPSPEC_V14 4
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun #define MPF_SIGNATURE "_MP_"
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun struct mp_floating_table {
22*4882a593Smuzhiyun char mpf_signature[4]; /* "_MP_" */
23*4882a593Smuzhiyun u32 mpf_physptr; /* Configuration table address */
24*4882a593Smuzhiyun u8 mpf_length; /* Our length (paragraphs) */
25*4882a593Smuzhiyun u8 mpf_spec; /* Specification version */
26*4882a593Smuzhiyun u8 mpf_checksum; /* Checksum (makes sum 0) */
27*4882a593Smuzhiyun u8 mpf_feature1; /* Predefined or Unique configuration? */
28*4882a593Smuzhiyun u8 mpf_feature2; /* Bit7 set for IMCR/PIC */
29*4882a593Smuzhiyun u8 mpf_feature3; /* Unused (0) */
30*4882a593Smuzhiyun u8 mpf_feature4; /* Unused (0) */
31*4882a593Smuzhiyun u8 mpf_feature5; /* Unused (0) */
32*4882a593Smuzhiyun };
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun #define MPC_SIGNATURE "PCMP"
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun struct mp_config_table {
37*4882a593Smuzhiyun char mpc_signature[4]; /* "PCMP" */
38*4882a593Smuzhiyun u16 mpc_length; /* Size of table */
39*4882a593Smuzhiyun u8 mpc_spec; /* Specification version */
40*4882a593Smuzhiyun u8 mpc_checksum; /* Checksum (makes sum 0) */
41*4882a593Smuzhiyun char mpc_oem[8]; /* OEM ID */
42*4882a593Smuzhiyun char mpc_product[12]; /* Product ID */
43*4882a593Smuzhiyun u32 mpc_oemptr; /* OEM table address */
44*4882a593Smuzhiyun u16 mpc_oemsize; /* OEM table size */
45*4882a593Smuzhiyun u16 mpc_entry_count; /* Number of entries in the table */
46*4882a593Smuzhiyun u32 mpc_lapic; /* Local APIC address */
47*4882a593Smuzhiyun u16 mpe_length; /* Extended table size */
48*4882a593Smuzhiyun u8 mpe_checksum; /* Extended table checksum */
49*4882a593Smuzhiyun u8 reserved;
50*4882a593Smuzhiyun };
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun /* Base MP configuration table entry types */
53*4882a593Smuzhiyun
54*4882a593Smuzhiyun enum mp_base_config_entry_type {
55*4882a593Smuzhiyun MP_PROCESSOR,
56*4882a593Smuzhiyun MP_BUS,
57*4882a593Smuzhiyun MP_IOAPIC,
58*4882a593Smuzhiyun MP_INTSRC,
59*4882a593Smuzhiyun MP_LINTSRC
60*4882a593Smuzhiyun };
61*4882a593Smuzhiyun
62*4882a593Smuzhiyun #define MPC_CPU_EN (1 << 0)
63*4882a593Smuzhiyun #define MPC_CPU_BP (1 << 1)
64*4882a593Smuzhiyun
65*4882a593Smuzhiyun struct mpc_config_processor {
66*4882a593Smuzhiyun u8 mpc_type;
67*4882a593Smuzhiyun u8 mpc_apicid;
68*4882a593Smuzhiyun u8 mpc_apicver;
69*4882a593Smuzhiyun u8 mpc_cpuflag;
70*4882a593Smuzhiyun u32 mpc_cpusignature;
71*4882a593Smuzhiyun u32 mpc_cpufeature;
72*4882a593Smuzhiyun u32 mpc_reserved[2];
73*4882a593Smuzhiyun };
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun #define BUSTYPE_CBUS "CBUS "
76*4882a593Smuzhiyun #define BUSTYPE_CBUSII "CBUSII"
77*4882a593Smuzhiyun #define BUSTYPE_EISA "EISA "
78*4882a593Smuzhiyun #define BUSTYPE_FUTURE "FUTURE"
79*4882a593Smuzhiyun #define BUSTYPE_INTERN "INTERN"
80*4882a593Smuzhiyun #define BUSTYPE_ISA "ISA "
81*4882a593Smuzhiyun #define BUSTYPE_MBI "MBI "
82*4882a593Smuzhiyun #define BUSTYPE_MBII "MBII "
83*4882a593Smuzhiyun #define BUSTYPE_MCA "MCA "
84*4882a593Smuzhiyun #define BUSTYPE_MPI "MPI "
85*4882a593Smuzhiyun #define BUSTYPE_MPSA "MPSA "
86*4882a593Smuzhiyun #define BUSTYPE_NUBUS "NUBUS "
87*4882a593Smuzhiyun #define BUSTYPE_PCI "PCI "
88*4882a593Smuzhiyun #define BUSTYPE_PCMCIA "PCMCIA"
89*4882a593Smuzhiyun #define BUSTYPE_TC "TC "
90*4882a593Smuzhiyun #define BUSTYPE_VL "VL "
91*4882a593Smuzhiyun #define BUSTYPE_VME "VME "
92*4882a593Smuzhiyun #define BUSTYPE_XPRESS "XPRESS"
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun struct mpc_config_bus {
95*4882a593Smuzhiyun u8 mpc_type;
96*4882a593Smuzhiyun u8 mpc_busid;
97*4882a593Smuzhiyun u8 mpc_bustype[6];
98*4882a593Smuzhiyun };
99*4882a593Smuzhiyun
100*4882a593Smuzhiyun #define MPC_APIC_USABLE (1 << 0)
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun struct mpc_config_ioapic {
103*4882a593Smuzhiyun u8 mpc_type;
104*4882a593Smuzhiyun u8 mpc_apicid;
105*4882a593Smuzhiyun u8 mpc_apicver;
106*4882a593Smuzhiyun u8 mpc_flags;
107*4882a593Smuzhiyun u32 mpc_apicaddr;
108*4882a593Smuzhiyun };
109*4882a593Smuzhiyun
110*4882a593Smuzhiyun enum mp_irq_source_types {
111*4882a593Smuzhiyun MP_INT,
112*4882a593Smuzhiyun MP_NMI,
113*4882a593Smuzhiyun MP_SMI,
114*4882a593Smuzhiyun MP_EXTINT
115*4882a593Smuzhiyun };
116*4882a593Smuzhiyun
117*4882a593Smuzhiyun #define MP_IRQ_POLARITY_DEFAULT 0x0
118*4882a593Smuzhiyun #define MP_IRQ_POLARITY_HIGH 0x1
119*4882a593Smuzhiyun #define MP_IRQ_POLARITY_LOW 0x3
120*4882a593Smuzhiyun #define MP_IRQ_POLARITY_MASK 0x3
121*4882a593Smuzhiyun #define MP_IRQ_TRIGGER_DEFAULT 0x0
122*4882a593Smuzhiyun #define MP_IRQ_TRIGGER_EDGE 0x4
123*4882a593Smuzhiyun #define MP_IRQ_TRIGGER_LEVEL 0xc
124*4882a593Smuzhiyun #define MP_IRQ_TRIGGER_MASK 0xc
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun #define MP_APIC_ALL 0xff
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun struct mpc_config_intsrc {
129*4882a593Smuzhiyun u8 mpc_type;
130*4882a593Smuzhiyun u8 mpc_irqtype;
131*4882a593Smuzhiyun u16 mpc_irqflag;
132*4882a593Smuzhiyun u8 mpc_srcbus;
133*4882a593Smuzhiyun u8 mpc_srcbusirq;
134*4882a593Smuzhiyun u8 mpc_dstapic;
135*4882a593Smuzhiyun u8 mpc_dstirq;
136*4882a593Smuzhiyun };
137*4882a593Smuzhiyun
138*4882a593Smuzhiyun struct mpc_config_lintsrc {
139*4882a593Smuzhiyun u8 mpc_type;
140*4882a593Smuzhiyun u8 mpc_irqtype;
141*4882a593Smuzhiyun u16 mpc_irqflag;
142*4882a593Smuzhiyun u8 mpc_srcbusid;
143*4882a593Smuzhiyun u8 mpc_srcbusirq;
144*4882a593Smuzhiyun u8 mpc_destapic;
145*4882a593Smuzhiyun u8 mpc_destlint;
146*4882a593Smuzhiyun };
147*4882a593Smuzhiyun
148*4882a593Smuzhiyun /* Extended MP configuration table entry types */
149*4882a593Smuzhiyun
150*4882a593Smuzhiyun enum mp_ext_config_entry_type {
151*4882a593Smuzhiyun MPE_SYSTEM_ADDRESS_SPACE = 128,
152*4882a593Smuzhiyun MPE_BUS_HIERARCHY,
153*4882a593Smuzhiyun MPE_COMPAT_ADDRESS_SPACE
154*4882a593Smuzhiyun };
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun struct mp_ext_config {
157*4882a593Smuzhiyun u8 mpe_type;
158*4882a593Smuzhiyun u8 mpe_length;
159*4882a593Smuzhiyun };
160*4882a593Smuzhiyun
161*4882a593Smuzhiyun #define ADDRESS_TYPE_IO 0
162*4882a593Smuzhiyun #define ADDRESS_TYPE_MEM 1
163*4882a593Smuzhiyun #define ADDRESS_TYPE_PREFETCH 2
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun struct mp_ext_system_address_space {
166*4882a593Smuzhiyun u8 mpe_type;
167*4882a593Smuzhiyun u8 mpe_length;
168*4882a593Smuzhiyun u8 mpe_busid;
169*4882a593Smuzhiyun u8 mpe_addr_type;
170*4882a593Smuzhiyun u32 mpe_addr_base_low;
171*4882a593Smuzhiyun u32 mpe_addr_base_high;
172*4882a593Smuzhiyun u32 mpe_addr_length_low;
173*4882a593Smuzhiyun u32 mpe_addr_length_high;
174*4882a593Smuzhiyun };
175*4882a593Smuzhiyun
176*4882a593Smuzhiyun #define BUS_SUBTRACTIVE_DECODE (1 << 0)
177*4882a593Smuzhiyun
178*4882a593Smuzhiyun struct mp_ext_bus_hierarchy {
179*4882a593Smuzhiyun u8 mpe_type;
180*4882a593Smuzhiyun u8 mpe_length;
181*4882a593Smuzhiyun u8 mpe_busid;
182*4882a593Smuzhiyun u8 mpe_bus_info;
183*4882a593Smuzhiyun u8 mpe_parent_busid;
184*4882a593Smuzhiyun u8 reserved[3];
185*4882a593Smuzhiyun };
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun #define ADDRESS_RANGE_ADD 0
188*4882a593Smuzhiyun #define ADDRESS_RANGE_SUBTRACT 1
189*4882a593Smuzhiyun
190*4882a593Smuzhiyun /*
191*4882a593Smuzhiyun * X100 - X3FF
192*4882a593Smuzhiyun * X500 - X7FF
193*4882a593Smuzhiyun * X900 - XBFF
194*4882a593Smuzhiyun * XD00 - XFFF
195*4882a593Smuzhiyun */
196*4882a593Smuzhiyun #define RANGE_LIST_IO_ISA 0
197*4882a593Smuzhiyun /*
198*4882a593Smuzhiyun * X3B0 - X3BB
199*4882a593Smuzhiyun * X3C0 - X3DF
200*4882a593Smuzhiyun * X7B0 - X7BB
201*4882a593Smuzhiyun * X7C0 - X7DF
202*4882a593Smuzhiyun * XBB0 - XBBB
203*4882a593Smuzhiyun * XBC0 - XBDF
204*4882a593Smuzhiyun * XFB0 - XFBB
205*4882a593Smuzhiyun * XFC0 - XCDF
206*4882a593Smuzhiyun */
207*4882a593Smuzhiyun #define RANGE_LIST_IO_VGA 1
208*4882a593Smuzhiyun
209*4882a593Smuzhiyun struct mp_ext_compat_address_space {
210*4882a593Smuzhiyun u8 mpe_type;
211*4882a593Smuzhiyun u8 mpe_length;
212*4882a593Smuzhiyun u8 mpe_busid;
213*4882a593Smuzhiyun u8 mpe_addr_modifier;
214*4882a593Smuzhiyun u32 mpe_range_list;
215*4882a593Smuzhiyun };
216*4882a593Smuzhiyun
217*4882a593Smuzhiyun /**
218*4882a593Smuzhiyun * mp_next_mpc_entry() - Compute MP configuration table end to be used as
219*4882a593Smuzhiyun * next base table entry start address
220*4882a593Smuzhiyun *
221*4882a593Smuzhiyun * This computes the end address of current MP configuration table, without
222*4882a593Smuzhiyun * counting any extended configuration table entry.
223*4882a593Smuzhiyun *
224*4882a593Smuzhiyun * @mc: configuration table header address
225*4882a593Smuzhiyun * @return: configuration table end address
226*4882a593Smuzhiyun */
mp_next_mpc_entry(struct mp_config_table * mc)227*4882a593Smuzhiyun static inline ulong mp_next_mpc_entry(struct mp_config_table *mc)
228*4882a593Smuzhiyun {
229*4882a593Smuzhiyun return (ulong)mc + mc->mpc_length;
230*4882a593Smuzhiyun }
231*4882a593Smuzhiyun
232*4882a593Smuzhiyun /**
233*4882a593Smuzhiyun * mp_add_mpc_entry() - Add a base MP configuration table entry
234*4882a593Smuzhiyun *
235*4882a593Smuzhiyun * This adds the base MP configuration table entry size with
236*4882a593Smuzhiyun * added base table entry length and increases entry count by 1.
237*4882a593Smuzhiyun *
238*4882a593Smuzhiyun * @mc: configuration table header address
239*4882a593Smuzhiyun * @length: length of the added table entry
240*4882a593Smuzhiyun */
mp_add_mpc_entry(struct mp_config_table * mc,uint length)241*4882a593Smuzhiyun static inline void mp_add_mpc_entry(struct mp_config_table *mc, uint length)
242*4882a593Smuzhiyun {
243*4882a593Smuzhiyun mc->mpc_length += length;
244*4882a593Smuzhiyun mc->mpc_entry_count++;
245*4882a593Smuzhiyun }
246*4882a593Smuzhiyun
247*4882a593Smuzhiyun /**
248*4882a593Smuzhiyun * mp_next_mpe_entry() - Compute MP configuration table end to be used as
249*4882a593Smuzhiyun * next extended table entry start address
250*4882a593Smuzhiyun *
251*4882a593Smuzhiyun * This computes the end address of current MP configuration table,
252*4882a593Smuzhiyun * including any extended configuration table entry.
253*4882a593Smuzhiyun *
254*4882a593Smuzhiyun * @mc: configuration table header address
255*4882a593Smuzhiyun * @return: configuration table end address
256*4882a593Smuzhiyun */
mp_next_mpe_entry(struct mp_config_table * mc)257*4882a593Smuzhiyun static inline ulong mp_next_mpe_entry(struct mp_config_table *mc)
258*4882a593Smuzhiyun {
259*4882a593Smuzhiyun return (ulong)mc + mc->mpc_length + mc->mpe_length;
260*4882a593Smuzhiyun }
261*4882a593Smuzhiyun
262*4882a593Smuzhiyun /**
263*4882a593Smuzhiyun * mp_add_mpe_entry() - Add an extended MP configuration table entry
264*4882a593Smuzhiyun *
265*4882a593Smuzhiyun * This adds the extended MP configuration table entry size with
266*4882a593Smuzhiyun * added extended table entry length.
267*4882a593Smuzhiyun *
268*4882a593Smuzhiyun * @mc: configuration table header address
269*4882a593Smuzhiyun * @mpe: extended table entry base address
270*4882a593Smuzhiyun */
mp_add_mpe_entry(struct mp_config_table * mc,struct mp_ext_config * mpe)271*4882a593Smuzhiyun static inline void mp_add_mpe_entry(struct mp_config_table *mc,
272*4882a593Smuzhiyun struct mp_ext_config *mpe)
273*4882a593Smuzhiyun {
274*4882a593Smuzhiyun mc->mpe_length += mpe->mpe_length;
275*4882a593Smuzhiyun }
276*4882a593Smuzhiyun
277*4882a593Smuzhiyun /**
278*4882a593Smuzhiyun * mp_write_floating_table() - Write the MP floating table
279*4882a593Smuzhiyun *
280*4882a593Smuzhiyun * This writes the MP floating table, and points MP configuration table
281*4882a593Smuzhiyun * to its end address so that MP configuration table follows immediately
282*4882a593Smuzhiyun * after the floating table.
283*4882a593Smuzhiyun *
284*4882a593Smuzhiyun * @mf: MP floating table base address
285*4882a593Smuzhiyun * @return: MP configuration table header address
286*4882a593Smuzhiyun */
287*4882a593Smuzhiyun struct mp_config_table *mp_write_floating_table(struct mp_floating_table *mf);
288*4882a593Smuzhiyun
289*4882a593Smuzhiyun /**
290*4882a593Smuzhiyun * mp_config_table_init() - Initialize the MP configuration table header
291*4882a593Smuzhiyun *
292*4882a593Smuzhiyun * This populates the MP configuration table header with valid bits.
293*4882a593Smuzhiyun *
294*4882a593Smuzhiyun * @mc: MP configuration table header address
295*4882a593Smuzhiyun */
296*4882a593Smuzhiyun void mp_config_table_init(struct mp_config_table *mc);
297*4882a593Smuzhiyun
298*4882a593Smuzhiyun /**
299*4882a593Smuzhiyun * mp_write_processor() - Write a processor entry
300*4882a593Smuzhiyun *
301*4882a593Smuzhiyun * This writes a processor entry to the configuration table.
302*4882a593Smuzhiyun *
303*4882a593Smuzhiyun * @mc: MP configuration table header address
304*4882a593Smuzhiyun */
305*4882a593Smuzhiyun void mp_write_processor(struct mp_config_table *mc);
306*4882a593Smuzhiyun
307*4882a593Smuzhiyun /**
308*4882a593Smuzhiyun * mp_write_bus() - Write a bus entry
309*4882a593Smuzhiyun *
310*4882a593Smuzhiyun * This writes a bus entry to the configuration table.
311*4882a593Smuzhiyun *
312*4882a593Smuzhiyun * @mc: MP configuration table header address
313*4882a593Smuzhiyun * @id: bus id
314*4882a593Smuzhiyun * @bustype: bus type name
315*4882a593Smuzhiyun */
316*4882a593Smuzhiyun void mp_write_bus(struct mp_config_table *mc, int id, const char *bustype);
317*4882a593Smuzhiyun
318*4882a593Smuzhiyun /**
319*4882a593Smuzhiyun * mp_write_ioapic() - Write an I/O APIC entry
320*4882a593Smuzhiyun *
321*4882a593Smuzhiyun * This writes an I/O APIC entry to the configuration table.
322*4882a593Smuzhiyun *
323*4882a593Smuzhiyun * @mc: MP configuration table header address
324*4882a593Smuzhiyun * @id: I/O APIC id
325*4882a593Smuzhiyun * @ver: I/O APIC version
326*4882a593Smuzhiyun * @apicaddr: I/O APIC address
327*4882a593Smuzhiyun */
328*4882a593Smuzhiyun void mp_write_ioapic(struct mp_config_table *mc, int id, int ver, u32 apicaddr);
329*4882a593Smuzhiyun
330*4882a593Smuzhiyun /**
331*4882a593Smuzhiyun * mp_write_intsrc() - Write an I/O interrupt assignment entry
332*4882a593Smuzhiyun *
333*4882a593Smuzhiyun * This writes an I/O interrupt assignment entry to the configuration table.
334*4882a593Smuzhiyun *
335*4882a593Smuzhiyun * @mc: MP configuration table header address
336*4882a593Smuzhiyun * @irqtype: IRQ type (INT/NMI/SMI/ExtINT)
337*4882a593Smuzhiyun * @irqflag: IRQ flag (level/trigger)
338*4882a593Smuzhiyun * @srcbus: source bus id where the interrupt comes from
339*4882a593Smuzhiyun * @srcbusirq: IRQ number mapped on the source bus
340*4882a593Smuzhiyun * @dstapic: destination I/O APIC id where the interrupt goes to
341*4882a593Smuzhiyun * @dstirq: destination I/O APIC pin where the interrupt goes to
342*4882a593Smuzhiyun */
343*4882a593Smuzhiyun void mp_write_intsrc(struct mp_config_table *mc, int irqtype, int irqflag,
344*4882a593Smuzhiyun int srcbus, int srcbusirq, int dstapic, int dstirq);
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun /**
347*4882a593Smuzhiyun * mp_write_pci_intsrc() - Write a PCI interrupt assignment entry
348*4882a593Smuzhiyun *
349*4882a593Smuzhiyun * This writes a PCI interrupt assignment entry to the configuration table.
350*4882a593Smuzhiyun *
351*4882a593Smuzhiyun * @mc: MP configuration table header address
352*4882a593Smuzhiyun * @irqtype: IRQ type (INT/NMI/SMI/ExtINT)
353*4882a593Smuzhiyun * @srcbus: PCI bus number where the interrupt comes from
354*4882a593Smuzhiyun * @dev: device number on the PCI bus
355*4882a593Smuzhiyun * @pin: PCI interrupt pin (INT A/B/C/D)
356*4882a593Smuzhiyun * @dstapic: destination I/O APIC id where the interrupt goes to
357*4882a593Smuzhiyun * @dstirq: destination I/O APIC pin where the interrupt goes to
358*4882a593Smuzhiyun */
359*4882a593Smuzhiyun void mp_write_pci_intsrc(struct mp_config_table *mc, int irqtype,
360*4882a593Smuzhiyun int srcbus, int dev, int pin, int dstapic, int dstirq);
361*4882a593Smuzhiyun
362*4882a593Smuzhiyun /**
363*4882a593Smuzhiyun * mp_write_lintsrc() - Write a local interrupt assignment entry
364*4882a593Smuzhiyun *
365*4882a593Smuzhiyun * This writes a local interrupt assignment entry to the configuration table.
366*4882a593Smuzhiyun *
367*4882a593Smuzhiyun * @mc: MP configuration table header address
368*4882a593Smuzhiyun * @irqtype: IRQ type (INT/NMI/SMI/ExtINT)
369*4882a593Smuzhiyun * @irqflag: IRQ flag (level/trigger)
370*4882a593Smuzhiyun * @srcbus: PCI bus number where the interrupt comes from
371*4882a593Smuzhiyun * @srcbusirq: IRQ number mapped on the source bus
372*4882a593Smuzhiyun * @dstapic: destination local APIC id where the interrupt goes to
373*4882a593Smuzhiyun * @destlint: destination local APIC pin where the interrupt goes to
374*4882a593Smuzhiyun */
375*4882a593Smuzhiyun void mp_write_lintsrc(struct mp_config_table *mc, int irqtype, int irqflag,
376*4882a593Smuzhiyun int srcbus, int srcbusirq, int destapic, int destlint);
377*4882a593Smuzhiyun
378*4882a593Smuzhiyun
379*4882a593Smuzhiyun /**
380*4882a593Smuzhiyun * mp_write_address_space() - Write a system address space entry
381*4882a593Smuzhiyun *
382*4882a593Smuzhiyun * This writes a system address space entry to the configuration table.
383*4882a593Smuzhiyun *
384*4882a593Smuzhiyun * @mc: MP configuration table header address
385*4882a593Smuzhiyun * @busid: bus id for the bus where system address space is mapped
386*4882a593Smuzhiyun * @addr_type: system address type
387*4882a593Smuzhiyun * @addr_base_low: starting address low
388*4882a593Smuzhiyun * @addr_base_high: starting address high
389*4882a593Smuzhiyun * @addr_length_low: address length low
390*4882a593Smuzhiyun * @addr_length_high: address length high
391*4882a593Smuzhiyun */
392*4882a593Smuzhiyun void mp_write_address_space(struct mp_config_table *mc,
393*4882a593Smuzhiyun int busid, int addr_type,
394*4882a593Smuzhiyun u32 addr_base_low, u32 addr_base_high,
395*4882a593Smuzhiyun u32 addr_length_low, u32 addr_length_high);
396*4882a593Smuzhiyun
397*4882a593Smuzhiyun /**
398*4882a593Smuzhiyun * mp_write_bus_hierarchy() - Write a bus hierarchy descriptor entry
399*4882a593Smuzhiyun *
400*4882a593Smuzhiyun * This writes a bus hierarchy descriptor entry to the configuration table.
401*4882a593Smuzhiyun *
402*4882a593Smuzhiyun * @mc: MP configuration table header address
403*4882a593Smuzhiyun * @busid: bus id
404*4882a593Smuzhiyun * @bus_info: bit0 indicates if the bus is a subtractive decode bus
405*4882a593Smuzhiyun * @parent_busid: parent bus id
406*4882a593Smuzhiyun */
407*4882a593Smuzhiyun void mp_write_bus_hierarchy(struct mp_config_table *mc,
408*4882a593Smuzhiyun int busid, int bus_info, int parent_busid);
409*4882a593Smuzhiyun
410*4882a593Smuzhiyun /**
411*4882a593Smuzhiyun * mp_write_compat_address_space() - Write a compat bus address space entry
412*4882a593Smuzhiyun *
413*4882a593Smuzhiyun * This writes a compatibility bus address space modifier entry to the
414*4882a593Smuzhiyun * configuration table.
415*4882a593Smuzhiyun *
416*4882a593Smuzhiyun * @mc: MP configuration table header address
417*4882a593Smuzhiyun * @busid: bus id
418*4882a593Smuzhiyun * @addr_modifier: add or subtract to predefined address range list
419*4882a593Smuzhiyun * @range_list: list of predefined address space ranges
420*4882a593Smuzhiyun */
421*4882a593Smuzhiyun void mp_write_compat_address_space(struct mp_config_table *mc, int busid,
422*4882a593Smuzhiyun int addr_modifier, u32 range_list);
423*4882a593Smuzhiyun
424*4882a593Smuzhiyun /**
425*4882a593Smuzhiyun * mptable_finalize() - Finalize the MP table
426*4882a593Smuzhiyun *
427*4882a593Smuzhiyun * This finalizes the MP table by calculating required checksums.
428*4882a593Smuzhiyun *
429*4882a593Smuzhiyun * @mc: MP configuration table header address
430*4882a593Smuzhiyun * @return: MP table end address
431*4882a593Smuzhiyun */
432*4882a593Smuzhiyun u32 mptable_finalize(struct mp_config_table *mc);
433*4882a593Smuzhiyun
434*4882a593Smuzhiyun /**
435*4882a593Smuzhiyun * mp_determine_pci_dstirq() - Determine PCI device's int pin on the I/O APIC
436*4882a593Smuzhiyun *
437*4882a593Smuzhiyun * This determines a PCI device's interrupt pin number on the I/O APIC.
438*4882a593Smuzhiyun *
439*4882a593Smuzhiyun * This can be implemented by platform codes to handle specifal cases, which
440*4882a593Smuzhiyun * do not conform to the normal chipset/board design where PIRQ[A-H] are mapped
441*4882a593Smuzhiyun * directly to I/O APIC INTPIN#16-23.
442*4882a593Smuzhiyun *
443*4882a593Smuzhiyun * @bus: bus number of the pci device
444*4882a593Smuzhiyun * @dev: device number of the pci device
445*4882a593Smuzhiyun * @func: function number of the pci device
446*4882a593Smuzhiyun * @pirq: PIRQ number the PCI device's interrupt pin is routed to
447*4882a593Smuzhiyun * @return: interrupt pin number on the I/O APIC
448*4882a593Smuzhiyun */
449*4882a593Smuzhiyun int mp_determine_pci_dstirq(int bus, int dev, int func, int pirq);
450*4882a593Smuzhiyun
451*4882a593Smuzhiyun /**
452*4882a593Smuzhiyun * write_mp_table() - Write MP table
453*4882a593Smuzhiyun *
454*4882a593Smuzhiyun * This writes MP table at a given address.
455*4882a593Smuzhiyun *
456*4882a593Smuzhiyun * @addr: start address to write MP table
457*4882a593Smuzhiyun * @return: end address of MP table
458*4882a593Smuzhiyun */
459*4882a593Smuzhiyun ulong write_mp_table(ulong addr);
460*4882a593Smuzhiyun
461*4882a593Smuzhiyun #endif /* __ASM_MPSPEC_H */
462