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