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