diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2008-02-18 19:43:29 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2008-02-18 19:43:29 +0000 |
commit | 2f527e5bb6d3571d44a176399bb9e302e17a088b (patch) | |
tree | ae98847f19f3e69a08ce7f6b14fbb51a9a15266a /sys | |
parent | 8e7841f3d46866105d6a4bc0f50e7719b747daa2 (diff) |
More 64-bit ARCBios friendliness, correctly identify a 64 bit system, such
as the Octane; joint work with jsing@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/mips64/include/arcbios.h | 16 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/arcbios.c | 76 |
2 files changed, 64 insertions, 28 deletions
diff --git a/sys/arch/mips64/include/arcbios.h b/sys/arch/mips64/include/arcbios.h index 519ce9087bb..3b5dd11a1d5 100644 --- a/sys/arch/mips64/include/arcbios.h +++ b/sys/arch/mips64/include/arcbios.h @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.h,v 1.8 2007/12/14 10:13:17 jsing Exp $ */ +/* $OpenBSD: arcbios.h,v 1.9 2008/02/18 19:43:27 miod Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * @@ -111,6 +111,20 @@ typedef struct arc_config int32_t id; } arc_config_t; +typedef struct arc_config64 +{ + 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_int64_t key; + u_int64_t affinity_mask; + u_int64_t config_data_len; + u_int64_t id_len; + int64_t id; +} arc_config64_t; + typedef enum arc_status { arc_ESUCCESS, /* Success */ diff --git a/sys/arch/mips64/mips64/arcbios.c b/sys/arch/mips64/mips64/arcbios.c index 9671ebec7bf..f82425aeb2b 100644 --- a/sys/arch/mips64/mips64/arcbios.c +++ b/sys/arch/mips64/mips64/arcbios.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arcbios.c,v 1.11 2007/12/14 10:13:17 jsing Exp $ */ +/* $OpenBSD: arcbios.c,v 1.12 2008/02/18 19:43:28 miod Exp $ */ /*- * Copyright (c) 1996 M. Warner Losh. All rights reserved. * Copyright (c) 1996-2004 Opsycon AB. All rights reserved. @@ -75,7 +75,8 @@ static struct systypes { { NULL, "SGI-IP25", SGI_POWER10 }, { NULL, "SGI-IP26", SGI_POWERI }, { NULL, "SGI-IP27", SGI_O200 }, - { NULL, "SGI-IP32", SGI_O2 }, + { NULL, "SGI-IP30", SGI_OCTANE }, + { NULL, "SGI-IP32", SGI_O2 } }; #define KNOWNSYSTEMS (sizeof(sys_types) / sizeof(struct systypes)) @@ -210,14 +211,13 @@ bios_printf(const char *fmt, ...) void bios_configure_memory() { - arc_mem_t *descr = 0; + arc_mem_t *descr = NULL; struct phys_mem_desc *m; vaddr_t seg_start, seg_end; int i; descr = (arc_mem_t *)Bios_GetMemoryDescriptor(descr); - while(descr != 0) { - + while (descr != NULL) { seg_start = descr->BasePage; seg_end = seg_start + descr->PageCount; @@ -228,10 +228,10 @@ bios_configure_memory() case FreeMemory: case FreeContigous: physmem += descr->PageCount; - m = 0; + m = NULL; for (i = 0; i < MAXMEMSEGS; i++) { if (mem_layout[i].mem_last_page == 0) { - if (m == 0) + if (m == NULL) m = &mem_layout[i]; /* free */ } else if (seg_end == mem_layout[i].mem_first_page) { @@ -268,7 +268,7 @@ bios_configure_memory() } #ifdef DEBUG_MEM_LAYOUT - for ( i = 0; i < MAXMEMSEGS; i++) { + for (i = 0; i < MAXMEMSEGS; i++) { if (mem_layout[i].mem_first_page) { bios_printf("MEM %d, 0x%x to 0x%x\n",i, mem_layout[i].mem_first_page * 4096, @@ -286,6 +286,8 @@ bios_get_system_type() { arc_config_t *cf; arc_sid_t *sid; + char *sysid; + int sysid_len; int i; /* @@ -308,26 +310,41 @@ bios_get_system_type() 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, (char *)(long)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. */ + if (cf != NULL) { + if (bios_is_32bit) { + sysid = (char *)(long)cf->id; + sysid_len = cf->id_len; + } else { + sysid = (char *)((arc_config64_t *)cf)->id; + sysid_len = ((arc_config64_t *)cf)->id_len; + } + + if (sysid_len > 0 && sysid != NULL) { + sysid_len--; + for (i = 0; i < KNOWNSYSTEMS; i++) { + if (strlen(sys_types[i].sys_name) !=sysid_len) + continue; + if (strncmp(sys_types[i].sys_name, sysid, + sysid_len) != 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. */ + } } + } else { #if defined(TGT_ORIGIN200) || defined(TGT_ORIGIN2000) - } else if (IP27_KLD_KLCONFIG(0)->magic == IP27_KLDIR_MAGIC) { - /* If we find a kldir assume IP27 */ - return SGI_O200; + if (IP27_KLD_KLCONFIG(0)->magic == IP27_KLDIR_MAGIC) { + /* If we find a kldir assume IP27 */ + return SGI_O200; + } #endif } - sid->vendor[8] = 0; - sid->prodid[8] = 0; - bios_printf("UNRECOGNIZED SYSTEM '%s' VENDOR '%s' PRODUCT '%s'\n", - cf ? (char *)(long)cf->id : "??", sid->vendor, sid->prodid); + bios_printf("UNRECOGNIZED SYSTEM '%s' VENDOR '%8.8s' PRODUCT '%8.8s'\n", + cf == NULL ? "??" : sysid, sid->vendor, sid->prodid); bios_printf("See the www.openbsd.org for further information.\n"); bios_printf("Halting system!\n"); Bios_Halt(); @@ -342,11 +359,16 @@ void bios_ident() { sys_config.system_type = bios_get_system_type(); - if (sys_config.system_type < 0 || sys_config.system_type == SGI_O200) { - return; + /* Get memory configuration from bios if applicable */ + switch (sys_config.system_type) { + case SGI_O200: + case SGI_OCTANE: + break; + default: + if (sys_config.system_type >= 0) + bios_configure_memory(); + break; } - /* If not an IP27 platform, get memory configuration from bios */ - bios_configure_memory(); #ifdef __arc__ displayinfo = *(arc_dsp_stat_t *)Bios_GetDisplayStatus(1); #endif |