diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 2004-08-08 21:51:37 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 2004-08-08 21:51:37 +0000 |
commit | 279457d317669c35084274573083d2b1f3500679 (patch) | |
tree | ca0421f5871ffa50e5a055ab188b6d773078340a /sys | |
parent | f3653a89b04814d2444d6b6114780b700cf9b2dd (diff) |
Ahh! This code brings out old memories. Eight years old but still
useful. This is the ARCBIOS interface, eg the firmware interface
for SGI machines.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mips64/include/arcbios.h | 392 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/arcbios.c | 327 |
2 files changed, 719 insertions, 0 deletions
diff --git a/sys/arch/mips64/include/arcbios.h b/sys/arch/mips64/include/arcbios.h new file mode 100644 index 00000000000..d5084a2b987 --- /dev/null +++ b/sys/arch/mips64/include/arcbios.h @@ -0,0 +1,392 @@ +/* $OpenBSD: arcbios.h,v 1.1 2004/08/08 21:51:36 pefo Exp $ */ +/*- + * Copyright (c) 1996 M. Warner Losh. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/types.h> + +typedef struct arc_sid +{ + char vendor[8]; + char prodid[8]; +} arc_sid_t; + +typedef enum arc_config_class +{ + arc_SystemClass, + arc_ProcessorClass, + arc_CacheClass, + arc_AdapterClass, + arc_ControllerClass, + arc_PeripheralClass, + arc_MemoryClass +} arc_config_class_t; + +typedef enum arc_config_type +{ + arc_System, + + arc_CentralProcessor, + arc_FloatingPointProcessor, + + arc_PrimaryIcache, + arc_PrimaryDcache, + arc_SecondaryIcache, + arc_SecondaryDcache, + arc_SecondaryCache, + + arc_EisaAdapter, /* Eisa adapter */ + arc_TcAdapter, /* Turbochannel adapter */ + arc_ScsiAdapter, /* SCSI adapter */ + arc_DtiAdapter, /* AccessBus adapter */ + arc_MultiFunctionAdapter, + + arc_DiskController, + arc_TapeController, + arc_CdromController, + arc_WormController, + arc_SerialController, + arc_NetworkController, + arc_DisplayController, + arc_ParallelController, + arc_PointerController, + arc_KeyboardController, + arc_AudioController, + arc_OtherController, /* denotes a controller not otherwise defined */ + + arc_DiskPeripheral, + arc_FloppyDiskPeripheral, + arc_TapePeripheral, + arc_ModemPeripheral, + arc_MonitorPeripheral, + arc_PrinterPeripheral, + arc_PointerPeripheral, + arc_KeyboardPeripheral, + arc_TerminalPeripheral, + arc_OtherPeripheral, /* denotes a peripheral not otherwise defined */ + arc_LinePeripheral, + arc_NetworkPeripheral, + + arc_SystemMemory +} arc_config_type_t; + +typedef u_char arc_dev_flags_t; + +/* Wonder how this is aligned... */ +typedef struct arc_config +{ + arc_config_class_t class; /* Likely these three all */ + arc_config_type_t type; /* need to be uchar to make */ + arc_dev_flags_t flags; /* the alignment right */ + u_int16_t version; + u_int16_t revision; + u_int32_t key; + u_int32_t affinity_mask; + u_int32_t config_data_len; + u_int32_t id_len; + char *id; +} arc_config_t; + +typedef enum arc_status +{ + arc_ESUCCESS, /* Success */ + arc_E2BIG, /* Arg list too long */ + arc_EACCES, /* No such file or directory */ + arc_EAGAIN, /* Try again */ + arc_EBADF, /* Bad file number */ + arc_EBUSY, /* Device or resource busy */ + arc_EFAULT, /* Bad address */ + arc_EINVAL, /* Invalid argument */ + arc_EIO, /* I/O error */ + arc_EISDIR, /* Is a directory */ + arc_EMFILE, /* Too many open files */ + arc_EMLINK, /* Too many links */ + arc_ENAMETOOLONG, /* File name too long */ + arc_ENODEV, /* No such device */ + arc_ENOENT, /* No such file or directory */ + arc_ENOEXEC, /* Exec format error */ + arc_ENOMEM, /* Out of memory */ + arc_ENOSPC, /* No space left on device */ + arc_ENOTDIR, /* Not a directory */ + arc_ENOTTY, /* Not a typewriter */ + arc_ENXIO, /* No such device or address */ + arc_EROFS, /* Read-only file system */ +} arc_status_t; + +/* + * Oops! Arc systems and SGI's have different order of types. + */ +#ifdef __arc__ +typedef enum { + ExeceptionBlock, SystemParameterBlock, FreeMemory, + BadMemory, LoadedProgram, FirmwareTemporary, + FirmwarePermanent, FreeContigous +} MEMORYTYPE; +#endif + +#ifdef __sgi__ +typedef enum { + ExeceptionBlock, SystemParameterBlock, FreeContigous, + FreeMemory, BadMemory, LoadedProgram, + FirmwareTemporary, FirmwarePermanent, +} MEMORYTYPE; +#endif + +typedef struct arc_mem { + MEMORYTYPE Type; /* Memory chunk type */ + u_int32_t BasePage; /* Page no, first page */ + u_int32_t PageCount; /* Number of pages */ +} arc_mem_t; + +typedef caddr_t arc_time_t; /* XXX */ + +typedef struct arc_dsp_stat { + u_int16_t CursorXPosition; + u_int16_t CursorYPosition; + u_int16_t CursorMaxXPosition; + u_int16_t CursorMaxYPosition; + u_char ForegroundColor; + u_char BackgroundColor; + u_char HighIntensity; + u_char Underscored; + u_char ReverseVideo; +} arc_dsp_stat_t; + +typedef caddr_t arc_dirent_t; /* XXX */ +typedef u_int32_t arc_open_mode_t; /* XXX */ +typedef u_int32_t arc_seek_mode_t; /* XXX */ +typedef u_int32_t arc_mount_t; /* XXX */ + +typedef struct arc_calls +{ + arc_status_t (*load)( /* Load 1 */ + char *, /* Image to load */ + u_int32_t, /* top address */ + u_int32_t *, /* Entry address */ + u_int32_t *); /* Low address */ + + arc_status_t (*invoke)( /* Invoke 2 */ + u_int32_t, /* Entry Address */ + u_int32_t, /* Stack Address */ + u_int32_t, /* Argc */ + char **, /* argv */ + char **); /* envp */ + + arc_status_t (*execute)( /* Execute 3 */ + char *, /* Image path */ + u_int32_t, /* Argc */ + char **, /* argv */ + char **); /* envp */ + + volatile void (*halt)(void); /* Halt 4 */ + + volatile void (*power_down)(void); /* PowerDown 5 */ + + volatile void (*restart)(void); /* Restart 6 */ + + volatile void (*reboot)(void); /* Reboot 7 */ + + volatile void (*enter_interactive_mode)(void); /* EnterInteractiveMode 8 */ + + volatile void (*return_from_main)(void); /* ReturnFromMain 9 */ + + arc_config_t *(*get_peer)( /* GetPeer 10 */ + arc_config_t *); /* Component */ + + arc_config_t *(*get_child)( /* GetChild 11 */ + arc_config_t *); /* Component */ + + arc_config_t *(*get_parent)( /* GetParent 12 */ + arc_config_t *); /* Component */ + + arc_status_t (*get_config_data)( /* GetConfigurationData 13 */ + caddr_t, /* Configuration Data */ + arc_config_t *); /* Component */ + + arc_config_t *(*add_child)( /* AddChild 14 */ + arc_config_t *, /* Component */ + arc_config_t *); /* New Component */ + + arc_status_t (*delete_component)( /* DeleteComponent 15 */ + arc_config_t *); /* Component */ + + arc_config_t *(*get_component)( /* GetComponent 16 */ + char *); /* Path */ + + arc_status_t (*save_config)(void); /* SaveConfiguration 17 */ + + arc_sid_t *(*get_system_id)(void); /* GetSystemId 18 */ + + arc_mem_t *(*get_memory_descriptor)( /* GetMemoryDescriptor 19 */ + arc_mem_t *); /* MemoryDescriptor */ + +#ifdef arc + void (*signal)( /* Signal 20 */ + u_int32_t, /* Signal number */ +/**/ caddr_t); /* Handler */ +#else + void *unused; +#endif + + arc_time_t *(*get_time)(void); /* GetTime 21 */ + + u_int32_t (*get_relative_time)(void); /* GetRelativeTime 22 */ + + arc_status_t (*get_dir_entry)( /* GetDirectoryEntry 23 */ + u_int32_t, /* FileId */ + arc_dirent_t *, /* Directory entry */ + u_int32_t, /* Length */ + u_int32_t *); /* Count */ + + arc_status_t (*open)( /* Open 24 */ + char *, /* Path */ + arc_open_mode_t, /* Open mode */ + u_int32_t *); /* FileId */ + + arc_status_t (*close)( /* Close 25 */ + u_int32_t); /* FileId */ + + arc_status_t (*read)( /* Read 26 */ + u_int32_t, /* FileId */ + caddr_t, /* Buffer */ + u_int32_t, /* Length */ + u_int32_t *); /* Count */ + + arc_status_t (*get_read_status)( /* GetReadStatus 27 */ + u_int32_t); /* FileId */ + + arc_status_t (*write)( /* Write 28 */ + u_int32_t, /* FileId */ + caddr_t, /* Buffer */ + u_int32_t, /* Length */ + u_int32_t *); /* Count */ + + arc_status_t (*seek)( /* Seek 29 */ + u_int32_t, /* FileId */ + int64_t *, /* Offset */ + arc_seek_mode_t); /* Mode */ + + arc_status_t (*mount)( /* Mount 30 */ + char *, /* Path */ + arc_mount_t); /* Operation */ + + char *(*getenv)( /* GetEnvironmentVariable 31 */ + char *); /* Variable */ + + arc_status_t (*putenv)( /* SetEnvironmentVariable 32 */ + char *, /* Variable */ + char *); /* Value */ + + arc_status_t (*get_file_info)(void); /* GetFileInformation 33 */ + + arc_status_t (*set_file_info)(void); /* SetFileInformation 34 */ + + void (*flush_all_caches)(void); /* FlushAllCaches 35 */ + +#ifdef arc + arc_status_t (*test_unicode)( /* TestUnicodeCharacter 36 */ + u_int32_t, /* FileId */ + u_int16_t); /* UnicodeCharacter */ + + arc_dsp_stat_t *(*get_display_status)( /* GetDisplayStatus 37 */ + u_int32_t); /* FileId */ +#endif +} arc_calls_t; + +#define ARC_PARAM_BLK_MAGIC 0x53435241 +#define ARC_PARAM_BLK_MAGIC_BUG 0x41524353 /* This is wrong... but req */ + +typedef struct arc_param_blk +{ + u_int32_t magic; /* Magic Number */ + u_int32_t length; /* Length of parameter block */ + u_int16_t version; /* ?? */ + u_int16_t revision; /* ?? */ +/**/ caddr_t restart_block; /* ?? */ +/**/ caddr_t debug_block; /* Debugging info -- unused */ +/**/ caddr_t general_exp_vect; /* ?? */ +/**/ caddr_t tlb_miss_exp_vect; /* ?? */ + u_int32_t firmware_length; /* Size of Firmware jumptable in bytes */ + arc_calls_t *firmware_vect; /* Firmware jumptable */ + u_int32_t vendor_length; /* Size of Vendor specific jumptable */ +/**/ caddr_t vendor_vect; /* Vendor specific jumptable */ + u_int32_t adapter_count; /* ?? */ + u_int32_t adapter0_type; /* ?? */ + u_int32_t adapter0_length; /* ?? */ +/**/ caddr_t adapter0_vect; /* ?? */ +} arc_param_blk_t; + +#define ArcBiosBase ((arc_param_blk_t *) 0x80001000) +#define ArcBios (ArcBiosBase->firmware_vect) + + +int bios_getchar __P((void)); +void bios_putchar(char); +void bios_putstring(char *); +void bios_ident(void); +void bios_display_info(int *, int *, int *, int *); + +/* + * Direct ARC-Bios calls. + */ +int Bios_Load(void); +int Bios_Invoke(void); +int Bios_Execute(void); +int Bios_Halt(void); +int Bios_PowerDown(void); +int Bios_Restart(void); +int Bios_Reboot(void); +int Bios_EnterInteractiveMode(void); +int Bios_GetPeer(void); +arc_config_t *Bios_GetChild(arc_config_t *); +int Bios_GetParent(void); +int Bios_GetConfigurationData(void); +int Bios_AddChild(void); +int Bios_DeleteComponent(void); +int Bios_GetComponent(void); +int Bios_SaveConfiguration(void); +arc_sid_t *Bios_GetSystemId(void); +arc_mem_t *Bios_GetMemoryDescriptor(arc_mem_t *); +int Bios_GetTime(void); +int Bios_GetRelativeTime(void); +int Bios_GetDirectoryEntry(void); +int Bios_Open(char *, int, u_int *); +int Bios_Close(u_int); +int Bios_Read(int, char *, int, int *); +int Bios_GetReadStatus(void); +int Bios_Write(int, char *, int, int *); +int Bios_Seek(void); +int Bios_Mount(void); +int Bios_GetEnvironmentVariable(void); +int Bios_SetEnvironmentVariable(void); +int Bios_GetFileInformation(void); +int Bios_SetFileInformation(void); +int Bios_FlushAllCaches(void); +int Bios_TestUnicodeCharacter(void); +arc_dsp_stat_t *Bios_GetDisplayStatus(int); + + diff --git a/sys/arch/mips64/mips64/arcbios.c b/sys/arch/mips64/mips64/arcbios.c new file mode 100644 index 00000000000..5e122a08a26 --- /dev/null +++ b/sys/arch/mips64/mips64/arcbios.c @@ -0,0 +1,327 @@ +/* $OpenBSD: arcbios.c,v 1.1 2004/08/08 21:51:36 pefo Exp $ */ +/*- + * Copyright (c) 1996 M. Warner Losh. All rights reserved. + * Copyright (c) 1996-2004 Opsycon AB. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/proc.h> +#include <sys/user.h> +#include <lib/libkern/libkern.h> +#include <machine/pte.h> +#include <machine/cpu.h> +#include <machine/memconf.h> +#include <machine/param.h> +#include <machine/autoconf.h> +#include <mips64/arcbios.h> +#include <mips64/archtype.h> + +arc_param_blk_t *bios_base = ArcBiosBase; + +extern int physmem; /* Total physical memory size */ + +void bios_configure_memory(void); +int bios_get_system_type(void); + +arc_dsp_stat_t displayinfo; /* Save area for display status info. */ + +static struct systypes { + char *sys_vend; /* Vendor ID if name is ambigous */ + char *sys_name; /* May be left NULL if name is sufficient */ + int sys_type; +} sys_types[] = { + { NULL, "PICA-61", ACER_PICA_61 }, + { NULL, "NEC-R94", ACER_PICA_61 }, + { NULL, "DESKTECH-TYNE", DESKSTATION_TYNE }, + { NULL, "DESKTECH-ARCStation I", DESKSTATION_RPC44 }, + { NULL, "Microsoft-Jazz", MAGNUM }, + { NULL, "RM200PCI", SNI_RM200 }, + { NULL, "SGI-IP17", SGI_CRIMSON }, + { NULL, "SGI-IP19", SGI_ONYX }, + { NULL, "SGI-IP20", SGI_INDIGO }, + { NULL, "SGI-IP21", SGI_POWER }, + { NULL, "SGI-IP22", SGI_INDY }, + { NULL, "SGI-IP25", SGI_POWER10 }, + { NULL, "SGI-IP26", SGI_POWERI }, + { NULL, "SGI-IP32", SGI_O2 }, +}; + +#define KNOWNSYSTEMS (sizeof(sys_types) / sizeof(struct systypes)) + +/* + * ARC Bios trampoline code. + */ +#define ARC_Call(Name,Offset) \ +__asm__("\n" \ +" .text\n" \ +" .ent " #Name "\n" \ +" .align 3\n" \ +" .set noreorder\n" \ +" .globl " #Name "\n" \ +#Name":\n" \ +" lw $2, 0x80001020\n"\ +" lw $2," #Offset "($2)\n"\ +" jr $2\n" \ +" nop\n" \ +" .end " #Name "\n" ); + +ARC_Call(Bios_Load, 0x00); +ARC_Call(Bios_Invoke, 0x04); +ARC_Call(Bios_Execute, 0x08); +ARC_Call(Bios_Halt, 0x0c); +ARC_Call(Bios_PowerDown, 0x10); +ARC_Call(Bios_Restart, 0x14); +ARC_Call(Bios_Reboot, 0x18); +ARC_Call(Bios_EnterInteractiveMode, 0x1c); +ARC_Call(Bios_Unused1, 0x20); +ARC_Call(Bios_GetPeer, 0x24); +ARC_Call(Bios_GetChild, 0x28); +ARC_Call(Bios_GetParent, 0x2c); +ARC_Call(Bios_GetConfigurationData, 0x30); +ARC_Call(Bios_AddChild, 0x34); +ARC_Call(Bios_DeleteComponent, 0x38); +ARC_Call(Bios_GetComponent, 0x3c); +ARC_Call(Bios_SaveConfiguration, 0x40); +ARC_Call(Bios_GetSystemId, 0x44); +ARC_Call(Bios_GetMemoryDescriptor, 0x48); +ARC_Call(Bios_Unused2, 0x4c); +ARC_Call(Bios_GetTime, 0x50); +ARC_Call(Bios_GetRelativeTime, 0x54); +ARC_Call(Bios_GetDirectoryEntry, 0x58); +ARC_Call(Bios_Open, 0x5c); +ARC_Call(Bios_Close, 0x60); +ARC_Call(Bios_Read, 0x64); +ARC_Call(Bios_GetReadStatus, 0x68); +ARC_Call(Bios_Write, 0x6c); +ARC_Call(Bios_Seek, 0x70); +ARC_Call(Bios_Mount, 0x74); +ARC_Call(Bios_GetEnvironmentVariable, 0x78); +ARC_Call(Bios_SetEnvironmentVariable, 0x7c); +ARC_Call(Bios_GetFileInformation, 0x80); +ARC_Call(Bios_SetFileInformation, 0x84); +ARC_Call(Bios_FlushAllCaches, 0x88); +ARC_Call(Bios_TestUnicodeCharacter, 0x8c); +ARC_Call(Bios_GetDisplayStatus, 0x90); + +/* + * Simple getchar/putchar interface. + */ + +int +bios_getchar() +{ + char buf[4]; + int cnt; + + if (Bios_Read(0, &buf[0], 1, &cnt) != 0) + return(-1); + return(buf[0] & 255); +} + +void +bios_putchar(c) +char c; +{ + char buf[4]; + int cnt; + + if (c == '\n') { + buf[0] = '\r'; + buf[1] = c; + cnt = 2; + if (displayinfo.CursorYPosition < displayinfo.CursorMaxYPosition) + displayinfo.CursorYPosition++; + } + else { + buf[0] = c; + cnt = 1; + } + Bios_Write(1, &buf[0], cnt, &cnt); +} + +void +bios_putstring(s) +char *s; +{ + while (*s) { + bios_putchar(*s++); + } +} + +/* + * Get memory descriptor for the memory configuration and + * create a layout database used by pmap init to set up + * the memory system. Note that kernel option "MACHINE_NONCONTIG" + * must be set for systems with non contigous physical memory. + * + * Concatenate obvious adjecent segments. + */ +void +bios_configure_memory() +{ + arc_mem_t *descr = 0; + struct phys_mem_desc *m; + vaddr_t seg_start, seg_end; + int i; + char str[100]; + + descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); + while(descr != 0) { + + seg_start = descr->BasePage; + seg_end = seg_start + descr->PageCount; + + switch (descr->Type) { + case BadMemory: /* Have no use for theese */ + break; + +#if 0 + case ExeceptionBlock: + case SystemParameterBlock: + case FirmwareTemporary: + case FirmwarePermanent: +#endif + case FreeMemory: + case FreeContigous: + physmem += descr->PageCount; + m = 0; + for (i = 0; i < MAXMEMSEGS; i++) { + if (mem_layout[i].mem_last_page == 0) { + if (m == 0) + m = &mem_layout[i]; /* free */ + } + else if (seg_end == mem_layout[i].mem_first_page) { + m = &mem_layout[i]; + m->mem_first_page = seg_start; + } + else if (mem_layout[i].mem_last_page == seg_start) { + m = &mem_layout[i]; + m->mem_last_page = seg_end; + } + } + if (m && m->mem_first_page == 0) { + m->mem_first_page = seg_start; + m->mem_last_page = seg_end; + } + break; + + case LoadedProgram: /* This is the loaded kernel */ + physmem += descr->PageCount; + break; + + default: /* Unknown type, leave it alone... */ + break; + } + descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); + } + +#ifdef DEBUG_MEM_LAYOUT + for ( i = 0; i < MAXMEMSEGS; i++) { + if (mem_layout[i].mem_first_page) { + snprintf(str, sizeof(str), "MEM %d, 0x%x to 0x%x\n",i, + mem_layout[i].mem_first_page * 4096, + mem_layout[i].mem_last_page * 4096); + bios_putstring(str); + } + } +#endif +} + +/* + * Find out system type. + */ +int +bios_get_system_type() +{ + arc_config_t *cf; + arc_sid_t *sid; + int i; + + if ((bios_base->magic != ARC_PARAM_BLK_MAGIC) && + (bios_base->magic != ARC_PARAM_BLK_MAGIC_BUG)) { + return(-1); /* This is not an ARC system */ + } + + sid = (arc_sid_t *)Bios_GetSystemId(); + cf = (arc_config_t *)Bios_GetChild(NULL); + if (cf) { + for (i = 0; i < KNOWNSYSTEMS; i++) { + if (strcmp(sys_types[i].sys_name, cf->id) != 0) + continue; + if (sys_types[i].sys_vend && + strncmp(sys_types[i].sys_vend, sid->vendor, 8) != 0) + continue; + return (sys_types[i].sys_type); /* Found it. */ + } + } + + bios_putstring("UNIDENTIFIED SYSTEM `"); + if (cf) + bios_putstring(cf->id); + else + bios_putstring("????????"); + bios_putstring("' VENDOR `"); + sid->vendor[8] = 0; + bios_putstring(sid->vendor); + bios_putstring("'. Please contact OpenBSD (www.openbsd.org).\n"); + bios_putstring("Reset system to restart!\n"); + while(1); +} + +/* + * Incomplete version of bios_ident + */ +void +bios_ident() +{ + sys_config.system_type = bios_get_system_type(); + if (sys_config.system_type < 0) { + return; + } + bios_configure_memory(); +#ifdef __arc__ + displayinfo = *(arc_dsp_stat_t *)Bios_GetDisplayStatus(1); +#endif +} + +/* + * Return geometry of the display. Used by pccons.c to set up the + * display configuration. + */ +void +bios_display_info(xpos, ypos, xsize, ysize) + int *xpos; + int *ypos; + int *xsize; + int *ysize; +{ +#ifdef __arc__ + *xpos = displayinfo.CursorXPosition; + *ypos = displayinfo.CursorYPosition; + *xsize = displayinfo.CursorMaxXPosition; + *ysize = displayinfo.CursorMaxYPosition; +#endif +} + |