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