]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/Firmware.h
xnu-344.49.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 /*
45 * This routine is used to write debug output to either the modem or printer port.
46 * parm 1 is printer (0) or modem (1); parm 2 is ID (printed directly); parm 3 converted to hex
47 */
48
49 void dbgDisp(unsigned int port, unsigned int id, unsigned int data);
50 void dbgLog(unsigned int d0, unsigned int d1, unsigned int d2, unsigned int d3);
51 void dbgLog2(unsigned int type, unsigned int p1, unsigned int p2);
52 void dbgDispLL(unsigned int port, unsigned int id, unsigned int data);
53 void fwSCCinit(unsigned int port);
54
55 extern void dbgTrace(unsigned int item1, unsigned int item2, unsigned int item3);
56 #if 0 /* (TEST/DEBUG) - eliminate inline */
57 extern __inline__ void dbgTrace(unsigned int item1, unsigned int item2, unsigned int item3) {
58
59 __asm__ volatile("mr r3,%0" : : "r" (item1) : "r3");
60 __asm__ volatile("mr r4,%0" : : "r" (item2) : "r4");
61 __asm__ volatile("mr r5,%0" : : "r" (item3) : "r5");
62 __asm__ volatile("lis r0,hi16(CutTrace)" : : : "r0");
63 __asm__ volatile("ori r0,r0,lo16(CutTrace)" : : : "r0");
64 __asm__ volatile("sc");
65 return;
66 }
67 #endif
68
69 extern void DoPreempt(void);
70 extern __inline__ void DoPreempt(void) {
71 __asm__ volatile("lis r0,hi16(DoPreemptCall)" : : : "r0");
72 __asm__ volatile("ori r0,r0,lo16(DoPreemptCall)" : : : "r0");
73 __asm__ volatile("sc");
74 return;
75 }
76
77 extern void CreateFakeIO(void);
78 extern __inline__ void CreateFakeIO(void) {
79 __asm__ volatile("lis r0,hi16(CreateFakeIOCall)" : : : "r0");
80 __asm__ volatile("ori r0,r0,lo16(CreateFakeIOCall)" : : : "r0");
81 __asm__ volatile("sc");
82 return;
83 }
84
85 extern void CreateFakeDEC(void);
86 extern __inline__ void CreateFakeDEC(void) {
87 __asm__ volatile("lis r0,hi16(CreateFakeDECCall)" : : : "r0");
88 __asm__ volatile("ori r0,r0,lo16(CreateFakeDECCall)" : : : "r0");
89 __asm__ volatile("sc");
90 return;
91 }
92
93 extern void CreateShutdownCTX(void);
94 extern __inline__ void CreateShutdownCTX(void) {
95 __asm__ volatile("lis r0,hi16(CreateShutdownCTXCall)" : : : "r0");
96 __asm__ volatile("ori r0,r0,lo16(CreateShutdownCTXCall)" : : : "r0");
97 __asm__ volatile("sc");
98 return;
99 }
100
101 extern void ChokeSys(unsigned int ercd);
102 extern __inline__ void ChokeSys(unsigned int ercd) {
103 __asm__ volatile("mr r3,%0" : : "r" (ercd) : "r3");
104 __asm__ volatile("lis r0,hi16(Choke)" : : : "r0");
105 __asm__ volatile("ori r0,r0,lo16(Choke)" : : : "r0");
106 __asm__ volatile("sc");
107 return;
108 }
109
110 typedef struct Boot_Video bootBumbleC;
111
112 extern void StoreReal(unsigned int val, unsigned int addr);
113 extern void ReadReal(unsigned int raddr, unsigned int *vaddr);
114 extern void ClearReal(unsigned int addr, unsigned int lgn);
115 extern void LoadDBATs(unsigned int *bat);
116 extern void LoadIBATs(unsigned int *bat);
117 extern void stFloat(unsigned int *addr);
118 extern int stVectors(unsigned int *addr);
119 extern int stSpecrs(unsigned int *addr);
120 extern unsigned int LLTraceSet(unsigned int tflags);
121 extern void GratefulDebInit(bootBumbleC *boot_video_info);
122 extern void GratefulDebDisp(unsigned int coord, unsigned int data);
123 extern void checkNMI(void);
124
125 typedef struct GDWorkArea { /* Grateful Deb work area one per processor */
126
127 /* Note that a lot of info is duplicated for each processor */
128
129 unsigned int GDsave[32]; /* Save area for registers */
130
131 unsigned int GDfp0[2];
132 unsigned int GDfp1[2];
133 unsigned int GDfp2[2];
134 unsigned int GDfp3[2];
135
136 unsigned int GDtop; /* Top pixel of CPU's window */
137 unsigned int GDleft; /* Left pixel of CPU's window */
138 unsigned int GDtopleft; /* Physical address of top left in frame buffer */
139 unsigned int GDrowbytes; /* Bytes per row */
140 unsigned int GDrowchar; /* Bytes per row of characters plus leading */
141 unsigned int GDdepth; /* Bits per pixel */
142 unsigned int GDcollgn; /* Column width in bytes */
143 unsigned int GDready; /* We are ready to go */
144 unsigned int GDfiller[16]; /* Fill it up to a 256 byte boundary */
145
146 unsigned int GDrowbuf1[128]; /* Buffer to an 8 character row */
147 unsigned int GDrowbuf2[128]; /* Buffer to an 8 character row */
148
149 } GDWorkArea;
150 #define GDfontsize 16
151 #define GDdispcols 2
152
153 #endif /* _FIRMWARE_H_ */