From owner-p4-projects@FreeBSD.ORG Sat Apr 26 15:56:37 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1DA2137B404; Sat, 26 Apr 2003 15:56:37 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A414937B401 for ; Sat, 26 Apr 2003 15:56:36 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4031243F75 for ; Sat, 26 Apr 2003 15:56:36 -0700 (PDT) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h3QMua0U087018 for ; Sat, 26 Apr 2003 15:56:36 -0700 (PDT) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3QMuZSB087008 for perforce@freebsd.org; Sat, 26 Apr 2003 15:56:35 -0700 (PDT) Date: Sat, 26 Apr 2003 15:56:35 -0700 (PDT) Message-Id: <200304262256.h3QMuZSB087008@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 29830 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Apr 2003 22:56:38 -0000 http://perforce.freebsd.org/chv.cgi?CH=29830 Change 29830 by jmallett@jmallett_dalek on 2003/04/26 15:56:10 Move ip22 stubbing out to its own file, fill out subtype, type, board revision, and so on. Do some simple memory probing. Affected files ... .. //depot/projects/mips/sys/conf/files.mips#13 edit .. //depot/projects/mips/sys/mips/sgimips/ip22.c#1 add .. //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#8 edit .. //depot/projects/mips/sys/mips/sgimips/models.h#1 add Differences ... ==== //depot/projects/mips/sys/conf/files.mips#13 (text+ko) ==== @@ -25,6 +25,9 @@ mips/sgimips/clock.c optional sgimips mips/sgimips/machdep_sgimips.c optional sgimips +# This stanza is model files, per platform then per model. +mips/sgimips/ip22.c optional sgimips ip22 + # This stanza is device files. dev/arcbios/arcbios.c optional arcbios dev/arcbios/arcbios_tty.c optional arcbios ==== //depot/projects/mips/sys/mips/sgimips/machdep_sgimips.c#8 (text+ko) ==== @@ -34,21 +34,25 @@ #include #include +#include + #include #include #include "opt_model.h" -static void ip22_init(void); - struct machine_type { const char *identifier; void (*init)(void); + int type; } machines[] = { - { "SGI-IP22", ip22_init }, - { NULL, NULL } + { "SGI-IP22", ip22_init, MACH_SGI_IP22 }, + { NULL, NULL, 0 } }; +int arcsmem; +int mach_type, mach_subtype, mach_boardrev; + void platform_halt(void) { @@ -64,40 +68,60 @@ void platform_start(int argc, char **argv) { + struct arcbios_mem *mem; struct machine_type *mtp; const char *cpufreq; + int first, i, last, size; /* * Initialise the ARCBIOS stuff. */ arcbios_init(MIPS_PHYS_TO_KSEG1(0x00001000)); arcbios_cnattach(); - printf("See MIPS Run\n"); cpufreq = ARCBIOS->GetEnvironmentVariable("cpufreq"); if (cpufreq == NULL) panic("$cpufreq not set"); - printf("%s at %sMHz\n", arcbios_system_identifier, cpufreq); - for (mtp = machines; mtp->identifier != NULL; mtp++) { if (strcmp(mtp->identifier, arcbios_system_identifier) == 0) break; } if (mtp->identifier == NULL) printf("Warning: unsupported system, nothing will work.\n"); - else + else { + mach_type = mtp->type; (*mtp->init)(); + } + + printf("%s (IP%d), subtype %x, board rev. %x at %sMHz\n", + arcbios_system_identifier, mach_type, mach_subtype, mach_boardrev, cpufreq); + + mem = NULL; + for (i = 0;; i++) { + mem = ARCBIOS->GetMemoryDescriptor(mem); + + if (mem == NULL) + break; - cpu_reset(); -} + first = round_page(mem->BasePage * ARCBIOS_PAGESIZE); + last = trunc_page(first + mem->PageCount * ARCBIOS_PAGESIZE); + size = last - first; -static void -ip22_init(void) -{ -#ifdef IP22 - ; -#else - printf("Warning: IP22 support not compiled in.\n"); -#endif + switch (mem->Type) { + case ARCBIOS_MEM_FirmwareTemporary: + case ARCBIOS_MEM_FirmwarePermanent: + arcsmem += btoc(size); + break; + default: + printf("Memory range %0x-%0x type %d\n", + first, last, mem->Type); + break; + } + physmem += btoc(size); + } + printf("total memory = %ld (%ld MB)\n", ctob(physmem), + ctob(physmem) / (1024 * 1024)); + printf("ARCS memory = %d (%d MB)\n", ctob(arcsmem), + ctob(arcsmem) / (1024 * 1024)); }