]> git.saurik.com Git - apple/xnu.git/blame - osfmk/ppc/Firmware.h
xnu-792.6.61.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 *
37839358
A
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.
1c79356b 11 *
37839358
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
37839358
A
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.
1c79356b
A
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
55e303ae
A
41#include <mach/vm_types.h>
42#include <ppc/Diagnostics.h>
43
1c79356b
A
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
49void dbgDisp(unsigned int port, unsigned int id, unsigned int data);
50void dbgLog(unsigned int d0, unsigned int d1, unsigned int d2, unsigned int d3);
51void dbgLog2(unsigned int type, unsigned int p1, unsigned int p2);
52void dbgDispLL(unsigned int port, unsigned int id, unsigned int data);
53void fwSCCinit(unsigned int port);
55e303ae
A
54void fwEmMck(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); /* Start injecting */
55void fwSCOM(scomcomm *); /* Read/Write SCOM */
56void setPmon(unsigned int, unsigned int); /* Set perf mon stuff */
1c79356b 57
b36670ce 58extern void dbgTrace(unsigned int id, unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4);
1c79356b 59#if 0 /* (TEST/DEBUG) - eliminate inline */
b36670ce 60extern __inline__ void dbgTrace(unsigned int id, unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4) {
1c79356b 61
b36670ce 62 __asm__ volatile("mr r2,%0" : : "r" (id) : "r2");
1c79356b
A
63 __asm__ volatile("mr r3,%0" : : "r" (item1) : "r3");
64 __asm__ volatile("mr r4,%0" : : "r" (item2) : "r4");
65 __asm__ volatile("mr r5,%0" : : "r" (item3) : "r5");
55e303ae 66 __asm__ volatile("mr r6,%0" : : "r" (item3) : "r6");
1c79356b
A
67 __asm__ volatile("lis r0,hi16(CutTrace)" : : : "r0");
68 __asm__ volatile("ori r0,r0,lo16(CutTrace)" : : : "r0");
69 __asm__ volatile("sc");
70 return;
71}
72#endif
73
74extern void DoPreempt(void);
75extern __inline__ void DoPreempt(void) {
76 __asm__ volatile("lis r0,hi16(DoPreemptCall)" : : : "r0");
77 __asm__ volatile("ori r0,r0,lo16(DoPreemptCall)" : : : "r0");
78 __asm__ volatile("sc");
79 return;
80}
81
82extern void CreateFakeIO(void);
83extern __inline__ void CreateFakeIO(void) {
84 __asm__ volatile("lis r0,hi16(CreateFakeIOCall)" : : : "r0");
85 __asm__ volatile("ori r0,r0,lo16(CreateFakeIOCall)" : : : "r0");
86 __asm__ volatile("sc");
87 return;
88}
89
90extern void CreateFakeDEC(void);
91extern __inline__ void CreateFakeDEC(void) {
92 __asm__ volatile("lis r0,hi16(CreateFakeDECCall)" : : : "r0");
93 __asm__ volatile("ori r0,r0,lo16(CreateFakeDECCall)" : : : "r0");
94 __asm__ volatile("sc");
95 return;
96}
97
98extern void CreateShutdownCTX(void);
99extern __inline__ void CreateShutdownCTX(void) {
100 __asm__ volatile("lis r0,hi16(CreateShutdownCTXCall)" : : : "r0");
101 __asm__ volatile("ori r0,r0,lo16(CreateShutdownCTXCall)" : : : "r0");
102 __asm__ volatile("sc");
103 return;
104}
105
0b4e3aa0
A
106extern void ChokeSys(unsigned int ercd);
107extern __inline__ void ChokeSys(unsigned int ercd) {
108 __asm__ volatile("mr r3,%0" : : "r" (ercd) : "r3");
109 __asm__ volatile("lis r0,hi16(Choke)" : : : "r0");
110 __asm__ volatile("ori r0,r0,lo16(Choke)" : : : "r0");
111 __asm__ volatile("sc");
112 return;
113}
114
1c79356b
A
115typedef struct Boot_Video bootBumbleC;
116
117extern void StoreReal(unsigned int val, unsigned int addr);
55e303ae 118extern void ReadReal(addr64_t raddr, unsigned int *vaddr);
1c79356b
A
119extern void ClearReal(unsigned int addr, unsigned int lgn);
120extern void LoadDBATs(unsigned int *bat);
121extern void LoadIBATs(unsigned int *bat);
122extern void stFloat(unsigned int *addr);
123extern int stVectors(unsigned int *addr);
124extern int stSpecrs(unsigned int *addr);
125extern unsigned int LLTraceSet(unsigned int tflags);
126extern void GratefulDebInit(bootBumbleC *boot_video_info);
127extern void GratefulDebDisp(unsigned int coord, unsigned int data);
128extern void checkNMI(void);
129
55e303ae 130#pragma pack(4) /* Make sure the structure stays as we defined it */
1c79356b
A
131typedef struct GDWorkArea { /* Grateful Deb work area one per processor */
132
133/* Note that a lot of info is duplicated for each processor */
134
135 unsigned int GDsave[32]; /* Save area for registers */
136
137 unsigned int GDfp0[2];
138 unsigned int GDfp1[2];
139 unsigned int GDfp2[2];
140 unsigned int GDfp3[2];
141
142 unsigned int GDtop; /* Top pixel of CPU's window */
143 unsigned int GDleft; /* Left pixel of CPU's window */
144 unsigned int GDtopleft; /* Physical address of top left in frame buffer */
145 unsigned int GDrowbytes; /* Bytes per row */
146 unsigned int GDrowchar; /* Bytes per row of characters plus leading */
147 unsigned int GDdepth; /* Bits per pixel */
148 unsigned int GDcollgn; /* Column width in bytes */
149 unsigned int GDready; /* We are ready to go */
150 unsigned int GDfiller[16]; /* Fill it up to a 256 byte boundary */
151
152 unsigned int GDrowbuf1[128]; /* Buffer to an 8 character row */
153 unsigned int GDrowbuf2[128]; /* Buffer to an 8 character row */
154
155} GDWorkArea;
55e303ae 156#pragma pack()
1c79356b
A
157#define GDfontsize 16
158#define GDdispcols 2
159
160#endif /* _FIRMWARE_H_ */