]> git.saurik.com Git - apple/xnu.git/blame - osfmk/ppc/Firmware.h
xnu-517.tar.gz
[apple/xnu.git] / osfmk / ppc / Firmware.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
43866e37 6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
1c79356b 7 *
43866e37
A
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
1c79356b
A
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
43866e37
A
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.
1c79356b
A
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
55e303ae
A
44#include <mach/vm_types.h>
45#include <ppc/Diagnostics.h>
46
1c79356b
A
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
52void dbgDisp(unsigned int port, unsigned int id, unsigned int data);
53void dbgLog(unsigned int d0, unsigned int d1, unsigned int d2, unsigned int d3);
54void dbgLog2(unsigned int type, unsigned int p1, unsigned int p2);
55void dbgDispLL(unsigned int port, unsigned int id, unsigned int data);
56void fwSCCinit(unsigned int port);
55e303ae
A
57void fwEmMck(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); /* Start injecting */
58void fwSCOM(scomcomm *); /* Read/Write SCOM */
59void setPmon(unsigned int, unsigned int); /* Set perf mon stuff */
1c79356b 60
55e303ae 61extern void dbgTrace(unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4);
1c79356b 62#if 0 /* (TEST/DEBUG) - eliminate inline */
55e303ae 63extern __inline__ void dbgTrace(unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4) {
1c79356b
A
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");
55e303ae 68 __asm__ volatile("mr r6,%0" : : "r" (item3) : "r6");
1c79356b
A
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
76extern void DoPreempt(void);
77extern __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
84extern void CreateFakeIO(void);
85extern __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
92extern void CreateFakeDEC(void);
93extern __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
100extern void CreateShutdownCTX(void);
101extern __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
0b4e3aa0
A
108extern void ChokeSys(unsigned int ercd);
109extern __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
1c79356b
A
117typedef struct Boot_Video bootBumbleC;
118
119extern void StoreReal(unsigned int val, unsigned int addr);
55e303ae 120extern void ReadReal(addr64_t raddr, unsigned int *vaddr);
1c79356b
A
121extern void ClearReal(unsigned int addr, unsigned int lgn);
122extern void LoadDBATs(unsigned int *bat);
123extern void LoadIBATs(unsigned int *bat);
124extern void stFloat(unsigned int *addr);
125extern int stVectors(unsigned int *addr);
126extern int stSpecrs(unsigned int *addr);
127extern unsigned int LLTraceSet(unsigned int tflags);
128extern void GratefulDebInit(bootBumbleC *boot_video_info);
129extern void GratefulDebDisp(unsigned int coord, unsigned int data);
130extern void checkNMI(void);
131
55e303ae 132#pragma pack(4) /* Make sure the structure stays as we defined it */
1c79356b
A
133typedef 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;
55e303ae 158#pragma pack()
1c79356b
A
159#define GDfontsize 16
160#define GDdispcols 2
161
162#endif /* _FIRMWARE_H_ */