Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Convert walnut to use powerpc/ibm4xx/openbios.
details: https://anonhg.NetBSD.org/src/rev/1caf460adfee
branches: trunk
changeset: 960826:1caf460adfee
user: rin <rin%NetBSD.org@localhost>
date: Tue Mar 30 02:04:43 2021 +0000
description:
Convert walnut to use powerpc/ibm4xx/openbios.
No functional changes.
diffstat:
sys/arch/evbppc/conf/Makefile.walnut.inc | 6 +-
sys/arch/evbppc/conf/files.walnut | 3 +-
sys/arch/evbppc/walnut/machdep.c | 73 +---------
sys/arch/evbppc/walnut/walnut_start.S | 205 -------------------------------
sys/arch/powerpc/include/ibm4xx/cpu.h | 21 +---
5 files changed, 19 insertions(+), 289 deletions(-)
diffs (truncated from 409 to 300 lines):
diff -r 177de5e8be34 -r 1caf460adfee sys/arch/evbppc/conf/Makefile.walnut.inc
--- a/sys/arch/evbppc/conf/Makefile.walnut.inc Tue Mar 30 01:57:20 2021 +0000
+++ b/sys/arch/evbppc/conf/Makefile.walnut.inc Tue Mar 30 02:04:43 2021 +0000
@@ -1,12 +1,12 @@
-# $NetBSD: Makefile.walnut.inc,v 1.10 2021/03/29 13:12:38 rin Exp $
+# $NetBSD: Makefile.walnut.inc,v 1.11 2021/03/30 02:04:43 rin Exp $
MKIMG?= ${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh
CFLAGS+=-mcpu=405
AFLAGS+=-mcpu=405
TEXTADDR?= 25000
-SYSTEM_FIRST_OBJ= walnut_start.o
-SYSTEM_FIRST_SFILE= ${THISPPC}/walnut/walnut_start.S
+SYSTEM_FIRST_OBJ= locore.o
+SYSTEM_FIRST_SFILE= ${POWERPC}/${PPCDIR}/openbios/locore.S
SYSTEM_LD_TAIL_EXTRA_EXTRA+=; \
echo ${MKIMG} $@ $@.img ; \
diff -r 177de5e8be34 -r 1caf460adfee sys/arch/evbppc/conf/files.walnut
--- a/sys/arch/evbppc/conf/files.walnut Tue Mar 30 01:57:20 2021 +0000
+++ b/sys/arch/evbppc/conf/files.walnut Tue Mar 30 02:04:43 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.walnut,v 1.18 2021/03/29 14:21:08 rin Exp $
+# $NetBSD: files.walnut,v 1.19 2021/03/30 02:04:43 rin Exp $
#
# walnut-specific configuration info
@@ -8,6 +8,7 @@
file arch/powerpc/ibm4xx/ibm4xx_autoconf.c
file arch/powerpc/ibm4xx/ibm40x_machdep.c
file arch/powerpc/ibm4xx/ibm4xx_machdep.c
+file arch/powerpc/ibm4xx/openbios/openbios.c
# Memory Disk for install kernel
file dev/md_root.c memory_disk_hooks
diff -r 177de5e8be34 -r 1caf460adfee sys/arch/evbppc/walnut/machdep.c
--- a/sys/arch/evbppc/walnut/machdep.c Tue Mar 30 01:57:20 2021 +0000
+++ b/sys/arch/evbppc/walnut/machdep.c Tue Mar 30 02:04:43 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.64 2021/03/30 01:33:50 rin Exp $ */
+/* $NetBSD: machdep.c,v 1.65 2021/03/30 02:04:44 rin Exp $ */
/*
* Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.64 2021/03/30 01:33:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.65 2021/03/30 02:04:44 rin Exp $");
#include "opt_compat_netbsd.h"
#include "opt_ddb.h"
@@ -108,6 +108,8 @@
#include <powerpc/ibm4xx/dcr4xx.h>
#include <powerpc/ibm4xx/ibm405gp.h>
+#include <powerpc/ibm4xx/openbios.h>
+
#include <powerpc/ibm4xx/pci_machdep.h>
#include <powerpc/pic/picvar.h>
@@ -139,21 +141,17 @@
void initppc(vaddr_t, vaddr_t, char *, void *);
-struct board_cfg_data board_data;
-
void
initppc(vaddr_t startkernel, vaddr_t endkernel, char *args, void *info_block)
{
+ u_int memsize;
+
/* Disable all external interrupts */
mtdcr(DCR_UIC0_BASE + DCR_UIC_ER, 0);
- /* Initialize cache info for memcpy, etc. */
- cpu_probe_cache();
-
- /* Save info block */
- memcpy(&board_data, info_block, sizeof(board_data));
-
- ibm40x_memsize_init(board_data.mem_size, startkernel);
+ /* Setup board from OpenBIOS */
+ openbios_board_init(info_block);
+ memsize = openbios_board_memsize_get();
/* Linear map kernel memory */
for (vaddr_t va = 0; va < endkernel; va += TLB_PG_SIZE) {
@@ -161,30 +159,16 @@
}
/* Map console after physmem (see pmap_tlbmiss()) */
- ppc4xx_tlb_reserve(IBM405GP_UART0_BASE,
- roundup(board_data.mem_size, TLB_PG_SIZE),
+ ppc4xx_tlb_reserve(IBM405GP_UART0_BASE, roundup(memsize, TLB_PG_SIZE),
TLB_PG_SIZE, TLB_I | TLB_G);
mtspr(SPR_TCR, 0); /* disable all timers */
+ ibm40x_memsize_init(memsize, startkernel);
ibm4xx_init(startkernel, endkernel, pic_ext_intr);
#ifdef DEBUG
- printf("Board config data:\n");
- printf(" usr_config_ver = %s\n", board_data.usr_config_ver);
- printf(" rom_sw_ver = %s\n", board_data.rom_sw_ver);
- printf(" mem_size = %u\n", board_data.mem_size);
- printf(" mac_address_local = %02x:%02x:%02x:%02x:%02x:%02x\n",
- board_data.mac_address_local[0], board_data.mac_address_local[1],
- board_data.mac_address_local[2], board_data.mac_address_local[3],
- board_data.mac_address_local[4], board_data.mac_address_local[5]);
- printf(" mac_address_pci = %02x:%02x:%02x:%02x:%02x:%02x\n",
- board_data.mac_address_pci[0], board_data.mac_address_pci[1],
- board_data.mac_address_pci[2], board_data.mac_address_pci[3],
- board_data.mac_address_pci[4], board_data.mac_address_pci[5]);
- printf(" processor_speed = %u\n", board_data.processor_speed);
- printf(" plb_speed = %u\n", board_data.plb_speed);
- printf(" pci_speed = %u\n", board_data.pci_speed);
+ openbios_board_print();
#endif
#ifdef DDB
@@ -205,41 +189,10 @@
void
cpu_startup(void)
{
- prop_number_t pn;
- prop_data_t pd;
ibm4xx_cpu_startup("Walnut PowerPC 405GP Evaluation Board");
- board_info_init();
-
- pn = prop_number_create_integer(board_data.mem_size);
- KASSERT(pn != NULL);
- if (prop_dictionary_set(board_properties, "mem-size", pn) == false)
- panic("setting mem-size");
- prop_object_release(pn);
-
- pd = prop_data_create_data_nocopy(board_data.mac_address_local,
- sizeof(board_data.mac_address_local));
- KASSERT(pd != NULL);
- if (prop_dictionary_set(board_properties, "emac0-mac-addr",
- pd) == false)
- panic("setting emac0-mac-addr");
- prop_object_release(pd);
-
- pd = prop_data_create_data_nocopy(board_data.mac_address_pci,
- sizeof(board_data.mac_address_pci));
- KASSERT(pd != NULL);
- if (prop_dictionary_set(board_properties, "sip0-mac-addr",
- pd) == false)
- panic("setting sip0-mac-addr");
- prop_object_release(pd);
-
- pn = prop_number_create_integer(board_data.processor_speed);
- KASSERT(pn != NULL);
- if (prop_dictionary_set(board_properties, "processor-frequency",
- pn) == false)
- panic("setting processor-frequency");
- prop_object_release(pn);
+ openbios_board_info_set();
/*
* Now that we have VM, malloc()s are OK in bus_space.
diff -r 177de5e8be34 -r 1caf460adfee sys/arch/evbppc/walnut/walnut_start.S
--- a/sys/arch/evbppc/walnut/walnut_start.S Tue Mar 30 01:57:20 2021 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,205 +0,0 @@
-/* $NetBSD: walnut_start.S,v 1.24 2018/07/15 05:16:43 maxv Exp $ */
-/* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */
-
-/*
- * Copyright 2001 Wasabi Systems, Inc.
- * All rights reserved.
- *
- * Written by Eduardo Horvath and Simon Burge for Wasabi Systems, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed for the NetBSD Project by
- * Wasabi Systems, Inc.
- * 4. The name of Wasabi Systems, Inc. may not be used to endorse
- * or promote products derived from this software without specific prior
- * written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Copyright (C) 1995, 1996 Wolfgang Solfrank.
- * Copyright (C) 1995, 1996 TooLs GmbH.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by TooLs GmbH.
- * 4. The name of TooLs GmbH may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#undef PPC_4XX_NOCACHE
-
-#include "opt_ddb.h"
-#include "opt_lockdebug.h"
-#include "opt_modular.h"
-#include "opt_multiprocessor.h"
-#include "opt_ppcarch.h"
-#include "opt_ppcparam.h"
-#include "assym.h"
-#include "ksyms.h"
-
-#include <sys/syscall.h>
-
-#include <machine/param.h>
-#include <machine/psl.h>
-#include <machine/trap.h>
-#include <machine/asm.h>
-
-#include <powerpc/spr.h>
-#include <powerpc/ibm4xx/spr.h>
-#include <powerpc/ibm4xx/dcr4xx.h>
-
-/* Function pointer for requesting board_config_data from openbios*/
-#define BOARD_CFG_FP 0xFFFE0B50
-
-/*
- * Some instructions gas doesn't understand (yet?)
- */
-#define bdneq bdnzf 2,
-
-/*
- * This symbol is here for the benefit of kvm_mkdb, and is supposed to
- * mark the start of kernel text.
- */
- .text
- .globl _C_LABEL(kernel_text)
-_C_LABEL(kernel_text):
-
-/*
- * Startup entry. Note, this must be the first thing in the text
- * segment!
- */
- .text
- .globl __start
-__start:
- b 1f
- /* Reserve some space for info_block required for IBM eval board bootloader */
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
- nop
-
-1:
- /* Get the board_config_data from openbios */
Home |
Main Index |
Thread Index |
Old Index