]>
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_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _I386_POSTCODE_H_
24 #define _I386_POSTCODE_H_
30 /* Define this to delay about 1 sec after posting each code */
31 /* #define POSTCODE_DELAY 1 */
33 /* The POSTCODE is port 0x80 */
36 #define SPINCOUNT 300000000
37 #define CPU_PAUSE() rep; nop
41 * Macro to output byte value to postcode, destoying register al.
42 * Additionally, if POSTCODE_DELAY, spin for about a second.
47 outb %al,$(POSTPORT); \
48 movl $(SPINCOUNT), %eax; \
56 #endif /* POSTCODE_DELAY */
58 #define POSTCODE(XX) \
62 /* Output byte value to postcode, without destoying register eax */
63 #define POSTCODE_SAVE_EAX(XX) \
69 * Display a 32-bit value to the post card - low byte to high byte
70 * Entry: value in %ebx
71 * Exit: %ebx preserved; %eax destroyed
73 #define POSTCODE32_EBX \
93 #define POSTCODE32_EBX
97 * The following postcodes are defined for stages of early startup:
100 #define _PSTART_ENTRY 0xFF
101 #define _PSTART_RELOC 0xFE
102 #define PSTART_ENTRY 0xFD
103 #define PSTART_PAGE_TABLES 0xFC
104 #define PSTART_BEFORE_PAGING 0xFB
105 #define VSTART_ENTRY 0xFA
106 #define VSTART_STACK_SWITCH 0xF9
107 #define VSTART_EXIT 0xF8
108 #define I386_INIT_ENTRY 0xF7
109 #define CPU_INIT_D 0xF6
110 #define PE_INIT_PLATFORM_D 0xF5
112 #define SLAVE_RSTART_ENTRY 0xEF
113 #define SLAVE_REAL_TO_PROT_ENTRY 0xEE
114 #define SLAVE_REAL_TO_PROT_EXIT 0xED
115 #define SLAVE_STARTPROG_ENTRY 0xEC
116 #define SLAVE_STARTPROG_EXIT 0xEB
117 #define SLAVE_PSTART_ENTRY 0xEA
118 #define SLAVE_PSTART_EXIT 0xE9
119 #define SLAVE_VSTART_ENTRY 0xE8
120 #define SLAVE_VSTART_DESC_INIT 0xE7
121 #define SLAVE_VSTART_STACK_SWITCH 0xE6
122 #define SLAVE_VSTART_EXIT 0xE5
123 #define I386_INIT_SLAVE 0xE4
125 #define PANIC_DOUBLE_FAULT 0xDF /* Double Fault exception */
126 #define PANIC_MACHINE_CHECK 0xDE /* Machine-Check */
127 #define MP_KDP_ENTER 0xDB /* Machine in kdp DeBugger */
128 #define PANIC_HLT 0xD1 /* Die an early death */
129 #define NO_64BIT 0x64 /* No 64-bit support yet */
131 #define ACPI_WAKE_START_ENTRY 0xCF
132 #define ACPI_WAKE_PROT_ENTRY 0xCE
133 #define ACPI_WAKE_PAGED_ENTRY 0xCD
135 #define CPU_IA32_ENABLE_ENTRY 0xBF
136 #define CPU_IA32_ENABLE_EXIT 0xBE
137 #define ML_LOAD_DESC64_ENTRY 0xBD
138 #define ML_LOAD_DESC64_GDT 0xBC
139 #define ML_LOAD_DESC64_IDT 0xBB
140 #define ML_LOAD_DESC64_LDT 0xBA
141 #define ML_LOAD_DESC64_EXIT 0xB9
142 #define CPU_IA32_DISABLE_ENTRY 0xB8
143 #define CPU_IA32_DISABLE_EXIT 0xB7
147 _postcode_delay(uint32_t spincount
)
149 asm volatile("1: \n\t"
153 : : "a" (spincount
));
156 _postcode(uint8_t xx
)
158 asm volatile("outb %0, %1" : : "a" (xx
), "N" (POSTPORT
));
166 _postcode_delay(SPINCOUNT
);
174 #endif /* _I386_POSTCODE_H_ */