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