From e611b132f9b8abe35b362e5870b74bce94a1e58e Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 16 May 2020 20:51:50 -0700 Subject: initial commit --- private/ntos/fw/ppc/inc.h | 883 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 883 insertions(+) create mode 100644 private/ntos/fw/ppc/inc.h (limited to 'private/ntos/fw/ppc/inc.h') diff --git a/private/ntos/fw/ppc/inc.h b/private/ntos/fw/ppc/inc.h new file mode 100644 index 000000000..2cffce2fd --- /dev/null +++ b/private/ntos/fw/ppc/inc.h @@ -0,0 +1,883 @@ + + +/////////////////////////////////////////////////////////////////////////////// +// General definitions +/////////////////////////////////////////////////////////////////////////////// + + +#define WORD_2P2 2 // 2^2 = 4 bytes +#define HALFWORD_2P2 1 // 2^1 = 2 bytes +#define BYTE_2P2 0 // 2^0 = 1 bytes +#define BITSXBYTE 8 // 8 bits = 1 byte + +#define ASCII_BLOCK_SIZE 512 // ASCII block size + +#define MIN(x,y) ((x) > (y) ? (y) : (x)) // minimum number + + +#define INSTRUCTION_DELAY 10 // nsec for each instruction + // using 50MHZ externl clock +#define MAX_DCACHE_LINE_SIZE 32 // max bytes per Data cache line + +#define UNMAPPED_SIZE (512*1024*1024) // 512 Mbytes of unmapped space + +#define PAGE_4G_SHIFT 32 // 2^32 = 4Gbytes +#define PAGE_32M_SHIFT 25 // 2^25 = 32Mbytes +#define PAGE_32M_SIZE (1 << PAGE_32M_SHIFT) // 32 Mbytes +#define PAGE_16M_SHIFT 24 // 2^24 = 16Mbytes +#define PAGE_16M_SIZE (1 << PAGE_16M_SHIFT) // 16 Mbytes +#define PAGE_8M_SHIFT 23 // 2^23 = 8Mbytes +#define PAGE_8M_SIZE (1 << PAGE_8M_SHIFT) // 8 Mbytes +#define PAGE_4M_SHIFT 22 // 2^22 = 4Mbytes +#define PAGE_4M_SIZE (1 << PAGE_4M_SHIFT) // 4 Mbytes +#define PAGE_2M_SHIFT 21 // 2^21 = 2Mbytes +#define PAGE_2M_SIZE (1 << PAGE_2M_SHIFT) // 2 Mbytes +#define PAGE_1M_SHIFT 20 // 2^20 = 1Mbyte +#define PAGE_1M_SIZE (1 << PAGE_1M_SHIFT) // 1 Mbyte +#define PAGE_MAX_SHIFT PAGE_16M_SHIFT // max TLB page shift. +#define PAGE_MAX_SIZE (1 << PAGE_MAX_SHIFT) // max TLB page (one entry) +#define PAGES_IN_4G (1 << (PAGE_4G_SHIFT - PAGE_SHIFT)) // # 4k in 4Gbytes +#define PAGES_IN_16M (1 << (PAGE_16M_SHIFT - PAGE_SHIFT)) // # 4k in 16Mbytes +#define PAGES_IN_1M (1 << (PAGE_1M_SHIFT - PAGE_SHIFT)) // # 4k in 1Mbyte + +//#define HIT_WRITEBACK_D 0x19 // hit write back 1st cache +//#define HIT_WRITEBACK_SD 0x1B // hit write back 2nd cache + +#define EISA_LATCH_VIRTUAL_BASE (DEVICE_VIRTUAL_BASE + 0xE000) +#define EISA_LOCK_VIRTUAL_BASE (DEVICE_VIRTUAL_BASE + 0xE800) +#define EISA_INT_ACK_ADDR (DEVICE_VIRTUAL_BASE + 0x238) +#define INT_ENABLE_ADDR (DEVICE_VIRTUAL_BASE + 0xE8) + +// +// coff image info structure +// + +typedef struct _IMAGE_FLAGS + { + ULONG Exec : 1; + ULONG Reloc : 1; + + } IMAGE_FLAGS, *PIMAGE_FLAGS; + + +typedef struct _IMAGE_INFO + { + IMAGE_FLAGS Flags; // image characteristic + ULONG ImageBase; // base address + ULONG ImageSize; // in 4k units + + } IMAGE_INFO, *PIMAGE_INFO; + + + +/////////////////////////////////////////////////////////////////////////////// +// General function prototypes +/////////////////////////////////////////////////////////////////////////////// + +PCHAR +FwToUpperStr + ( + IN OUT PCHAR s + ); + +PCHAR +FwToLowerStr + ( + IN OUT PCHAR s + ); + +PCHAR +FwGetPath + ( + IN PCONFIGURATION_COMPONENT Component, + OUT PCHAR String + ); + +PCHAR +FwGetMnemonic + ( + IN PCONFIGURATION_COMPONENT Component + ); + +BOOLEAN +FwValidMnem + ( + IN PCHAR Str + ); + +ULONG +Fw4UcharToUlongLSB + ( + IN PUCHAR String + ); + + +ULONG +Fw4UcharToUlongMSB + ( + IN PUCHAR String + ); + +PCHAR +FwStoreStr + ( + IN PCHAR Str + ); + +BOOLEAN +FwGetNumMnemonicKey + ( + IN PCHAR Path, + IN UCHAR KeyNumber, + IN PULONG Key + ); + +BOOLEAN +FwGetMnemonicKey + ( + IN PCHAR Path, + IN PCHAR Mnemonic, + IN PULONG Key + ); + +BOOLEAN +FwGetNextMnemonic + ( + IN PCHAR Path, + IN PCHAR Mnemonic, + OUT PCHAR NextMnemonic + ); + +BOOLEAN +FwGetMnemonicPath + ( + IN PCHAR Path, + IN PCHAR Mnemonic, + OUT PCHAR MnemonicPath + ); + +BOOLEAN +FwGetEisaId + ( + IN PCHAR PathName, + OUT PCHAR EisaId, + OUT PUCHAR IdInfo + ); + +VOID +FwUncompressEisaId + ( + IN PUCHAR CompEisaId, + OUT PUCHAR UncompEisaId + ); + +BOOLEAN +FwGetEisaBusIoCpuAddress + ( + IN PCHAR EisaPath, + OUT PVOID *IoBusAddress + ); + +BOOLEAN +GetNextPath + ( + IN OUT PCHAR *PPathList, + OUT PCHAR PathTarget + ); + +//PDRIVER_STRATEGY +//FwGetStrategy +// ( +// IN PCHAR Path +// ); + +ARC_STATUS +FwGetImageInfo + ( + IN PCHAR ImagePath, + OUT PIMAGE_INFO pImageInfo + ); + +PCONFIGURATION_COMPONENT +FwGetControllerComponent + ( + IN PCHAR Path + ); + +PCONFIGURATION_COMPONENT +FwGetPeripheralComponent + ( + IN PCHAR Path + ); + +PCHAR +FwGetControllerMnemonic + ( + IN PCHAR Path + ); + +PCHAR +FwGetPeripheralMnemonic + ( + IN PCHAR Path + ); + +BOOLEAN +FwSizeToShift + ( + IN ULONG Size, + OUT ULONG Shift + ); + +ARC_STATUS +FwGetImageInfo + ( + IN PCHAR ImagePath, + OUT PIMAGE_INFO pImageInfo + ); + + + + +/////////////////////////////////////////////////////////////////////////////// +// EISA configuration +/////////////////////////////////////////////////////////////////////////////// + + + +#define NO_ADAP_ID 0x80000000 // adapter id not present +#define WAIT_ADAP_ID 0x70000000 // adapter not ready yet +#define TIMEOUT_UNITS 200 // 200 units of 10msec + + +typedef struct _EISA_SLOT_INFO + { + UCHAR IdInfo; + UCHAR MajorRevLevel; + UCHAR MinorRevLevel; + UCHAR LSByteChecksum; + UCHAR MSByteChecksum; + UCHAR FunctionsNumber; + UCHAR FunctionInfo; + UCHAR Id1stChar; + UCHAR Id2ndChar; + UCHAR Id3rdChar; + UCHAR Id4thChar; + } EISA_SLOT_INFO, *PEISA_SLOT_INFO; + + +#define ID_DIGIT_SIZE 4 // # of bits +#define ID_CHAR_SIZE 5 // # of bits +#define ID_DIGIT_MASK ((1<