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