]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/postcode.h
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
31 #ifndef _I386_POSTCODE_H_
32 #define _I386_POSTCODE_H_
38 /* Define this to delay about 1 sec after posting each code */
39 /* #define POSTCODE_DELAY 1 */
41 /* The POSTCODE is port 0x80 */
44 #define SPINCOUNT 300000000
45 #define CPU_PAUSE() rep; nop
49 * Macro to output byte value to postcode, destoying register al.
50 * Additionally, if POSTCODE_DELAY, spin for about a second.
55 outb %al,$(POSTPORT); \
56 movl $(SPINCOUNT), %eax; \
64 #endif /* POSTCODE_DELAY */
66 #define POSTCODE(XX) \
70 /* Output byte value to postcode, without destoying register eax */
71 #define POSTCODE_SAVE_EAX(XX) \
77 * Display a 32-bit value to the post card - low byte to high byte
78 * Entry: value in %ebx
79 * Exit: %ebx preserved; %eax destroyed
81 #define POSTCODE32_EBX \
101 #define POSTCODE32_EBX
105 * The following postcodes are defined for stages of early startup:
108 #define _PSTART_ENTRY 0xFF
109 #define _PSTART_RELOC 0xFE
110 #define PSTART_ENTRY 0xFD
111 #define PSTART_PAGE_TABLES 0xFC
112 #define PSTART_BEFORE_PAGING 0xFB
113 #define VSTART_ENTRY 0xFA
114 #define VSTART_STACK_SWITCH 0xF9
115 #define VSTART_EXIT 0xF8
116 #define I386_INIT_ENTRY 0xF7
117 #define CPU_INIT_D 0xF6
118 #define PE_INIT_PLATFORM_D 0xF5
120 #define SLAVE_RSTART_ENTRY 0xEF
121 #define SLAVE_REAL_TO_PROT_ENTRY 0xEE
122 #define SLAVE_REAL_TO_PROT_EXIT 0xED
123 #define SLAVE_STARTPROG_ENTRY 0xEC
124 #define SLAVE_STARTPROG_EXIT 0xEB
125 #define SLAVE_PSTART_ENTRY 0xEA
126 #define SLAVE_PSTART_EXIT 0xE9
127 #define SLAVE_VSTART_ENTRY 0xE8
128 #define SLAVE_VSTART_DESC_INIT 0xE7
129 #define SLAVE_VSTART_STACK_SWITCH 0xE6
130 #define SLAVE_VSTART_EXIT 0xE5
131 #define I386_INIT_SLAVE 0xE4
133 #define PANIC_DOUBLE_FAULT 0xDF /* Double Fault exception */
134 #define PANIC_MACHINE_CHECK 0xDE /* Machine-Check */
135 #define MP_KDP_ENTER 0xDB /* Machine in kdp DeBugger */
136 #define PANIC_HLT 0xD1 /* Die an early death */
137 #define NO_64BIT 0x64 /* No 64-bit support yet */
139 #define ACPI_WAKE_START_ENTRY 0xCF
140 #define ACPI_WAKE_PROT_ENTRY 0xCE
141 #define ACPI_WAKE_PAGED_ENTRY 0xCD
143 #define CPU_IA32_ENABLE_ENTRY 0xBF
144 #define CPU_IA32_ENABLE_EXIT 0xBE
145 #define ML_LOAD_DESC64_ENTRY 0xBD
146 #define ML_LOAD_DESC64_GDT 0xBC
147 #define ML_LOAD_DESC64_IDT 0xBB
148 #define ML_LOAD_DESC64_LDT 0xBA
149 #define ML_LOAD_DESC64_EXIT 0xB9
150 #define CPU_IA32_DISABLE_ENTRY 0xB8
151 #define CPU_IA32_DISABLE_EXIT 0xB7
155 _postcode_delay(uint32_t spincount
)
157 asm volatile("1: \n\t"
161 : : "a" (spincount
));
164 _postcode(uint8_t xx
)
166 asm volatile("outb %0, %1" : : "a" (xx
), "N" (POSTPORT
));
174 _postcode_delay(SPINCOUNT
);
182 #endif /* _I386_POSTCODE_H_ */