]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/postcode.h
9788c35d375e87630cf9182f65737081a00252d0
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 100000000
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.
54 outb %al,$(POSTPORT); \
55 movl $(SPINCOUNT), %eax; \
63 #endif /* POSTCODE_DELAY */
65 #define POSTCODE(XX) \
69 /* Output byte value to postcode, without destoying register eax */
70 #define POSTCODE_SAVE_EAX(XX) \
76 * Display a 32-bit value to the post card - low byte to high byte
77 * Entry: value in %ebx
78 * Exit: %ebx preserved; %eax destroyed
80 #define POSTCODE32_EBX \
100 #define POSTCODE32_EBX
104 * The following postcodes are defined for stages of early startup:
107 #define PSTART_ENTRY 0xFF
108 #define PSTART_PAGE_TABLES 0xFE
109 #define PSTART_BEFORE_PAGING 0xFD
110 #define VSTART_ENTRY 0xFC
111 #define VSTART_STACK_SWITCH 0xFB
112 #define VSTART_EXIT 0xFA
113 #define I386_INIT_ENTRY 0xF9
114 #define CPU_INIT_D 0xF8
115 #define PROCESSOR_BOOTSTRAP_D 0xF7
116 #define PE_INIT_PLATFORM_D 0xF6
117 #define THREAD_BOOTSTRAP_D 0xF5
119 #define SLAVE_PSTART_ENTRY 0xEF
120 #define REAL_TO_PROT_ENTRY 0xEE
121 #define REAL_TO_PROT_EXIT 0xED
122 #define STARTPROG_ENTRY 0xEC
123 #define STARTPROG_EXIT 0xEB
124 #define SLAVE_START_ENTRY 0xEA
125 #define SLAVE_START_EXIT 0xE9
126 #define SVSTART_ENTRY 0xE8
127 #define SVSTART_DESC_INIT 0xE7
128 #define SVSTART_STACK_SWITCH 0xE6
129 #define SVSTART_EXIT 0xE5
130 #define I386_INIT_SLAVE 0xE4
132 #define MP_KDP_ENTER 0xDB /* Machine in kdp DeBugger */
133 #define PANIC_HLT 0xD1 /* Die an early death */
135 #define ACPI_WAKE_START_ENTRY 0xCF
136 #define ACPI_WAKE_PROT_ENTRY 0xCE
137 #define ACPI_WAKE_PAGED_ENTRY 0xCD
141 _postcode_delay(uint32_t spincount
)
143 asm volatile("1: \n\t"
147 : : "a" (spincount
));
150 _postcode(uint8_t xx
)
152 asm volatile("outb %0, %1" : : "a" (xx
), "N" (POSTPORT
));
160 _postcode_delay(SPINCOUNT
);
168 #endif /* _I386_POSTCODE_H_ */