#ifndef _ARCBIOS_H_
#define _ARCBIOS_H_
#define ARCBIOS_STDIN 0
#define ARCBIOS_STDOUT 1
#define ARCBIOS_PAGESIZE 4096
#define ARCBIOS_ESUCCESS 0
#define ARCBIOS_E2BIG 1
#define ARCBIOS_EACCES 2
#define ARCBIOS_EAGAIN 3
#define ARCBIOS_EBADF 4
#define ARCBIOS_EBUSY 5
#define ARCBIOS_EFAULT 6
#define ARCBIOS_EINVAL 7
#define ARCBIOS_EIO 8
#define ARCBIOS_EISDIR 9
#define ARCBIOS_EMFILE 10
#define ARCBIOS_EMLINK 11
#define ARCBIOS_ENAMETOOLONG 12
#define ARCBIOS_ENODEV 13
#define ARCBIOS_ENOENT 14
#define ARCBIOS_ENOEXEC 15
#define ARCBIOS_ENOMEM 16
#define ARCBIOS_ENOSPC 17
#define ARCBIOS_ENOTDIR 18
#define ARCBIOS_ENOTTY 19
#define ARCBIOS_ENXIO 20
#define ARCBIOS_EROFS 21
#if defined(sgimips)
#define ARCBIOS_EADDRNOTAVAIL 31
#define ARCBIOS_ETIMEDOUT 32
#define ARCBIOS_ECONNABORTED 33
#define ARCBIOS_ENOCONNECT 34
#endif
struct arcbios_spb {
uint32_t SPBSignature;
uint32_t SPBLength;
uint16_t Version;
uint16_t Revision;
int32_t RestartBlock;
int32_t DebugBlock;
int32_t GEVector;
int32_t UTLBMissVector;
uint32_t FirmwareVectorLength;
int32_t FirmwareVector;
uint32_t PrivateVectorLength;
int32_t PrivateVector;
uint32_t AdapterCount;
uint32_t AdapterType;
uint32_t AdapterVectorLength;
int32_t AdapterVector;
};
#define ARCBIOS_SPB_SIGNATURE 0x53435241
#define ARCBIOS_SPB_SIGNATURE_1 0x41524353
struct arcbios_component {
uint32_t Class;
uint32_t Type;
uint32_t Flags;
uint16_t Version;
uint16_t Revision;
uint32_t Key;
uint32_t AffinityMask;
uint32_t ConfigurationDataSize;
uint32_t IdentifierLength;
int32_t Identifier;
};
#if defined(sgimips)
#define COMPONENT_CLASS_SystemClass 0
#define COMPONENT_CLASS_ProcessorClass 1
#define COMPONENT_CLASS_CacheClass 2
#define COMPONENT_CLASS_MemoryClass 3
#define COMPONENT_CLASS_AdapterClass 4
#define COMPONENT_CLASS_ControllerClass 5
#define COMPONENT_CLASS_PeripheralClass 6
#else
#define COMPONENT_CLASS_SystemClass 0
#define COMPONENT_CLASS_ProcessorClass 1
#define COMPONENT_CLASS_CacheClass 2
#define COMPONENT_CLASS_AdapterClass 3
#define COMPONENT_CLASS_ControllerClass 4
#define COMPONENT_CLASS_PeripheralClass 5
#define COMPONENT_CLASS_MemoryClass 6
#endif
#if defined(sgimips)
#define COMPONENT_TYPE_ARC 0
#define COMPONENT_TYPE_CPU 1
#define COMPONENT_TYPE_FPU 2
#define COMPONENT_TYPE_PrimaryICache 3
#define COMPONENT_TYPE_PrimaryDCache 4
#define COMPONENT_TYPE_SecondaryICache 5
#define COMPONENT_TYPE_SecondaryDCache 6
#define COMPONENT_TYPE_SecondaryCache 7
#define COMPONENT_TYPE_MemoryUnit 8
#define COMPONENT_TYPE_EISAAdapter 9
#define COMPONENT_TYPE_TCAdapter 10
#define COMPONENT_TYPE_SCSIAdapter 11
#define COMPONENT_TYPE_DTIAdapter 12
#define COMPONENT_TYPE_MultiFunctionAdapter 13
#define COMPONENT_TYPE_DiskController 14
#define COMPONENT_TYPE_TapeController 15
#define COMPONENT_TYPE_CDROMController 16
#define COMPONENT_TYPE_WORMController 17
#define COMPONENT_TYPE_SerialController 18
#define COMPONENT_TYPE_NetworkController 19
#define COMPONENT_TYPE_DisplayController 20
#define COMPONENT_TYPE_ParallelController 21
#define COMPONENT_TYPE_PointerController 22
#define COMPONENT_TYPE_KeyboardController 23
#define COMPONENT_TYPE_AudioController 24
#define COMPONENT_TYPE_OtherController 25
#define COMPONENT_TYPE_DiskPeripheral 26
#define COMPONENT_TYPE_FloppyDiskPeripheral 27
#define COMPONENT_TYPE_TapePeripheral 28
#define COMPONENT_TYPE_ModemPeripheral 29
#define COMPONENT_TYPE_MonitorPeripheral 30
#define COMPONENT_TYPE_PrinterPeripheral 31
#define COMPONENT_TYPE_PointerPeripheral 32
#define COMPONENT_TYPE_KeyboardPeripheral 33
#define COMPONENT_TYPE_TerminalPeripheral 34
#define COMPONENT_TYPE_LinePeripheral 35
#define COMPONENT_TYPE_NetworkPeripheral 36
#define COMPONENT_TYPE_OtherPeripheral 37
#else
#define COMPONENT_TYPE_ARC 0
#define COMPONENT_TYPE_CPU 1
#define COMPONENT_TYPE_FPU 2
#define COMPONENT_TYPE_PrimaryICache 3
#define COMPONENT_TYPE_PrimaryDCache 4
#define COMPONENT_TYPE_SecondaryICache 5
#define COMPONENT_TYPE_SecondaryDCache 6
#define COMPONENT_TYPE_SecondaryCache 7
#define COMPONENT_TYPE_EISAAdapter 8
#define COMPONENT_TYPE_TCAdapter 9
#define COMPONENT_TYPE_SCSIAdapter 10
#define COMPONENT_TYPE_DTIAdapter 11
#define COMPONENT_TYPE_MultiFunctionAdapter 12
#define COMPONENT_TYPE_DiskController 13
#define COMPONENT_TYPE_TapeController 14
#define COMPONENT_TYPE_CDROMController 15
#define COMPONENT_TYPE_WORMController 16
#define COMPONENT_TYPE_SerialController 17
#define COMPONENT_TYPE_NetworkController 18
#define COMPONENT_TYPE_DisplayController 19
#define COMPONENT_TYPE_ParallelController 20
#define COMPONENT_TYPE_PointerController 21
#define COMPONENT_TYPE_KeyboardController 22
#define COMPONENT_TYPE_AudioController 23
#define COMPONENT_TYPE_OtherController 24
#define COMPONENT_TYPE_DiskPeripheral 25
#define COMPONENT_TYPE_FloppyDiskPeripheral 26
#define COMPONENT_TYPE_TapePeripheral 27
#define COMPONENT_TYPE_ModemPeripheral 28
#define COMPONENT_TYPE_MonitorPeripheral 29
#define COMPONENT_TYPE_PrinterPeripheral 30
#define COMPONENT_TYPE_PointerPeripheral 31
#define COMPONENT_TYPE_KeyboardPeripheral 32
#define COMPONENT_TYPE_TerminalPeripheral 33
#define COMPONENT_TYPE_OtherPeripheral 34
#define COMPONENT_TYPE_LinePeripheral 35
#define COMPONENT_TYPE_NetworkPeripheral 36
#define COMPONENT_TYPE_MemoryUnit 37
#endif
#define COMPONENT_FLAG_Failed 1
#define COMPONENT_FLAG_ReadOnly 2
#define COMPONENT_FLAG_Removable 4
#define COMPONENT_FLAG_ConsoleIn 8
#define COMPONENT_FLAG_ConsoleOut 16
#define COMPONENT_FLAG_Input 32
#define COMPONENT_FLAG_Output 64
#define COMPONENT_KEY_Cache_CacheSize(x) \
(ARCBIOS_PAGESIZE << ((x) & 0xffff))
#define COMPONENT_KEY_Cache_LineSize(x) \
(1U << (((x) >> 16) & 0xff))
#define COMPONENT_KEY_Cache_RefillSize(x) \
(((x) >> 24) & 0xff)
#define ARCBIOS_SYSID_FIELDLEN 8
struct arcbios_sysid {
char VendorId[ARCBIOS_SYSID_FIELDLEN];
char ProductId[ARCBIOS_SYSID_FIELDLEN];
};
struct arcbios_mem {
uint32_t Type;
uint32_t BasePage;
uint32_t PageCount;
};
#if defined(sgimips)
#define ARCBIOS_MEM_ExceptionBlock 0
#define ARCBIOS_MEM_SystemParameterBlock 1
#define ARCBIOS_MEM_FreeContiguous 2
#define ARCBIOS_MEM_FreeMemory 3
#define ARCBIOS_MEM_BadMemory 4
#define ARCBIOS_MEM_LoadedProgram 5
#define ARCBIOS_MEM_FirmwareTemporary 6
#define ARCBIOS_MEM_FirmwarePermanent 7
#elif defined(arc)
#define ARCBIOS_MEM_ExceptionBlock 0
#define ARCBIOS_MEM_SystemParameterBlock 1
#define ARCBIOS_MEM_FreeMemory 2
#define ARCBIOS_MEM_BadMemory 3
#define ARCBIOS_MEM_LoadedProgram 4
#define ARCBIOS_MEM_FirmwareTemporary 5
#define ARCBIOS_MEM_FirmwarePermanent 6
#define ARCBIOS_MEM_FreeContiguous 7
#endif
struct arcbios_dsp_stat {
uint16_t CursorXPosition;
uint16_t CursorYPosition;
uint16_t CursorMaxXPosition;
uint16_t CursorMaxYPosition;
uint8_t ForegroundColor;
uint8_t BackgroundColor;
uint8_t HighIntensity;
uint8_t Underscored;
uint8_t ReverseVideo;
};
struct arcbios_fv {
int32_t Load;
int32_t Invoke;
int32_t Execute;
int32_t Halt;
int32_t PowerDown;
int32_t Restart;
int32_t Reboot;
int32_t EnterInteractiveMode;
int32_t ReturnFromMain;
int32_t GetPeer;
int32_t GetChild;
int32_t GetParent;
int32_t GetConfigurationData;
int32_t AddChild;
int32_t DeleteComponent;
int32_t GetComponent;
int32_t SaveConfiguration;
int32_t GetSystemId;
int32_t GetMemoryDescriptor;
int32_t Signal;
int32_t GetTime;
int32_t GetRelativeTime;
int32_t GetDirectoryEntry;
int32_t Open;
int32_t Close;
int32_t Read;
int32_t GetReadStatus;
int32_t Write;
int32_t Seek;
int32_t Mount;
int32_t GetEnvironmentVariable;
int32_t SetEnvironmentVariable;
int32_t GetFileInformation;
int32_t SetFileInformation;
int32_t FlushAllCaches;
int32_t TestUnicode;
int32_t GetDisplayStatus;
};
#if defined(_KERNEL) || defined(_STANDALONE)
long arcbios_Load(char *, u_long, u_long, u_long *);
long arcbios_Invoke(u_long, u_long, u_long, char **, char **);
long arcbios_Execute(char *, u_long, char **, char **);
void arcbios_Halt(void) __dead;
void arcbios_PowerDown(void) __dead;
void arcbios_Restart(void) __dead;
void arcbios_Reboot(void) __dead;
void arcbios_EnterInteractiveMode(void) __dead;
void arcbios_ReturnFromMain(void) __dead;
void * arcbios_GetPeer(void *);
void * arcbios_GetChild(void *);
void * arcbios_GetParent(void *);
long arcbios_GetConfigurationData(void *, void *);
void * arcbios_AddChild(void *, void *);
long arcbios_DeleteComponent(void *);
void * arcbios_GetComponent(char *);
long arcbios_SaveConfiguration(void);
void * arcbios_GetSystemId(void);
void * arcbios_GetMemoryDescriptor(void *);
void arcbios_Signal(u_long, void *);
void * arcbios_GetTime(void);
u_long arcbios_GetRelativeTime(void);
long arcbios_GetDirectoryEntry(u_long, void *, u_long, u_long *);
long arcbios_Open(const char *, u_long, u_long *);
long arcbios_Close(u_long);
long arcbios_Read(u_long, void *, u_long, u_long *);
long arcbios_GetReadStatus(u_long);
long arcbios_Write(u_long, void *, u_long, u_long *);
long arcbios_Seek(u_long, int64_t *, u_long);
long arcbios_Mount(char *, u_long);
const char *
arcbios_GetEnvironmentVariable(const char *);
long arcbios_SetEnvironmentVariable(const char *, const char *);
long arcbios_GetFileInformation(u_long, void *);
long arcbios_SetFileInformation(u_long, u_long, u_long);
void arcbios_FlushAllCaches(void);
paddr_t arcbios_TestUnicode(u_long, uint16_t);
void * arcbios_GetDisplayStatus(u_long);
#endif
#endif