summaryrefslogtreecommitdiff
path: root/usr/src/uts/i86pc/os/acpi_fw.h
blob: 54a34ef5914a85dd95146aa04b40b94bc1dcef9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */
/*
 * Copyright (c) 2010, Intel Corporation.
 * All rights reserved.
 */

#ifndef _ACPI_FW_H
#define	_ACPI_FW_H

#ifdef __cplusplus
extern "C" {
#endif

extern void process_acpi_properties();

#define	ACPI_RSDP_SIG		"RSD PTR "
#define	ACPI_RSDP_SIG_LEN	(8)
#define	ACPI_TABLE_SIG_LEN	(4)
#define	ACPI_EBDA_SEG_ADDR	(0x40e)
#define	ACPI_EBDA_LEN		(1024)

#pragma pack(1)

struct rsdp_v1 {
	char	sig[8];
	uint8_t	checksum;
	char	oem_id[6];
	char	revision;
	uint32_t rsdt;
};

struct rsdp {
	struct rsdp_v1 v1;
	uint32_t len;
	uint64_t xsdt;
	uint8_t  ext_checksum;
	char	reserved[3];
};

struct table_header {
	char	 sig[4];
	uint32_t len;
	uint8_t	 revision;
	uint8_t	 checksum;
	char	 oem_id[6];
	char	 oem_table_id[8];
	uint32_t oem_revision;
	uint32_t creator_id;
	uint32_t creator_revision;
};

struct xsdt {
	struct table_header hdr;
	union {
		uint32_t r[1];
		uint64_t x[1];
	} p;
};


#define	MADT_PROCESSOR	0

struct madt_processor {
	uint8_t	type;
	uint8_t	len;
	uint8_t	acpi_processor_id;
	uint8_t apic_id;
	uint32_t flags;
};

struct madt {
	struct table_header hdr;
	uint32_t lapic_addr;
	uint32_t flags;
	struct madt_processor list[1];
};

struct srat_processor {
	uint8_t	domain1;
	uint8_t	apic_id;
	uint32_t flags;
	uint8_t  local_sapic_eid;
	uint8_t  domain2[3];
	uint8_t  reserved[4];
};

struct srat_x2apic {
	uint8_t reserved[2];
	uint32_t domain;
	uint32_t x2apic_id;
	uint32_t flags;
};

struct srat_memory {
	uint32_t domain;
	uint8_t	 reserved1[2];
	uint64_t base_addr;
	uint64_t len;
	uint8_t  reserved2[4];
	uint32_t flags;
	uint8_t  reserved3[8];
};

struct srat_item {
	uint8_t	type;
	uint8_t len;
	union {
		struct srat_processor p;
		struct srat_memory m;
		struct srat_x2apic xp;
	} i;
};

struct srat {
	struct table_header hdr;
	uint32_t reserved1;
	uint8_t  reserved2[8];
	struct srat_item list[1];
};

#define	SRAT_PROCESSOR	  (0)
#define	SRAT_MEMORY	  (1)
#define	SRAT_X2APIC	  (2)

#define	SRAT_ENABLED	  (1)
#define	SRAT_HOT_PLUG	  (2)
#define	SRAT_NON_VOLATILE (4)

/*
 * Pointer to System Resource Affinity Table (SRAT)
 */
extern struct srat	*srat_ptr;

struct slit {
	struct table_header hdr;
	uint64_t number;
	uint8_t  entry[1];
};

/*
 * Pointer to System Locality Information Table (SLIT)
 */
extern struct slit	*slit_ptr;

struct msct_proximity_domain {
	uint8_t revision;
	uint8_t length;
	uint32_t domain_min;
	uint32_t domain_max;
	uint32_t processor_max;
	uint64_t memory_max;
};

struct msct {
	struct table_header hdr;
	uint32_t proximity_domain_offset;
	uint32_t maximum_proximity_domains;
	uint32_t maximum_power_domains;
	uint64_t maximum_physical_address;
};

/*
 * Pointer to Maximum System Capability Table (MSCT)
 */
extern struct msct	*msct_ptr;

struct cfg_base_addr_alloc {
	uint64_t	base_addr;
	uint16_t	segment;
	uint8_t		start_bno;
	uint8_t		end_bno;
	uint32_t	reserved;
};

struct mcfg {
	char		Signature[4];
	uint32_t	Length;
	uint8_t		Revision;
	uint8_t		Checksum;
	char		OemId[6];
	char		OemTableId[8];
	uint32_t	OemRevision;
	char		CreatorId[4];
	uint32_t	CreatorRevision;
	uint8_t		Reserved[8];
	struct cfg_base_addr_alloc	CfgBaseAddrAllocList[1];
};

struct dmar {
	struct table_header hdr;
	uint8_t width;
	uint8_t flags;
	uint8_t rsvd[10];
};


/*
 * Arbitrary limit on number of localities we handle; if
 * this limit is raised to more than UINT16_MAX, make sure
 * process_slit() knows how to handle it.
 */
#define	SLIT_LOCALITIES_MAX	(4096)

#define	SLIT_NUM_PROPNAME	"acpi-slit-localities"
#define	SLIT_PROPNAME		"acpi-slit"

#pragma pack()

#ifdef __cplusplus
}
#endif

#endif /* _ACPI_FW_H */