Remove openbios dependent code from ibm4xx/ibm40x dependent module.

This commit is contained in:
shige 2005-01-17 17:19:36 +00:00
parent 6e7077020b
commit ce880a5946
3 changed files with 47 additions and 52 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibm40x_machdep.c,v 1.2 2003/12/30 12:33:19 pk Exp $ */ /* $NetBSD: ibm40x_machdep.c,v 1.3 2005/01/17 17:19:36 shige Exp $ */
/* /*
* Copyright 2001, 2002 Wasabi Systems, Inc. * Copyright 2001, 2002 Wasabi Systems, Inc.
@ -67,7 +67,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ibm40x_machdep.c,v 1.2 2003/12/30 12:33:19 pk Exp $"); __KERNEL_RCSID(0, "$NetBSD: ibm40x_machdep.c,v 1.3 2005/01/17 17:19:36 shige Exp $");
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
#include "opt_ddb.h" #include "opt_ddb.h"
@ -130,9 +130,6 @@ char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
struct mem_region physmemr[MEMREGIONS]; /* Hard code memory */ struct mem_region physmemr[MEMREGIONS]; /* Hard code memory */
struct mem_region availmemr[MEMREGIONS];/* Who's supposed to set these up? */ struct mem_region availmemr[MEMREGIONS];/* Who's supposed to set these up? */
struct board_cfg_data board_data;
struct propdb *board_info = NULL;
extern struct user *proc0paddr; extern struct user *proc0paddr;
paddr_t msgbuf_paddr; paddr_t msgbuf_paddr;
@ -140,21 +137,19 @@ vaddr_t msgbuf_vaddr;
void void
ibm4xx_init_board_data(void *info_block, u_int startkernel) ibm40x_memsize_init(u_int memsize, u_int startkernel)
{ {
/* Initialize cache info for memcpy, etc. */ /* Initialize cache info for memcpy, etc. */
cpu_probe_cache(); cpu_probe_cache();
/* Save info block */
memcpy(&board_data, info_block, sizeof(board_data));
memset(physmemr, 0, sizeof physmemr); memset(physmemr, 0, sizeof physmemr);
memset(availmemr, 0, sizeof availmemr); memset(availmemr, 0, sizeof availmemr);
physmemr[0].start = 0; physmemr[0].start = 0;
physmemr[0].size = board_data.mem_size & ~PGOFSET; physmemr[0].size = memsize & ~PGOFSET;
/* Lower memory reserved by eval board BIOS */ /* Lower memory reserved by eval board BIOS */
availmemr[0].start = startkernel; availmemr[0].start = startkernel;
availmemr[0].size = board_data.mem_size - availmemr[0].start; availmemr[0].size = memsize - availmemr[0].start;
} }
void void
@ -374,27 +369,6 @@ ibm4xx_startup(const char *model)
printf("avail memory = %s\n", pbuf); printf("avail memory = %s\n", pbuf);
} }
void
ibm4xx_setup_propdb(void)
{
/*
* Set up the board properties database.
*/
if (!(board_info = propdb_create("board info")))
panic("Cannot create board info database");
if (board_info_set("mem-size", &board_data.mem_size,
sizeof(&board_data.mem_size), PROP_CONST, 0))
panic("setting mem-size");
if (board_info_set("sip0-mac-addr", &board_data.mac_address_pci,
sizeof(&board_data.mac_address_pci), PROP_CONST, 0))
panic("setting sip0-mac-addr");
if (board_info_set("processor-frequency", &board_data.processor_speed,
sizeof(&board_data.processor_speed), PROP_CONST, 0))
panic("setting processor-frequency");
}
/* /*
* Crash dump handling. * Crash dump handling.
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibm4xx_autoconf.c,v 1.1 2005/01/13 17:12:28 shige Exp $ */ /* $NetBSD: ibm4xx_autoconf.c,v 1.2 2005/01/17 17:19:36 shige Exp $ */
/* Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $ */ /* Original Tag: ibm4xxgpx_autoconf.c,v 1.2 2004/10/23 17:12:22 thorpej Exp $ */
/* /*
@ -33,13 +33,16 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.1 2005/01/13 17:12:28 shige Exp $"); __KERNEL_RCSID(0, "$NetBSD: ibm4xx_autoconf.c,v 1.2 2005/01/17 17:19:36 shige Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/device.h> #include <sys/device.h>
#include <sys/systm.h> #include <sys/systm.h>
#include <net/if.h>
#include <net/if_ether.h>
#include <machine/cpu.h> #include <machine/cpu.h>
void void
@ -50,14 +53,27 @@ ibm4xx_device_register(struct device *dev, void *aux)
if (strcmp(dev->dv_cfdata->cf_name, "emac") == 0 && if (strcmp(dev->dv_cfdata->cf_name, "emac") == 0 &&
strcmp(parent->dv_cfdata->cf_name, "opb") == 0) { strcmp(parent->dv_cfdata->cf_name, "opb") == 0) {
/* Set the mac-addr of the on-chip Ethernet. */ /* Set the mac-addr of the on-chip Ethernet. */
/* XXX 405GP/405GPr only has one; what about CPUs with two? */
/* XXX board_data is for IBM ROM Monitor 1.x with 405GP */ if (dev->dv_unit < 10) {
if (prop_set(dev_propdb, dev, "mac-addr", uint8_t enaddr[ETHER_ADDR_LEN];
&board_data.mac_address_local, unsigned char prop_name[15];
sizeof(board_data.mac_address_local),
PROP_CONST, 0) != 0) snprintf(prop_name, sizeof(prop_name),
printf("WARNING: unable to set mac-addr " "emac%d-mac-addr", dev->dv_unit);
"property for %s\n", dev->dv_xname);
if (board_info_get(prop_name,
enaddr, sizeof(enaddr)) == -1) {
printf("WARNING: unable to get mac-addr "
"property from board properties\n");
return;
}
if (prop_set(dev_propdb, dev, "mac-addr",
enaddr, sizeof(enaddr),
PROP_ARRAY, 0) != 0)
printf("WARNING: unable to set mac-addr "
"property for %s\n", dev->dv_xname);
}
return; return;
} }
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.7 2005/01/13 17:16:33 shige Exp $ */ /* $NetBSD: cpu.h,v 1.8 2005/01/17 17:19:36 shige Exp $ */
/* /*
* Copyright 2002 Wasabi Systems, Inc. * Copyright 2002 Wasabi Systems, Inc.
@ -60,7 +60,8 @@
#if defined(_KERNEL) #if defined(_KERNEL)
extern char bootpath[]; extern char bootpath[];
void ibm4xx_init_board_data(void *, u_int); /* export from ibm4xx/ibm40x_machdep.c */
void ibm40x_memsize_init(u_int, u_int);
void ibm4xx_init(void (*)(void)); void ibm4xx_init(void (*)(void));
void ibm4xx_startup(const char *); void ibm4xx_startup(const char *);
void ibm4xx_setup_propdb(void); void ibm4xx_setup_propdb(void);
@ -82,6 +83,17 @@ extern void ibm4xx_device_register(struct device *dev, void *aux);
#include <powerpc/cpu.h> #include <powerpc/cpu.h>
/* Board info database stuff */
extern struct propdb *board_info;
extern void board_info_init(void);
#define board_info_set(n, v, l, f, w) \
prop_set(board_info, 0, (n), (v), (l), (f), (w))
#define board_info_get(n, v, l) \
prop_get(board_info, 0, (n), (v), (l), NULL)
/*****************************************************************************/
/* THIS CODE IS OBSOLETE. WILL BE REMOVED */
/* /*
* Board configuration structure from the OpenBIOS. * Board configuration structure from the OpenBIOS.
*/ */
@ -97,13 +109,6 @@ struct board_cfg_data {
}; };
extern struct board_cfg_data board_data; extern struct board_cfg_data board_data;
/*****************************************************************************/
/* Board info database stuff */
extern struct propdb *board_info;
#define board_info_set(n, v, l, f, w) \
prop_set(board_info, 0, (n), (v), (l), (f), (w))
#define board_info_get(n, v, l) \
prop_get(board_info, 0, (n), (v), (l), NULL)
#endif /* _IBM4XX_CPU_H_ */ #endif /* _IBM4XX_CPU_H_ */