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