brdsetup() cleanup by Toru Nishimura.
Put all board-relevant data into a structure. A few modifications by myself to use the new structure for generating the BTINFO_PRODFAMILY boot node.
This commit is contained in:
parent
48c2f22f51
commit
1286c420be
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: globals.h,v 1.16 2010/05/17 17:50:08 phx Exp $ */
|
||||
/* $NetBSD: globals.h,v 1.17 2010/05/20 20:18:51 phx Exp $ */
|
||||
|
||||
/* clock feed */
|
||||
#ifndef EXT_CLK_FREQ
|
||||
@ -16,15 +16,19 @@ extern int brdtype;
|
||||
#define BRD_STORCENTER 103
|
||||
#define BRD_UNKNOWN -1
|
||||
|
||||
#ifndef CONSNAME
|
||||
#define CONSNAME "com"
|
||||
#endif
|
||||
#ifndef CONSPORT
|
||||
#define CONSPORT 0x3f8
|
||||
#endif
|
||||
#ifndef CONSSPEED
|
||||
#define CONSSPEED 115200
|
||||
#endif
|
||||
struct brdprop {
|
||||
const char *family;
|
||||
const char *verbose;
|
||||
int brdtype;
|
||||
uint32_t extclk;
|
||||
char *consname;
|
||||
int consport;
|
||||
int consspeed;
|
||||
void (*setup)(struct brdprop *);
|
||||
void (*brdfix)(struct brdprop *);
|
||||
void (*pcifix)(struct brdprop *);
|
||||
void (*reset)(void);
|
||||
};
|
||||
|
||||
extern char *consname;
|
||||
extern int consport;
|
||||
@ -32,6 +36,8 @@ extern int consspeed;
|
||||
extern int ticks_per_sec;
|
||||
extern uint32_t cpuclock, busclock;
|
||||
|
||||
/* board specific support code */
|
||||
struct brdprop *brd_lookup(int);
|
||||
unsigned mpc107memsize(void);
|
||||
void read_mac_from_flash(uint8_t *);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.32 2010/05/20 19:27:26 phx Exp $ */
|
||||
/* $NetBSD: main.c,v 1.33 2010/05/20 20:18:51 phx Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||
@ -57,23 +57,6 @@ static const struct bootarg {
|
||||
{ "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;
|
||||
@ -89,9 +72,9 @@ void bi_add(void *, int, int);
|
||||
extern char bootprog_rev[], bootprog_maker[], bootprog_date[];
|
||||
|
||||
int brdtype;
|
||||
char *consname = CONSNAME;
|
||||
int consport = CONSPORT;
|
||||
int consspeed = CONSSPEED;
|
||||
char *consname;
|
||||
int consport;
|
||||
int consspeed;
|
||||
int ticks_per_sec;
|
||||
uint32_t busclock, cpuclock;
|
||||
|
||||
@ -105,7 +88,7 @@ main(int argc, char *argv[])
|
||||
struct btinfo_rootdevice bi_rdev;
|
||||
struct btinfo_net bi_net;
|
||||
struct btinfo_prodfamily bi_fam;
|
||||
const struct prodfamily *pfam;
|
||||
struct brdprop *brdprop;
|
||||
unsigned long marks[MARK_MAX];
|
||||
unsigned lata[1][2], lnif[1][2];
|
||||
unsigned memsize, tag;
|
||||
@ -118,8 +101,8 @@ main(int argc, char *argv[])
|
||||
printf(">> NetBSD/sandpoint Boot, Revision %s\n", bootprog_rev);
|
||||
printf(">> (%s, %s)\n", bootprog_maker, bootprog_date);
|
||||
|
||||
pfam = get_prodfamily();
|
||||
printf("%s, cpu %u MHz, bus %u MHz, %dMB SDRAM\n", pfam->verbose,
|
||||
brdprop = brd_lookup(brdtype);
|
||||
printf("%s, cpu %u MHz, bus %u MHz, %dMB SDRAM\n", brdprop->verbose,
|
||||
cpuclock / 1000000, busclock / 1000000, memsize >> 20);
|
||||
|
||||
n = pcilookup(PCI_CLASS_IDE, lata, sizeof(lata)/sizeof(lata[0]));
|
||||
@ -190,7 +173,7 @@ main(int argc, char *argv[])
|
||||
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 */
|
||||
snprintf(bi_fam.name, sizeof(bi_fam.name), pfam->family);
|
||||
snprintf(bi_fam.name, sizeof(bi_fam.name), brdprop->family);
|
||||
|
||||
bi_add(&bi_cons, BTINFO_CONSOLE, sizeof(bi_cons));
|
||||
bi_add(&bi_mem, BTINFO_MEMORY, sizeof(bi_mem));
|
||||
@ -226,17 +209,6 @@ main(int argc, char *argv[])
|
||||
_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)
|
||||
{
|
||||
|
@ -1,3 +1,5 @@
|
||||
1.0 initial version
|
||||
1.1 PCI autoconf for multiple NIC device drivers
|
||||
1.2 Synology-DS support, Marvell-Yukon driver, fixed aligned alloc
|
||||
1.3 allow to have boot options, brdsetup.c cleanup to make brdtype
|
||||
maintainance more confortable
|
||||
|
Loading…
Reference in New Issue
Block a user