CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: thorpej Date: Wed Nov 18 03:46:25 UTC 2020 Modified Files: src/sys/arch/bebox/bebox: mainbus.c pic_bebox.c Log Message: malloc(9) -> kmem(9) To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/arch/bebox/bebox/mainbus.c cvs rdiff -u -r1.11 -r1.12 src/sys/arch/bebox/bebox/pic_bebox.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/mainbus.c diff -u src/sys/arch/bebox/bebox/mainbus.c:1.32 src/sys/arch/bebox/bebox/mainbus.c:1.33 --- src/sys/arch/bebox/bebox/mainbus.c:1.32 Tue Jul 7 03:38:46 2020 +++ src/sys/arch/bebox/bebox/mainbus.c Wed Nov 18 03:46:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.32 2020/07/07 03:38:46 thorpej Exp $ */ +/* $NetBSD: mainbus.c,v 1.33 2020/11/18 03:46:25 thorpej Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -31,12 +31,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.32 2020/07/07 03:38:46 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.33 2020/11/18 03:46:25 thorpej Exp $"); #include #include #include -#include +#include #include #include @@ -123,12 +123,10 @@ mainbus_attach(device_t parent, device_t */ #if NPCI > 0 - genppc_pct = malloc(sizeof(struct genppc_pci_chipset), M_DEVBUF, - M_WAITOK); + genppc_pct = kmem_alloc(sizeof(struct genppc_pci_chipset), KM_SLEEP); bebox_pci_get_chipset_tag(genppc_pct); - pbi = malloc(sizeof(struct genppc_pci_chipset_businfo), - M_DEVBUF, M_WAITOK); + pbi = kmem_alloc(sizeof(struct genppc_pci_chipset_businfo), KM_SLEEP); pbi->pbi_properties = prop_dictionary_create(); KASSERT(pbi->pbi_properties != NULL); Index: src/sys/arch/bebox/bebox/pic_bebox.c diff -u src/sys/arch/bebox/bebox/pic_bebox.c:1.11 src/sys/arch/bebox/bebox/pic_bebox.c:1.12 --- src/sys/arch/bebox/bebox/pic_bebox.c:1.11 Sun Nov 10 21:16:25 2019 +++ src/sys/arch/bebox/bebox/pic_bebox.c Wed Nov 18 03:46:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_bebox.c,v 1.11 2019/11/10 21:16:25 chs Exp $ */ +/* $NetBSD: pic_bebox.c,v 1.12 2020/11/18 03:46:25 thorpej Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,12 +30,12 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.11 2019/11/10 21:16:25 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pic_bebox.c,v 1.12 2020/11/18 03:46:25 thorpej Exp $"); #include "opt_multiprocessor.h" #include -#include +#include #include #include @@ -57,7 +57,7 @@ setup_bebox_intr(void) { struct pic_ops *pic; - pic = malloc(sizeof(struct pic_ops), M_DEVBUF, M_WAITOK); + pic = kmem_alloc(sizeof(struct pic_ops), KM_SLEEP); pic->pic_numintrs = 32; pic->pic_cookie = (void *)BEBOX_REG; pic->pic_enable_irq = bebox_enable_irq;
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: christos Date: Sun Dec 13 19:38:09 UTC 2015 Modified Files: src/sys/arch/bebox/bebox: autoconf.c Log Message: PR/50524: David Binderman: Fix incorrect test To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/bebox/bebox/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/autoconf.c diff -u src/sys/arch/bebox/bebox/autoconf.c:1.26 src/sys/arch/bebox/bebox/autoconf.c:1.27 --- src/sys/arch/bebox/bebox/autoconf.c:1.26 Wed Dec 19 08:53:47 2012 +++ src/sys/arch/bebox/bebox/autoconf.c Sun Dec 13 14:38:09 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.26 2012/12/19 13:53:47 kiyohara Exp $ */ +/* $NetBSD: autoconf.c,v 1.27 2015/12/13 19:38:09 christos Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -44,7 +44,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.26 2012/12/19 13:53:47 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.27 2015/12/13 19:38:09 christos Exp $"); #include #include @@ -162,7 +162,7 @@ findroot(void) return; p += 2; part = (*p++) - '0'; - if (p != '\0') + if (*p != '\0') return; booted_partition = part;
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Sat Oct 20 12:45:22 UTC 2012 Modified Files: src/sys/arch/bebox/bebox: locore.S Log Message: Enable cpu0 I/D cache. Disable cpu1 it. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/bebox/bebox/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/locore.S diff -u src/sys/arch/bebox/bebox/locore.S:1.26 src/sys/arch/bebox/bebox/locore.S:1.27 --- src/sys/arch/bebox/bebox/locore.S:1.26 Sat Oct 20 12:13:46 2012 +++ src/sys/arch/bebox/bebox/locore.S Sat Oct 20 12:45:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.26 2012/10/20 12:13:46 kiyohara Exp $ */ +/* $NetBSD: locore.S,v 1.27 2012/10/20 12:45:22 kiyohara Exp $ */ /* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */ /* @@ -49,6 +49,7 @@ #include machine/asm.h #include powerpc/spr.h +#include powerpc/oea/hid.h #include powerpc/oea/spr.h /* @@ -123,6 +124,12 @@ __start: nop __start_cpu1: + /* Disable data and instruction caches for spinup. */ + li 8,0 + mtspr SPR_HID0,8 + sync + isync + #ifdef MULTIPROCESSOR li 3, 0x1 /* CPU ID 1 */ ba cpu_spinstart /* cpu_spinstart(CPU ID) */ @@ -133,6 +140,20 @@ __start_cpu1: nop __start_cpu0: + /* Enable data and instruction caches */ + mfspr 8,SPR_HID0 + andi. 8,8,(HID0_ICE|HID0_DCE)@l + andi. 0,8,HID0_DCE + ori 7,8,HID0_ICFI + bne 1f + ori 7,7,HID0_DCFI +1: + sync + mtspr SPR_HID0,7 + sync + mtspr SPR_HID0,8 + sync + isync /* compute end of kernel memory */ #if defined(DDB) || NKSYMS || defined(MODULAR)
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Sat Oct 20 14:56:31 UTC 2012 Modified Files: src/sys/arch/bebox/bebox: pic_bebox.c Log Message: Add experimental support GENERIC.MP. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/bebox/bebox/pic_bebox.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/pic_bebox.c diff -u src/sys/arch/bebox/bebox/pic_bebox.c:1.9 src/sys/arch/bebox/bebox/pic_bebox.c:1.10 --- src/sys/arch/bebox/bebox/pic_bebox.c:1.9 Sat Oct 20 12:37:49 2012 +++ src/sys/arch/bebox/bebox/pic_bebox.c Sat Oct 20 14:56:31 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: pic_bebox.c,v 1.9 2012/10/20 12:37:49 kiyohara Exp $ */ +/* $NetBSD: pic_bebox.c,v 1.10 2012/10/20 14:56:31 kiyohara Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,9 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pic_bebox.c,v 1.9 2012/10/20 12:37:49 kiyohara Exp $); +__KERNEL_RCSID(0, $NetBSD: pic_bebox.c,v 1.10 2012/10/20 14:56:31 kiyohara Exp $); + +#include opt_multiprocessor.h #include sys/param.h #include sys/malloc.h @@ -68,6 +70,11 @@ setup_bebox_intr(void) pic-pic_establish_irq = dummy_pic_establish_intr; strcpy(pic-pic_name, bebox); pic_add(pic); + +#ifdef MULTIPROCESSOR + setup_bebox_ipi(); +#endif + return(pic); }
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Mon Oct 8 15:34:58 UTC 2012 Modified Files: src/sys/arch/bebox/bebox: machdep.c Log Message: Left and Right LEDs on in end of cpu_reboot(). To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/arch/bebox/bebox/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/machdep.c diff -u src/sys/arch/bebox/bebox/machdep.c:1.104 src/sys/arch/bebox/bebox/machdep.c:1.105 --- src/sys/arch/bebox/bebox/machdep.c:1.104 Sun Aug 7 15:22:19 2011 +++ src/sys/arch/bebox/bebox/machdep.c Mon Oct 8 15:34:58 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.104 2011/08/07 15:22:19 kiyohara Exp $ */ +/* $NetBSD: machdep.c,v 1.105 2012/10/08 15:34:58 kiyohara Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.104 2011/08/07 15:22:19 kiyohara Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.105 2012/10/08 15:34:58 kiyohara Exp $); #include opt_compat_netbsd.h #include opt_ddb.h @@ -58,6 +58,8 @@ __KERNEL_RCSID(0, $NetBSD: machdep.c,v #include machine/powerpc.h #include powerpc/pic/picvar.h +#include powerpc/pio.h +#include powerpc/prep_bus.h #include powerpc/psl.h #include dev/cons.h @@ -315,5 +317,12 @@ cpu_reboot(int howto, char *what) *ap++ = 0; if (ap[-2] == '-') *ap1 = 0; + + /* Left and Right LED on. Max 15 for both LED. */ +#define LEFT_LED(x) (((x) 0xf) 4) +#define RIGHT_LED(x) (((x) 0xf)) + + outb(PREP_BUS_SPACE_IO + 0x0c00, LEFT_LED(15) | RIGHT_LED(15)); + while (1); }
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Sun Aug 7 15:16:35 UTC 2011 Modified Files: src/sys/arch/bebox/bebox: machdep.c Log Message: Not allow interrupt hear. To generate a diff of this commit: cvs rdiff -u -r1.102 -r1.103 src/sys/arch/bebox/bebox/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/machdep.c diff -u src/sys/arch/bebox/bebox/machdep.c:1.102 src/sys/arch/bebox/bebox/machdep.c:1.103 --- src/sys/arch/bebox/bebox/machdep.c:1.102 Sun Aug 7 15:04:46 2011 +++ src/sys/arch/bebox/bebox/machdep.c Sun Aug 7 15:16:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.102 2011/08/07 15:04:46 kiyohara Exp $ */ +/* $NetBSD: machdep.c,v 1.103 2011/08/07 15:16:35 kiyohara Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.102 2011/08/07 15:04:46 kiyohara Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.103 2011/08/07 15:16:35 kiyohara Exp $); #include opt_compat_netbsd.h #include opt_ddb.h @@ -188,17 +188,6 @@ * Now that we have VM, malloc's are OK in bus_space. */ bus_space_mallocok(); - - /* - * Now allow hardware interrupts. - */ - { - int msr; - - splraise(-1); - __asm volatile (mfmsr %0; ori %0,%0,%1; mtmsr %0 - : =r(msr) : K(PSL_EE)); - } } /*
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Sun Aug 7 15:31:35 UTC 2011 Modified Files: src/sys/arch/bebox/bebox: mainbus.c Log Message: Try to attach 2nd CPU. But not support options MULTIPROCESSOR yet. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/bebox/bebox/mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/mainbus.c diff -u src/sys/arch/bebox/bebox/mainbus.c:1.27 src/sys/arch/bebox/bebox/mainbus.c:1.28 --- src/sys/arch/bebox/bebox/mainbus.c:1.27 Fri Jul 1 20:34:53 2011 +++ src/sys/arch/bebox/bebox/mainbus.c Sun Aug 7 15:31:35 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.27 2011/07/01 20:34:53 dyoung Exp $ */ +/* $NetBSD: mainbus.c,v 1.28 2011/08/07 15:31:35 kiyohara Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.27 2011/07/01 20:34:53 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.28 2011/08/07 15:31:35 kiyohara Exp $); #include sys/param.h #include sys/extent.h @@ -108,6 +108,9 @@ ca.ca_name = cpu; ca.ca_node = 0; config_found_ia(self, mainbus, ca, mainbus_print); + ca.ca_name = cpu; + ca.ca_node = 1; + config_found_ia(self, mainbus, ca, mainbus_print); /* * XXX Note also that the presence of a PCI bus should
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Sun Aug 7 15:44:59 UTC 2011 Modified Files: src/sys/arch/bebox/bebox: locore.S Log Message: Cleanup spin loop for 2nd cpu. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/bebox/bebox/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/locore.S diff -u src/sys/arch/bebox/bebox/locore.S:1.24 src/sys/arch/bebox/bebox/locore.S:1.25 --- src/sys/arch/bebox/bebox/locore.S:1.24 Mon Jun 20 19:56:11 2011 +++ src/sys/arch/bebox/bebox/locore.S Sun Aug 7 15:44:59 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.24 2011/06/20 19:56:11 matt Exp $ */ +/* $NetBSD: locore.S,v 1.25 2011/08/07 15:44:59 kiyohara Exp $ */ /* $OpenBSD: locore.S,v 1.4 1997/01/26 09:06:38 rahnds Exp $ */ /* @@ -120,31 +120,17 @@ cmpwi 0, 9, 0 /* 0 if read by CPU 0, 1 if read by CPU 1 */ bne __start_cpu1 b __start_cpu0 + nop __start_cpu1: -#ifdef CPU1_SLEEP - lis 8, 0x0020 /* SLEEP */ - mfspr 7, SPR_HID0 /* get HID0 */ - or 7, 7, 8 - mtspr SPR_HID0, 7 /* set HID0 */ - lis 8, 0x0004 /* POW */ - sync - mtmsr 8 - isync /* zzz... */ +#ifdef MULTIPROCESSOR + li 3, 0x1 /* CPU ID 1 */ + ba cpu_spinstart /* cpu_spinstart(CPU ID) */ #else - addi 9, 9, 1 - lis 7, 0x100 -__start_cpu1_loop: - subi 7, 7, 1 - cmpi 0, 7, 0 - bne __start_cpu1_loop - lis 8, 0x8000 - ori 8, 8, 0x0c00 - lis 9,_C_LABEL(cpu_info)+CI_CPL@ha - lwz 9,_C_LABEL(cpu_info)+CI_CPL@l(9) - stb 9, 0(8) +1: + b 1b #endif - b __start_cpu1 + nop __start_cpu0:
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: matt Date: Fri Jun 3 00:16:27 UTC 2011 Modified Files: src/sys/arch/bebox/bebox: cpu.c mainbus.c Log Message: Covert to CFATTACH_DECL_NEW, device_t, cfdata_t To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/bebox/bebox/cpu.c cvs rdiff -u -r1.25 -r1.26 src/sys/arch/bebox/bebox/mainbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/cpu.c diff -u src/sys/arch/bebox/bebox/cpu.c:1.9 src/sys/arch/bebox/bebox/cpu.c:1.10 --- src/sys/arch/bebox/bebox/cpu.c:1.9 Mon Apr 28 20:23:15 2008 +++ src/sys/arch/bebox/bebox/cpu.c Fri Jun 3 00:16:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.c,v 1.9 2008/04/28 20:23:15 martin Exp $ */ +/* $NetBSD: cpu.c,v 1.10 2011/06/03 00:16:27 matt Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.9 2008/04/28 20:23:15 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.10 2011/06/03 00:16:27 matt Exp $); #include sys/param.h #include sys/systm.h @@ -40,16 +40,16 @@ #include machine/bus.h #include machine/cpu.h -int cpumatch(struct device *, struct cfdata *, void *); -void cpuattach(struct device *, struct device *, void *); +int cpumatch(device_t, cfdata_t, void *); +void cpuattach(device_t, device_t, void *); -CFATTACH_DECL(cpu, sizeof(struct device), +CFATTACH_DECL_NEW(cpu, 0, cpumatch, cpuattach, NULL, NULL); extern struct cfdriver cpu_cd; int -cpumatch(struct device *parent, struct cfdata *cfdata, void *aux) +cpumatch(device_t parent, cfdata_t cfdata, void *aux) { struct confargs *ca = aux; @@ -61,7 +61,7 @@ } void -cpuattach(struct device *parent, struct device *self, void *aux) +cpuattach(device_t parent, device_t self, void *aux) { (void) cpu_attach_common(self, 0); } Index: src/sys/arch/bebox/bebox/mainbus.c diff -u src/sys/arch/bebox/bebox/mainbus.c:1.25 src/sys/arch/bebox/bebox/mainbus.c:1.26 --- src/sys/arch/bebox/bebox/mainbus.c:1.25 Tue May 17 17:34:48 2011 +++ src/sys/arch/bebox/bebox/mainbus.c Fri Jun 3 00:16:27 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: mainbus.c,v 1.25 2011/05/17 17:34:48 dyoung Exp $ */ +/* $NetBSD: mainbus.c,v 1.26 2011/06/03 00:16:27 matt Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.25 2011/05/17 17:34:48 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.26 2011/06/03 00:16:27 matt Exp $); #include sys/param.h #include sys/extent.h @@ -49,10 +49,10 @@ #include machine/pci_machdep.h #include machine/isa_machdep.h -int mainbus_match(struct device *, struct cfdata *, void *); -void mainbus_attach(struct device *, struct device *, void *); +int mainbus_match(device_t, cfdata_t, void *); +void mainbus_attach(device_t, device_t, void *); -CFATTACH_DECL(mainbus, sizeof(struct device), +CFATTACH_DECL_NEW(mainbus, 0, mainbus_match, mainbus_attach, NULL, NULL); int mainbus_print (void *, const char *); @@ -72,7 +72,7 @@ * Probe for the mainbus; always succeeds. */ int -mainbus_match(struct device *parent, struct cfdata *match, void *aux) +mainbus_match(device_t parent, cfdata_t match, void *aux) { return 1; } @@ -81,7 +81,7 @@ * Attach the mainbus. */ void -mainbus_attach(struct device *parent, struct device *self, void *aux) +mainbus_attach(device_t parent, device_t self, void *aux) { union mainbus_attach_args mba; struct confargs ca;
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Sat Oct 30 06:11:18 UTC 2010 Modified Files: src/sys/arch/bebox/bebox: machdep.c Log Message: Remove unnecessary comment-outed line. To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/arch/bebox/bebox/machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/machdep.c diff -u src/sys/arch/bebox/bebox/machdep.c:1.98 src/sys/arch/bebox/bebox/machdep.c:1.99 --- src/sys/arch/bebox/bebox/machdep.c:1.98 Fri Nov 27 03:23:05 2009 +++ src/sys/arch/bebox/bebox/machdep.c Sat Oct 30 06:11:18 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.98 2009/11/27 03:23:05 rmind Exp $ */ +/* $NetBSD: machdep.c,v 1.99 2010/10/30 06:11:18 kiyohara Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.98 2009/11/27 03:23:05 rmind Exp $); +__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.99 2010/10/30 06:11:18 kiyohara Exp $); #include opt_compat_netbsd.h #include opt_ddb.h @@ -157,11 +157,6 @@ ns_per_tick = 10 / ticks_per_sec; } - - /* - * boothowto - */ - /* boothowto = args; */ prep_initppc(startkernel, endkernel, args); }
CVS commit: src/sys/arch/bebox/bebox
Module Name:src Committed By: kiyohara Date: Wed Oct 27 10:42:13 UTC 2010 Modified Files: src/sys/arch/bebox/bebox: autoconf.c Log Message: Get and parse root-device. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/bebox/bebox/autoconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/bebox/bebox/autoconf.c diff -u src/sys/arch/bebox/bebox/autoconf.c:1.22 src/sys/arch/bebox/bebox/autoconf.c:1.23 --- src/sys/arch/bebox/bebox/autoconf.c:1.22 Wed Mar 18 10:22:26 2009 +++ src/sys/arch/bebox/bebox/autoconf.c Wed Oct 27 10:42:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.22 2009/03/18 10:22:26 cegger Exp $ */ +/* $NetBSD: autoconf.c,v 1.23 2010/10/27 10:42:12 kiyohara Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -37,18 +37,19 @@ /* * Setup the system to run on the current machine. * - * Configure() is called at boot time and initializes the vba + * Configure() is called at boot time and initializes the vba * device tables and the memory controller monitoring. Available * devices are determined (from possibilities mentioned in ioconf.c), * and the drivers are initialized. */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.22 2009/03/18 10:22:26 cegger Exp $); +__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.23 2010/10/27 10:42:12 kiyohara Exp $); #include sys/param.h #include sys/systm.h #include sys/buf.h +#include sys/disk.h #include sys/disklabel.h #include sys/conf.h #include sys/reboot.h @@ -61,13 +62,21 @@ #include dev/pci/pcireg.h #include dev/pci/pcivar.h #endif +#include dev/ata/atareg.h +#include dev/ata/atavar.h +#include dev/ata/wdvar.h +#include dev/scsipi/sdvar.h +#include machine/bootinfo.h #include machine/pte.h #include machine/intr.h void genppc_cpu_configure(void); static void findroot(void); +static int bus, target, lun, drive; +static const char *name = NULL; + /* * Determine i/o configuration for a machine. */ @@ -76,16 +85,17 @@ cpu_configure(void) { + findroot(); + if (config_rootfound(mainbus, NULL) == NULL) panic(configure: mainbus not configured); - + genppc_cpu_configure(); } void cpu_rootconf(void) { - findroot(); aprint_normal(boot device: %s\n, booted_device ? booted_device-dv_xname : unknown); @@ -93,39 +103,82 @@ setroot(booted_device, booted_partition); } -u_long bootdev = 0; /* should be dev_t, but not until 32 bits */ - /* * Attempt to find the device from which we were booted. * If we can do so, and not instructed not to do so, * change rootdev to correspond to the load device. */ -void +static void findroot(void) { - int unit, part; - device_t dv; - const char *name; - - if ((bootdev B_MAGICMASK) != (u_long)B_DEVMAGIC) - return; - - name = devsw_blk2name((bootdev B_TYPESHIFT) B_TYPEMASK); - if (name == NULL) - return; - - part = (bootdev B_PARTITIONSHIFT) B_PARTITIONMASK; - unit = (bootdev B_UNITSHIFT) B_UNITMASK; - - if ((dv = device_find_by_driver_unit(name, unit)) != NULL) { - booted_device = dv; - booted_partition = part; - } + struct btinfo_rootdevice *rdev; + int part; + char *p; + + rdev = (struct btinfo_rootdevice *)lookup_bootinfo(BTINFO_ROOTDEVICE); + if (rdev == NULL) + return; + p = rdev-rootdevice; + if (strncmp(p, /dev/disk/, 10) != 0) + /* unknwon device... */ + return; + p += 10; + if (strncmp(p, scsi/, 5) == 0) { + name = sd; + p += 5; + + bus = 0; + while (isdigit(*p)) + bus = bus * 10 + (*p++) - '0'; + if (*p++ != '/') + return; + target = 0; + while (isdigit(*p)) + target = target * 10 + (*p++) - '0'; + if (*p++ != '/') + return; + lun = 0; + while (isdigit(*p)) + lun = lun * 10 + (*p++) - '0'; + } else if (strncmp(p, ide/, 4) == 0) { + name = wd; + p += 4; + + bus = 0; + while (isdigit(*p)) + bus = bus * 10 + (*p++) - '0'; + if (*p++ != '/') + return; + if (strncmp(p, master/0, 8) == 0) { + drive = 0; + p += 8; + } else if (strncmp(p, slave/0, 7) == 0) { + drive = 1; + p += 7; + } else + return; + } else if (strcmp(p, floppy) == 0) + return; + else + /* unknwon disk... */ + return; + + if (*p != '_' || !isdigit(*(p + 1))) + return; + p++; + part = 0; + while (isdigit(*p)) + part = part * 10 + (*p++) - '0'; + if (p != '\0') + return; + + booted_partition = part; } void -device_register(struct device *dev, void *aux) +device_register(device_t dev, void *aux) { + device_t bdev, cdev; #if NPCI 0 if (device_is_a(dev, genfb) @@ -149,13 +202,48 @@ device_is_a(device_parent(dev), pci)) { prop_dictionary_t dict = device_properties(dev); struct pci_attach_args *pa = aux; - int bus, device; + int pbus, device; - pci_decompose_tag(pa-pa_pc, pa-pa_tag, bus, device, NULL); - if (bus == 0 device == 12) + pci_decompose_tag(pa-pa_pc, pa-pa_tag, pbus, device, NULL); + if (pbus