PERFORCE change 29830 for review
Juli Mallett
jmallett at FreeBSD.org
Sat Apr 26 15:56:38 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=29830
Change 29830 by jmallett at 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 <machine/hwfunc.h>
#include <machine/md_var.h>
+#include <platform/models.h>
+
#include <dev/arcbios/arcbios.h>
#include <dev/arcbios/arcbiosvar.h>
#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));
}
More information about the p4-projects
mailing list