]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/Firmware.h
xnu-792.13.8.tar.gz
[apple/xnu.git] / osfmk / ppc / Firmware.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
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
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
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.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_FREE_COPYRIGHT@
32 */
33 /*
34 * @APPLE_FREE_COPYRIGHT@
35 */
36
37 /*
38 * Here be the firmware's public interfaces
39 * Lovingly crafted by Bill Angell using traditional methods
40 */
41
42 #ifndef _FIRMWARE_H_
43 #define _FIRMWARE_H_
44
45 #ifndef __ppc__
46 #error This file is only useful on PowerPC.
47 #endif
48
49 #include <mach/vm_types.h>
50 #include <ppc/Diagnostics.h>
51
52 /*
53 * This routine is used to write debug output to either the modem or printer port.
54 * parm 1 is printer (0) or modem (1); parm 2 is ID (printed directly); parm 3 converted to hex
55 */
56
57 void dbgDisp(unsigned int port, unsigned int id, unsigned int data);
58 void dbgLog(unsigned int d0, unsigned int d1, unsigned int d2, unsigned int d3);
59 void dbgLog2(unsigned int type, unsigned int p1, unsigned int p2);
60 void dbgDispLL(unsigned int port, unsigned int id, unsigned int data);
61 void fwSCCinit(unsigned int port);
62 void fwEmMck(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); /* Start injecting */
63 void fwSCOM(scomcomm *); /* Read/Write SCOM */
64 void setPmon(unsigned int, unsigned int); /* Set perf mon stuff */
65
66 extern void dbgTrace(unsigned int id, unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4);
67 #if 0 /* (TEST/DEBUG) - eliminate inline */
68 extern __inline__ void dbgTrace(unsigned int id, unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4) {
69
70 __asm__ volatile("mr r2,%0" : : "r" (id) : "r2");
71 __asm__ volatile("mr r3,%0" : : "r" (item1) : "r3");
72 __asm__ volatile("mr r4,%0" : : "r" (item2) : "r4");
73 __asm__ volatile("mr r5,%0" : : "r" (item3) : "r5");
74 __asm__ volatile("mr r6,%0" : : "r" (item3) : "r6");
75 __asm__ volatile("lis r0,hi16(CutTrace)" : : : "r0");
76 __asm__ volatile("ori r0,r0,lo16(CutTrace)" : : : "r0");
77 __asm__ volatile("sc");
78 return;
79 }
80 #endif
81
82 extern void DoPreempt(void);
83 extern __inline__ void DoPreempt(void) {
84 __asm__ volatile("lis r0,hi16(DoPreemptCall)" : : : "r0");
85 __asm__ volatile("ori r0,r0,lo16(DoPreemptCall)" : : : "r0");
86 __asm__ volatile("sc");
87 return;
88 }
89
90 extern void CreateFakeIO(void);
91 extern __inline__ void CreateFakeIO(void) {
92 __asm__ volatile("lis r0,hi16(CreateFakeIOCall)" : : : "r0");
93 __asm__ volatile("ori r0,r0,lo16(CreateFakeIOCall)" : : : "r0");
94 __asm__ volatile("sc");
95 return;
96 }
97
98 extern void CreateFakeDEC(void);
99 extern __inline__ void CreateFakeDEC(void) {
100 __asm__ volatile("lis r0,hi16(CreateFakeDECCall)" : : : "r0");
101 __asm__ volatile("ori r0,r0,lo16(CreateFakeDECCall)" : : : "r0");
102 __asm__ volatile("sc");
103 return;
104 }
105
106 extern void CreateShutdownCTX(void);
107 extern __inline__ void CreateShutdownCTX(void) {
108 __asm__ volatile("lis r0,hi16(CreateShutdownCTXCall)" : : : "r0");
109 __asm__ volatile("ori r0,r0,lo16(CreateShutdownCTXCall)" : : : "r0");
110 __asm__ volatile("sc");
111 return;
112 }
113
114 extern void ChokeSys(unsigned int ercd);
115 extern __inline__ void ChokeSys(unsigned int ercd) {
116 __asm__ volatile("mr r3,%0" : : "r" (ercd) : "r3");
117 __asm__ volatile("lis r0,hi16(Choke)" : : : "r0");
118 __asm__ volatile("ori r0,r0,lo16(Choke)" : : : "r0");
119 __asm__ volatile("sc");
120 return;
121 }
122
123 typedef struct Boot_Video bootBumbleC;
124
125 extern void StoreReal(unsigned int val, unsigned int addr);
126 extern void ReadReal(addr64_t raddr, unsigned int *vaddr);
127 extern void ClearReal(unsigned int addr, unsigned int lgn);
128 extern void LoadDBATs(unsigned int *bat);
129 extern void LoadIBATs(unsigned int *bat);
130 extern void stFloat(unsigned int *addr);
131 extern int stVectors(unsigned int *addr);
132 extern int stSpecrs(unsigned int *addr);
133 extern unsigned int LLTraceSet(unsigned int tflags);
134 extern void GratefulDebInit(bootBumbleC *boot_video_info);
135 extern void GratefulDebDisp(unsigned int coord, unsigned int data);
136 extern void checkNMI(void);
137
138 #pragma pack(4) /* Make sure the structure stays as we defined it */
139 typedef struct GDWorkArea { /* Grateful Deb work area one per processor */
140
141 /* Note that a lot of info is duplicated for each processor */
142
143 unsigned int GDsave[32]; /* Save area for registers */
144
145 unsigned int GDfp0[2];
146 unsigned int GDfp1[2];
147 unsigned int GDfp2[2];
148 unsigned int GDfp3[2];
149
150 unsigned int GDtop; /* Top pixel of CPU's window */
151 unsigned int GDleft; /* Left pixel of CPU's window */
152 unsigned int GDtopleft; /* Physical address of top left in frame buffer */
153 unsigned int GDrowbytes; /* Bytes per row */
154 unsigned int GDrowchar; /* Bytes per row of characters plus leading */
155 unsigned int GDdepth; /* Bits per pixel */
156 unsigned int GDcollgn; /* Column width in bytes */
157 unsigned int GDready; /* We are ready to go */
158 unsigned int GDfiller[16]; /* Fill it up to a 256 byte boundary */
159
160 unsigned int GDrowbuf1[128]; /* Buffer to an 8 character row */
161 unsigned int GDrowbuf2[128]; /* Buffer to an 8 character row */
162
163 } GDWorkArea;
164 #pragma pack()
165 #define GDfontsize 16
166 #define GDdispcols 2
167
168 #endif /* _FIRMWARE_H_ */