Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sandpoint Netboot generates a BTINFO_PRODFAMILY boo...
details: https://anonhg.NetBSD.org/src/rev/8da3285d98b8
branches: trunk
changeset: 755036:8da3285d98b8
user: phx <phx%NetBSD.org@localhost>
date: Thu May 20 19:27:25 2010 +0000
description:
Netboot generates a BTINFO_PRODFAMILY boot-info which specifies the family
name of the board. The kernel uses this information to make a new sysctl
entry called machdep.prodfamily.
diffstat:
sys/arch/sandpoint/include/bootinfo.h | 8 +++-
sys/arch/sandpoint/sandpoint/machdep.c | 23 ++++++++++-
sys/arch/sandpoint/stand/netboot/main.c | 67 ++++++++++++++++++++------------
3 files changed, 70 insertions(+), 28 deletions(-)
diffs (186 lines):
diff -r 072c2c4a1e6a -r 8da3285d98b8 sys/arch/sandpoint/include/bootinfo.h
--- a/sys/arch/sandpoint/include/bootinfo.h Thu May 20 18:23:59 2010 +0000
+++ b/sys/arch/sandpoint/include/bootinfo.h Thu May 20 19:27:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootinfo.h,v 1.6 2010/05/18 15:07:50 phx Exp $ */
+/* $NetBSD: bootinfo.h,v 1.7 2010/05/20 19:27:25 phx Exp $ */
/*
* Copyright (c) 1997
@@ -43,6 +43,7 @@
#define BTINFO_BOOTPATH 5
#define BTINFO_ROOTDEVICE 6
#define BTINFO_NET 7
+#define BTINFO_PRODFAMILY 8
struct btinfo_magic {
struct btinfo_common common;
@@ -84,6 +85,11 @@
uint8_t mac_address[6];
};
+struct btinfo_prodfamily {
+ struct btinfo_common common;
+ char name[24];
+};
+
#define BOOTINFO_MAXSIZE 4096
#ifdef _KERNEL
diff -r 072c2c4a1e6a -r 8da3285d98b8 sys/arch/sandpoint/sandpoint/machdep.c
--- a/sys/arch/sandpoint/sandpoint/machdep.c Thu May 20 18:23:59 2010 +0000
+++ b/sys/arch/sandpoint/sandpoint/machdep.c Thu May 20 19:27:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.49 2009/11/27 03:23:13 rmind Exp $ */
+/* $NetBSD: machdep.c,v 1.50 2010/05/20 19:27:25 phx Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.49 2009/11/27 03:23:13 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.50 2010/05/20 19:27:25 phx Exp $");
#include "opt_compat_netbsd.h"
#include "opt_ddb.h"
@@ -585,3 +585,22 @@
kcomcnpollc(dev_t dev, int on)
{
}
+
+SYSCTL_SETUP(sysctl_machdep_prodfamily, "sysctl machdep prodfamily")
+{
+ const struct sysctlnode *mnode, *node;
+ struct btinfo_prodfamily *pfam;
+
+ pfam = lookup_bootinfo(BTINFO_PRODFAMILY);
+ if (pfam != NULL) {
+ sysctl_createv(NULL, 0, NULL, &mnode,
+ CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,
+ NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL);
+
+ sysctl_createv(NULL, 0, &mnode, &node,
+ CTLFLAG_PERMANENT, CTLTYPE_STRING, "prodfamily",
+ SYSCTL_DESCR("Board family name."),
+ NULL, 0, pfam->name, 0,
+ CTL_CREATE, CTL_EOL);
+ }
+}
diff -r 072c2c4a1e6a -r 8da3285d98b8 sys/arch/sandpoint/stand/netboot/main.c
--- a/sys/arch/sandpoint/stand/netboot/main.c Thu May 20 18:23:59 2010 +0000
+++ b/sys/arch/sandpoint/stand/netboot/main.c Thu May 20 19:27:25 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.31 2010/05/19 15:05:58 phx Exp $ */
+/* $NetBSD: main.c,v 1.32 2010/05/20 19:27:26 phx Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -57,6 +57,23 @@
{ "debug", AB_DEBUG }
};
+static const struct prodfamily {
+ int id;
+ const char *family;
+ const char *verbose;
+} prodfamilies[] = {
+ { BRD_SANDPOINTX2, "sandpointx2", "Sandpoint X2" },
+ { BRD_SANDPOINTX3, "sandpointx3", "Sandpoint X3" },
+ { BRD_ENCOREPP1, "encorepp1", "EnCore PP1"},
+ { BRD_KUROBOX, "kurobox", "KuroBox"},
+ { BRD_QNAPTS101, "qnap", "QNAP TS-101"},
+ { BRD_SYNOLOGY, "synology", "Synology DS"},
+ { BRD_STORCENTER, "iomega", "IOMEGA Storcenter"},
+ { BRD_UNKNOWN, "unknown", "Unknown board" }
+};
+
+static const struct prodfamily *get_prodfamily(void);
+
void *bootinfo; /* low memory reserved to pass bootinfo structures */
int bi_size; /* BOOTINFO_MAXSIZE */
char *bi_next;
@@ -87,6 +104,8 @@
struct btinfo_bootpath bi_path;
struct btinfo_rootdevice bi_rdev;
struct btinfo_net bi_net;
+ struct btinfo_prodfamily bi_fam;
+ const struct prodfamily *pfam;
unsigned long marks[MARK_MAX];
unsigned lata[1][2], lnif[1][2];
unsigned memsize, tag;
@@ -98,23 +117,9 @@
printf("\n");
printf(">> NetBSD/sandpoint Boot, Revision %s\n", bootprog_rev);
printf(">> (%s, %s)\n", bootprog_maker, bootprog_date);
- switch (brdtype) {
- case BRD_SANDPOINTX3:
- printf("Sandpoint X3"); break;
- case BRD_ENCOREPP1:
- printf("Encore PP1"); break;
- case BRD_QNAPTS101:
- printf("QNAP TS-101"); break;
- case BRD_KUROBOX:
- printf("Kuro Box"); break;
- case BRD_SYNOLOGY:
- printf("Synology DS"); break;
- case BRD_STORCENTER:
- printf("IOMEGA StorCenter"); break;
- default:
- printf("Unknown board"); break;
- }
- printf(", cpu %u MHz, bus %u MHz, %dMB SDRAM\n",
+
+ pfam = get_prodfamily();
+ printf("%s, cpu %u MHz, bus %u MHz, %dMB SDRAM\n", pfam->verbose,
cpuclock / 1000000, busclock / 1000000, memsize >> 20);
n = pcilookup(PCI_CLASS_IDE, lata, sizeof(lata)/sizeof(lata[0]));
@@ -185,20 +190,21 @@
snprintf(bi_path.bootpath, sizeof(bi_path.bootpath), bootfile);
snprintf(bi_rdev.devname, sizeof(bi_rdev.devname), rootdev);
bi_rdev.cookie = tag; /* PCI tag for fxp netboot case */
- if (brdtype == BRD_SYNOLOGY) {
- /* need to set MAC address for Marvell-SKnet */
- strcpy(bi_net.devname, "sk");
- memcpy(bi_net.mac_address, en, sizeof(en));
- bi_net.cookie = tag;
- }
+ snprintf(bi_fam.name, sizeof(bi_fam.name), pfam->family);
bi_add(&bi_cons, BTINFO_CONSOLE, sizeof(bi_cons));
bi_add(&bi_mem, BTINFO_MEMORY, sizeof(bi_mem));
bi_add(&bi_clk, BTINFO_CLOCK, sizeof(bi_clk));
bi_add(&bi_path, BTINFO_BOOTPATH, sizeof(bi_path));
bi_add(&bi_rdev, BTINFO_ROOTDEVICE, sizeof(bi_rdev));
- if (brdtype == BRD_SYNOLOGY)
+ bi_add(&bi_fam, BTINFO_PRODFAMILY, sizeof(bi_fam));
+ if (brdtype == BRD_SYNOLOGY) {
+ /* need to set MAC address for Marvell-SKnet */
+ strcpy(bi_net.devname, "sk");
+ memcpy(bi_net.mac_address, en, sizeof(en));
+ bi_net.cookie = tag;
bi_add(&bi_net, BTINFO_NET, sizeof(bi_net));
+ }
printf("entry=%p, ssym=%p, esym=%p\n",
(void *)marks[MARK_ENTRY],
@@ -220,6 +226,17 @@
_rtt();
}
+static const struct prodfamily *
+get_prodfamily(void)
+{
+ const struct prodfamily *pfam;
+
+ for (pfam = prodfamilies; pfam->id != BRD_UNKNOWN; pfam++)
+ if (pfam->id == brdtype)
+ break;
+ return pfam;
+}
+
void
bi_init(void *addr)
{
Home |
Main Index |
Thread Index |
Old Index