#ifndef _FIRMWARE_H_
#define _FIRMWARE_H_
#ifndef __ppc__
#error This file is only useful on PowerPC.
#endif
#include <mach/vm_types.h>
#include <ppc/Diagnostics.h>
void dbgDisp(unsigned int port, unsigned int id, unsigned int data);
void dbgLog(unsigned int d0, unsigned int d1, unsigned int d2, unsigned int d3);
void dbgLog2(unsigned int type, unsigned int p1, unsigned int p2);
void dbgDispLL(unsigned int port, unsigned int id, unsigned int data);
void fwSCCinit(unsigned int port);
void fwEmMck(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
void fwSCOM(scomcomm *);
void setPmon(unsigned int, unsigned int);
extern void dbgTrace(unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4);
#if 0
extern __inline__ void dbgTrace(unsigned int item1, unsigned int item2, unsigned int item3, unsigned int item4) {
__asm__ volatile("mr r3,%0" : : "r" (item1) : "r3");
__asm__ volatile("mr r4,%0" : : "r" (item2) : "r4");
__asm__ volatile("mr r5,%0" : : "r" (item3) : "r5");
__asm__ volatile("mr r6,%0" : : "r" (item3) : "r6");
__asm__ volatile("lis r0,hi16(CutTrace)" : : : "r0");
__asm__ volatile("ori r0,r0,lo16(CutTrace)" : : : "r0");
__asm__ volatile("sc");
return;
}
#endif
extern void DoPreempt(void);
extern __inline__ void DoPreempt(void) {
__asm__ volatile("lis r0,hi16(DoPreemptCall)" : : : "r0");
__asm__ volatile("ori r0,r0,lo16(DoPreemptCall)" : : : "r0");
__asm__ volatile("sc");
return;
}
extern void CreateFakeIO(void);
extern __inline__ void CreateFakeIO(void) {
__asm__ volatile("lis r0,hi16(CreateFakeIOCall)" : : : "r0");
__asm__ volatile("ori r0,r0,lo16(CreateFakeIOCall)" : : : "r0");
__asm__ volatile("sc");
return;
}
extern void CreateFakeDEC(void);
extern __inline__ void CreateFakeDEC(void) {
__asm__ volatile("lis r0,hi16(CreateFakeDECCall)" : : : "r0");
__asm__ volatile("ori r0,r0,lo16(CreateFakeDECCall)" : : : "r0");
__asm__ volatile("sc");
return;
}
extern void CreateShutdownCTX(void);
extern __inline__ void CreateShutdownCTX(void) {
__asm__ volatile("lis r0,hi16(CreateShutdownCTXCall)" : : : "r0");
__asm__ volatile("ori r0,r0,lo16(CreateShutdownCTXCall)" : : : "r0");
__asm__ volatile("sc");
return;
}
extern void ChokeSys(unsigned int ercd);
extern __inline__ void ChokeSys(unsigned int ercd) {
__asm__ volatile("mr r3,%0" : : "r" (ercd) : "r3");
__asm__ volatile("lis r0,hi16(Choke)" : : : "r0");
__asm__ volatile("ori r0,r0,lo16(Choke)" : : : "r0");
__asm__ volatile("sc");
return;
}
typedef struct Boot_Video bootBumbleC;
extern void StoreReal(unsigned int val, unsigned int addr);
extern void ReadReal(addr64_t raddr, unsigned int *vaddr);
extern void ClearReal(unsigned int addr, unsigned int lgn);
extern void LoadDBATs(unsigned int *bat);
extern void LoadIBATs(unsigned int *bat);
extern void stFloat(unsigned int *addr);
extern int stVectors(unsigned int *addr);
extern int stSpecrs(unsigned int *addr);
extern unsigned int LLTraceSet(unsigned int tflags);
extern void GratefulDebInit(bootBumbleC *boot_video_info);
extern void GratefulDebDisp(unsigned int coord, unsigned int data);
extern void checkNMI(void);
#pragma pack(4)
typedef struct GDWorkArea {
unsigned int GDsave[32];
unsigned int GDfp0[2];
unsigned int GDfp1[2];
unsigned int GDfp2[2];
unsigned int GDfp3[2];
unsigned int GDtop;
unsigned int GDleft;
unsigned int GDtopleft;
unsigned int GDrowbytes;
unsigned int GDrowchar;
unsigned int GDdepth;
unsigned int GDcollgn;
unsigned int GDready;
unsigned int GDfiller[16];
unsigned int GDrowbuf1[128];
unsigned int GDrowbuf2[128];
} GDWorkArea;
#pragma pack()
#define GDfontsize 16
#define GDdispcols 2
#endif