CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: martin Date: Mon May 24 11:13:44 UTC 2021 Modified Files: src/sys/arch/macppc/stand/ofwboot: ofdev.c Log Message: PR 56205: make the 64bit build work To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/macppc/stand/ofwboot/ofdev.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/macppc/stand/ofwboot/ofdev.c diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.28 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.29 --- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.28 Sun Feb 28 20:27:40 2021 +++ src/sys/arch/macppc/stand/ofwboot/ofdev.c Mon May 24 11:13:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.28 2021/02/28 20:27:40 thorpej Exp $ */ +/* $NetBSD: ofdev.c,v 1.29 2021/05/24 11:13:44 martin Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -103,7 +103,7 @@ devclose(struct open_file *of) uint32_t cells[2]; struct of_dev *op = of->f_devdata; - cells[0] = (uint32_t)op->dmabuf; + cells[0] = (uintptr_t)op->dmabuf; cells[1] = MAXPHYS; if (op->type == OFDEV_NET) @@ -439,7 +439,7 @@ devopen(struct open_file *of, const char ofdev.dmabuf = NULL; cells[0] = MAXPHYS; OF_call_method("dma-alloc", handle, 1, 1, (int *)cells); - ofdev.dmabuf = (void *)cells[1]; + ofdev.dmabuf = (void*)(uintptr_t)cells[1]; if (!strcmp(buf, "block")) { ofdev.type = OFDEV_DISK; ofdev.bsize = DEV_BSIZE;
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: joerg Date: Thu Apr 23 00:12:28 UTC 2020 Modified Files: src/sys/arch/macppc/stand/ofwboot: boot.c Log Message: bootfile is owned by libsa To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/stand/ofwboot/boot.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/macppc/stand/ofwboot/boot.c diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.29 src/sys/arch/macppc/stand/ofwboot/boot.c:1.30 --- src/sys/arch/macppc/stand/ofwboot/boot.c:1.29 Wed Jun 6 22:56:25 2018 +++ src/sys/arch/macppc/stand/ofwboot/boot.c Thu Apr 23 00:12:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.29 2018/06/06 22:56:25 uwe Exp $ */ +/* $NetBSD: boot.c,v 1.30 2020/04/23 00:12:28 joerg Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -93,7 +93,7 @@ extern void __syncicache(void *, size_t) #endif char bootdev[MAXBOOTPATHLEN]; -char bootfile[MAXBOOTPATHLEN]; +extern char bootfile[MAXBOOTPATHLEN]; int boothowto; bool floppyboot; int ofw_version = 0;
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: tsutsui Date: Fri Nov 16 14:58:54 UTC 2018 Modified Files: src/sys/arch/macppc/stand/ofwboot: ofdev.c version Log Message: Fix boot failure from installation floppies. PR port-macppc/53103 Also bump version to denote a visible fix. Should be pulled up to netbsd-8 and netbsd-7. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/macppc/stand/ofwboot/ofdev.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/macppc/stand/ofwboot/version 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/macppc/stand/ofwboot/ofdev.c diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.27 --- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26 Sun Feb 19 12:02:55 2012 +++ src/sys/arch/macppc/stand/ofwboot/ofdev.c Fri Nov 16 14:58:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.26 2012/02/19 12:02:55 tsutsui Exp $ */ +/* $NetBSD: ofdev.c,v 1.27 2018/11/16 14:58:54 tsutsui Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -437,10 +437,11 @@ devopen(struct open_file *of, const char ofdev.type = OFDEV_DISK; ofdev.bsize = DEV_BSIZE; /* First try to find a disklabel without partitions */ - if (strategy(, F_READ, - LABELSECTOR, DEV_BSIZE, buf, ) != 0 - || nread != DEV_BSIZE - || getdisklabel(buf, )) { + if (!floppyboot && + (strategy(, F_READ, + LABELSECTOR, DEV_BSIZE, buf, ) != 0 + || nread != DEV_BSIZE + || getdisklabel(buf, ))) { /* Else try APM or MBR partitions */ struct drvr_map *map = (struct drvr_map *)buf; Index: src/sys/arch/macppc/stand/ofwboot/version diff -u src/sys/arch/macppc/stand/ofwboot/version:1.13 src/sys/arch/macppc/stand/ofwboot/version:1.14 --- src/sys/arch/macppc/stand/ofwboot/version:1.13 Sun Oct 17 15:33:04 2010 +++ src/sys/arch/macppc/stand/ofwboot/version Fri Nov 16 14:58:54 2018 @@ -1,4 +1,4 @@ -$NetBSD: version,v 1.13 2010/10/17 15:33:04 phx Exp $ +$NetBSD: version,v 1.14 2018/11/16 14:58:54 tsutsui Exp $ 1.1: Initial revision from NetBSD/powerpc. 1.2: Use MI loadfile(). @@ -14,3 +14,4 @@ $NetBSD: version,v 1.13 2010/10/17 15:33 1.11: Check floppyboot and disable LOAD_NOTE to avoid backward seek. 1.12: Read Apple Partition Map to find the root partition, when no OF path was specified. +1.13: Fix boot failure of installation floppies
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: macallan Date: Fri Aug 17 16:04:39 UTC 2018 Modified Files: src/sys/arch/macppc/stand/ofwboot: Locore.c Log Message: - add some G5-specific setup - OF_claim() more heap space on G5 With this, and -DHEAP_VARIABLE my G5s boot from harddisk To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/stand/ofwboot/Locore.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/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.31 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.32 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.31 Wed Jun 6 23:50:29 2018 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Fri Aug 17 16:04:39 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.31 2018/06/06 23:50:29 uwe Exp $ */ +/* $NetBSD: Locore.c,v 1.32 2018/08/17 16:04:39 macallan Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -35,6 +35,7 @@ #include #include +#include #include "openfirm.h" @@ -81,9 +82,13 @@ __asm( " mfspr %r0,287 \n" /* mfpvbr %r0 PVR = 287 */ " srwi %r0,%r0,0x10 \n" " cmpi 0,1,%r0,0x02 \n" /* 601 CPU = 0x0001 */ -" blt 1f \n" /* skip over non-601 BAT setup */ +" blt 2f \n" /* skip over non-601 BAT setup */ +" cmpi 0,1,%r0,0x39 \n" /* PPC970 */ +" blt 0f \n" +" cmpi 0,1,%r0,0x45 \n" /* PPC970GX */ +" ble 1f \n" /* non PPC 601 BATs */ -" li %r0,0 \n" +"0: li %r0,0 \n" " mtibatu 0,%r0 \n" " mtibatu 1,%r0 \n" " mtibatu 2,%r0 \n" @@ -99,10 +104,31 @@ __asm( " li %r9,0x1ffe \n" /* BATU(0, BAT_BL_256M, BAT_Vs) */ " mtibatu 0,%r9 \n" " mtdbatu 0,%r9 \n" -" b 2f \n" - +" b 3f \n" + /* 970 initialization stuff */ +"1:\n" + /* make sure we're in bridge mode */ +" clrldi %r8,%r8,3 \n" +" mtmsrd %r8 \n" +" isync \n" + /* clear HID5 DCBZ bits (56/57), need to do this early */ +" mfspr %r9,0x3f6 \n" +" rldimi %r9,0,6,56 \n" +" sync \n" +" mtspr 0x3f6,%r9 \n" +" isync \n" +" sync \n" + /* Setup HID1 features, prefetch + i-cacheability controlled by PTE */ +" mfspr %r9,0x3f1 \n" +" li %r11,0x1200 \n" +" sldi %r11,%r11,44 \n" +" or %r9,%r9,%r11 \n" +" mtspr 0x3f1,%r9 \n" +" isync \n" +" sync \n" +" b 3f \n" /* PPC 601 BATs */ -"1: li %r0,0 \n" +"2: li %r0,0 \n" " mtibatu 0,%r0 \n" " mtibatu 1,%r0 \n" " mtibatu 2,%r0 \n" @@ -134,7 +160,7 @@ __asm( " addi %r9,%r9,0x1a \n" " mtibatu 3,%r9 \n" "\n" -"2: isync \n" +"3: isync \n" "\n" " mtmsr %r8 \n" " isync \n" @@ -649,7 +675,13 @@ setup(void) OF_exit(); #ifdef HEAP_VARIABLE - heapspace = OF_claim(0, HEAP_SIZE, NBPG); + uint32_t pvr, vers, hsize = HEAP_SIZE; + + __asm volatile ("mfpvr %0" : "=r"(pvr)); + vers = pvr >> 16; + if (vers >= IBM970 && vers <= IBM970GX) hsize = 0x80; + + heapspace = OF_claim(0, hsize, NBPG); if (heapspace == (char *)-1) { panic("Failed to allocate heap"); }
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: uwe Date: Wed Jun 6 23:50:29 UTC 2018 Modified Files: src/sys/arch/macppc/stand/ofwboot: Locore.c openfirm.h Log Message: Provide commented out OF_enter() that comes in handy when debugging. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/arch/macppc/stand/ofwboot/Locore.c cvs rdiff -u -r1.7 -r1.8 src/sys/arch/macppc/stand/ofwboot/openfirm.h 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/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.30 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.31 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.30 Wed Jun 6 22:56:25 2018 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Wed Jun 6 23:50:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.30 2018/06/06 22:56:25 uwe Exp $ */ +/* $NetBSD: Locore.c,v 1.31 2018/06/06 23:50:29 uwe Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -179,6 +179,24 @@ startup(void *vpd, int res, int (*openfi OF_exit(); } +#if 0 +void +OF_enter(void) +{ + static struct { + const char *name; + int nargs; + int nreturns; + } args = { + "enter", + 0, + 0 + }; + + openfirmware(); +} +#endif /* OF_enter */ + __dead void OF_exit(void) { Index: src/sys/arch/macppc/stand/ofwboot/openfirm.h diff -u src/sys/arch/macppc/stand/ofwboot/openfirm.h:1.7 src/sys/arch/macppc/stand/ofwboot/openfirm.h:1.8 --- src/sys/arch/macppc/stand/ofwboot/openfirm.h:1.7 Mon Dec 24 15:46:45 2007 +++ src/sys/arch/macppc/stand/ofwboot/openfirm.h Wed Jun 6 23:50:29 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: openfirm.h,v 1.7 2007/12/24 15:46:45 perry Exp $ */ +/* $NetBSD: openfirm.h,v 1.8 2018/06/06 23:50:29 uwe Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -39,6 +39,7 @@ #include "boot.h" +void OF_enter(void); __dead void OF_exit(void); int OF_finddevice(const char *); int OF_instance_to_package(int);
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: uwe Date: Wed Jun 6 22:56:25 UTC 2018 Modified Files: src/sys/arch/macppc/stand/ofwboot: Locore.c Makefile boot.c Log Message: Provide an option to use libsa allocator. Not yet enabled. Same binary code is generated. To enable uncomment -DHEAP_VARIABLE and comment out alloc.c in the makefile. PR port-macppc/44895 To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/arch/macppc/stand/ofwboot/Locore.c cvs rdiff -u -r1.58 -r1.59 src/sys/arch/macppc/stand/ofwboot/Makefile cvs rdiff -u -r1.28 -r1.29 src/sys/arch/macppc/stand/ofwboot/boot.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/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.29 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.30 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.29 Fri Apr 22 18:25:41 2016 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Wed Jun 6 22:56:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.29 2016/04/22 18:25:41 christos Exp $ */ +/* $NetBSD: Locore.c,v 1.30 2018/06/06 22:56:25 uwe Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -31,6 +31,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include @@ -43,6 +44,13 @@ static void startup(void *, int, int (*) __attribute__((__used__)); static void setup(void); +#ifdef HEAP_VARIABLE +#ifndef HEAP_SIZE +#define HEAP_SIZE 0x2 +#endif +char *heapspace; +#endif + static int stack[8192/4 + 4] __attribute__((__used__)); #ifdef XCOFF_GLUE @@ -621,6 +629,15 @@ setup(void) OF_getprop(chosen, "stdout", , sizeof(stdout)) != sizeof(stdout)) OF_exit(); + +#ifdef HEAP_VARIABLE + heapspace = OF_claim(0, HEAP_SIZE, NBPG); + if (heapspace == (char *)-1) { + panic("Failed to allocate heap"); + } + + setheap(heapspace, heapspace + HEAP_SIZE); +#endif /* HEAP_VARIABLE */ } void Index: src/sys/arch/macppc/stand/ofwboot/Makefile diff -u src/sys/arch/macppc/stand/ofwboot/Makefile:1.58 src/sys/arch/macppc/stand/ofwboot/Makefile:1.59 --- src/sys/arch/macppc/stand/ofwboot/Makefile:1.58 Thu Apr 20 19:09:29 2017 +++ src/sys/arch/macppc/stand/ofwboot/Makefile Wed Jun 6 22:56:25 2018 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.58 2017/04/20 19:09:29 uwe Exp $ +# $NetBSD: Makefile,v 1.59 2018/06/06 22:56:25 uwe Exp $ S= ${.CURDIR}/../../../.. PROG= ofwboot FILES= ${PROG}.elf ${PROG}.xcf -SRCS= Locore.c boot.c ofdev.c hfs.c net.c netif_of.c alloc.c +SRCS= Locore.c boot.c ofdev.c hfs.c net.c netif_of.c XCOFFXTRA= Xcoffxtra.c XCOFFXTRAOBJ= Xcoffxtra.o CFLAGS+= -ffreestanding @@ -16,6 +16,10 @@ CPPFLAGS+= -D_STANDALONE -DSUPPORT_DHCP CPPFLAGS+= -DSUPPORT_USTARFS -DHAVE_CHANGEDISK_HOOK DBG= -Os +# PR port-macppc/44895 +SRCS+= alloc.c # use ./alloc.c +#CPPFLAGS+= -DHEAP_VARIABLE # use libsa alloc.c + LIBCRT0= # nothing LIBCRTI= # nothing LIBCRTBEGIN= # nothing Index: src/sys/arch/macppc/stand/ofwboot/boot.c diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.28 src/sys/arch/macppc/stand/ofwboot/boot.c:1.29 --- src/sys/arch/macppc/stand/ofwboot/boot.c:1.28 Sat Jun 11 06:32:45 2016 +++ src/sys/arch/macppc/stand/ofwboot/boot.c Wed Jun 6 22:56:25 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.28 2016/06/11 06:32:45 dholland Exp $ */ +/* $NetBSD: boot.c,v 1.29 2018/06/06 22:56:25 uwe Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -181,7 +181,9 @@ chain(boot_entry_t entry, char *args, vo extern char end[]; int l; +#if !defined(HEAP_VARIABLE) freeall(); +#endif /* * Stash pointer to end of symbol table after the argument
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: uwe Date: Thu Apr 20 18:39:29 UTC 2017 Modified Files: src/sys/arch/macppc/stand/ofwboot: Makefile Log Message: Group CLEANFILES assignments. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/arch/macppc/stand/ofwboot/Makefile 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/macppc/stand/ofwboot/Makefile diff -u src/sys/arch/macppc/stand/ofwboot/Makefile:1.56 src/sys/arch/macppc/stand/ofwboot/Makefile:1.57 --- src/sys/arch/macppc/stand/ofwboot/Makefile:1.56 Sat Apr 8 19:53:21 2017 +++ src/sys/arch/macppc/stand/ofwboot/Makefile Thu Apr 20 18:39:28 2017 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.56 2017/04/08 19:53:21 christos Exp $ +# $NetBSD: Makefile,v 1.57 2017/04/20 18:39:28 uwe Exp $ S= ${.CURDIR}/../../../.. @@ -49,13 +49,12 @@ RELOC= E0 ENTRY= _start CLEANFILES+= ${PROG}.elf ${PROG}.el1 ${PROG}.mrg ${PROG}.xcf +CLEANFILES+= ${XCOFFXTRAOBJ} CPPFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. CPPFLAGS+= -DRELOC=0x${RELOC} -DRELOC_FLATFILE=0x${RELOC_FLATFILE} #CPPFLAGS+= -DXCOFF_GLUE # for booting PCI Powermacs -CLEANFILES+= ${XCOFFXTRAOBJ} - ### find out what to use for libkern KERN_AS= library .include "${S}/lib/libkern/Makefile.inc"
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: dholland Date: Sat Jun 11 06:32:46 UTC 2016 Modified Files: src/sys/arch/macppc/stand/ofwboot: boot.c Log Message: PR 51200 gets in libsa considered harmful: use kgets To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/arch/macppc/stand/ofwboot/boot.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/macppc/stand/ofwboot/boot.c diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.27 src/sys/arch/macppc/stand/ofwboot/boot.c:1.28 --- src/sys/arch/macppc/stand/ofwboot/boot.c:1.27 Sun Feb 19 12:02:55 2012 +++ src/sys/arch/macppc/stand/ofwboot/boot.c Sat Jun 11 06:32:45 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.27 2012/02/19 12:02:55 tsutsui Exp $ */ +/* $NetBSD: boot.c,v 1.28 2016/06/11 06:32:45 dholland Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -269,7 +269,7 @@ main(void) if (boothowto & RB_ASKNAME) { printf("Boot: "); - gets(bootline); + kgets(bootline, sizeof(bootline)); parseargs(bootline, ); }
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: christos Date: Fri Apr 22 18:25:41 UTC 2016 Modified Files: src/sys/arch/macppc/stand/ofwboot: Locore.c Log Message: undo unintended commit To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/arch/macppc/stand/ofwboot/Locore.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/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.28 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.29 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.28 Fri Apr 22 14:13:01 2016 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Fri Apr 22 14:25:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.28 2016/04/22 18:13:01 christos Exp $ */ +/* $NetBSD: Locore.c,v 1.29 2016/04/22 18:25:41 christos Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -143,13 +143,7 @@ __asm( "\n" "5: cmpw 0,%r8,%r9 \n" " bge 6f \n" -/* - * clear by bytes to avoid ppc601 alignment exceptions - */ -" stb %r0,0(%r8) \n" -" stb %r0,1(%r8) \n" -" stb %r0,2(%r8) \n" -" stb %r0,3(%r8) \n" +" stw %r0,0(%r8) \n" " addi %r8,%r8,4 \n" " b 5b \n" "\n"
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: tsutsui Date: Sun Mar 13 08:57:10 UTC 2016 Modified Files: src/sys/arch/macppc/stand/ofwboot: Locore.c Log Message: TAB/space cleanup. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/macppc/stand/ofwboot/Locore.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/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.26 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.27 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.26 Sun Jul 26 14:24:29 2015 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Sun Mar 13 08:57:10 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.26 2015/07/26 14:24:29 tsutsui Exp $ */ +/* $NetBSD: Locore.c,v 1.27 2016/03/13 08:57:10 tsutsui Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -70,11 +70,11 @@ __asm( " isync \n" "\n" "\n" /* test for 601 */ -" mfspr %r0,287 \n" /* mfpvbr %r0 PVR = 287 */ -" srwi%r0,%r0,0x10 \n" -" cmpi0,1,%r0,0x02 \n" /* 601 CPU = 0x0001 */ -" blt 1f \n" /* skip over non-601 BAT setup */ - /*non PPC 601 BATs*/ +" mfspr %r0,287 \n" /* mfpvbr %r0 PVR = 287 */ +" srwi %r0,%r0,0x10 \n" +" cmpi 0,1,%r0,0x02 \n" /* 601 CPU = 0x0001 */ +" blt 1f \n" /* skip over non-601 BAT setup */ + /* non PPC 601 BATs */ " li %r0,0 \n" " mtibatu 0,%r0 \n" " mtibatu 1,%r0 \n" @@ -85,46 +85,46 @@ __asm( " mtdbatu 2,%r0 \n" " mtdbatu 3,%r0 \n" "\n" -" li %r9,0x12 \n" /* BATL(0, BAT_M, BAT_PP_RW) */ +" li %r9,0x12 \n" /* BATL(0, BAT_M, BAT_PP_RW) */ " mtibatl 0,%r9 \n" " mtdbatl 0,%r9 \n" " li %r9,0x1ffe \n" /* BATU(0, BAT_BL_256M, BAT_Vs) */ " mtibatu 0,%r9 \n" " mtdbatu 0,%r9 \n" -" b 2f \n" +" b 2f \n" - /* PPC 601 BATs*/ + /* PPC 601 BATs */ "1: li %r0,0 \n" " mtibatu 0,%r0 \n" -" mtibatu 1,%r0 \n" -" mtibatu 2,%r0 \n" -" mtibatu 3,%r0 \n" -" \n" -" li %r9,0x7f\n" -" mtibatl 0,%r9 \n" -" li %r9,0x1a\n" -" mtibatu 0,%r9 \n" -"\n" -" lis %r9,0x80 \n" -" addi %r9,%r9,0x7f \n" -" mtibatl 1,%r9 \n" -" lis %r9,0x80 \n" -" addi %r9,%r9,0x1a \n" -" mtibatu 1,%r9 \n" -"\n" -" lis %r9,0x100 \n" -" addi %r9,%r9,0x7f \n" -" mtibatl 2,%r9 \n" -" lis %r9,0x100 \n" -" addi %r9,%r9,0x1a \n" -" mtibatu 2,%r9 \n" -"\n" -" lis %r9,0x180 \n" -" addi %r9,%r9,0x7f \n" -" mtibatl 3,%r9 \n" -" lis %r9,0x180 \n" -" addi %r9,%r9,0x1a \n" -" mtibatu 3,%r9 \n" +" mtibatu 1,%r0 \n" +" mtibatu 2,%r0 \n" +" mtibatu 3,%r0 \n" +"\n" +" li %r9,0x7f \n" +" mtibatl 0,%r9 \n" +" li %r9,0x1a \n" +" mtibatu 0,%r9 \n" +"\n" +" lis %r9,0x80 \n" +" addi %r9,%r9,0x7f \n" +" mtibatl 1,%r9 \n" +" lis %r9,0x80 \n" +" addi %r9,%r9,0x1a \n" +" mtibatu 1,%r9 \n" +"\n" +" lis %r9,0x100 \n" +" addi %r9,%r9,0x7f \n" +" mtibatl 2,%r9 \n" +" lis %r9,0x100 \n" +" addi %r9,%r9,0x1a \n" +" mtibatu 2,%r9 \n" +"\n" +" lis %r9,0x180 \n" +" addi %r9,%r9,0x7f \n" +" mtibatl 3,%r9 \n" +" lis %r9,0x180 \n" +" addi %r9,%r9,0x1a \n" +" mtibatu 3,%r9 \n" "\n" "2: isync \n" "\n"
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: tsutsui Date: Sun Jul 26 14:24:29 UTC 2015 Modified Files: src/sys/arch/macppc/stand/ofwboot: Locore.c Log Message: Don't set garbages into BAT registers, which was broken in rev 1.25. Should fix PR port-macppc/50018 (though there is no response for 3 weeks), and should be pulled up to netbsd-7. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/stand/ofwboot/Locore.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/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.25 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.26 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.25 Wed Feb 26 21:42:40 2014 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Sun Jul 26 14:24:29 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.25 2014/02/26 21:42:40 macallan Exp $ */ +/* $NetBSD: Locore.c,v 1.26 2015/07/26 14:24:29 tsutsui Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -75,6 +75,7 @@ __asm( cmpi0,1,%r0,0x02 \n /* 601 CPU = 0x0001 */ blt 1f \n /* skip over non-601 BAT setup */ /*non PPC 601 BATs*/ + li %r0,0 \n mtibatu 0,%r0 \n mtibatu 1,%r0 \n mtibatu 2,%r0 \n @@ -93,7 +94,8 @@ __asm( b 2f \n /* PPC 601 BATs*/ -1: mtibatu 0,%r0 \n +1: li %r0,0 \n + mtibatu 0,%r0 \n mtibatu 1,%r0 \n mtibatu 2,%r0 \n mtibatu 3,%r0 \n
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: matt Date: Fri Jan 9 22:02:18 UTC 2015 Modified Files: src/sys/arch/macppc/stand/ofwboot: boot.h Log Message: Force main into .text To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/macppc/stand/ofwboot/boot.h 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/macppc/stand/ofwboot/boot.h diff -u src/sys/arch/macppc/stand/ofwboot/boot.h:1.4 src/sys/arch/macppc/stand/ofwboot/boot.h:1.5 --- src/sys/arch/macppc/stand/ofwboot/boot.h:1.4 Sun Feb 19 12:02:55 2012 +++ src/sys/arch/macppc/stand/ofwboot/boot.h Fri Jan 9 22:02:18 2015 @@ -5,7 +5,7 @@ typedef void (*boot_entry_t)(int, int, int (*)(void *), void *, u_int); -void main(void); +void main(void) __section(.text); #define MAXBOOTPATHLEN 256 extern char bootdev[MAXBOOTPATHLEN];
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: matt Date: Wed Dec 24 00:36:09 UTC 2014 Modified Files: src/sys/arch/macppc/stand/ofwboot: Makefile Log Message: Don't strip the .mrg since the symbols can be useful. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/arch/macppc/stand/ofwboot/Makefile 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/macppc/stand/ofwboot/Makefile diff -u src/sys/arch/macppc/stand/ofwboot/Makefile:1.54 src/sys/arch/macppc/stand/ofwboot/Makefile:1.55 --- src/sys/arch/macppc/stand/ofwboot/Makefile:1.54 Sun Aug 10 17:44:26 2014 +++ src/sys/arch/macppc/stand/ofwboot/Makefile Wed Dec 24 00:36:09 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.54 2014/08/10 17:44:26 joerg Exp $ +# $NetBSD: Makefile,v 1.55 2014/12/24 00:36:09 matt Exp $ S= ${.CURDIR}/../../../.. @@ -100,7 +100,7 @@ ${PROG}.elf: ${OBJS} ${LIBSA} ${LIBZ} ${ ${PROG}.xcf: ${OBJS} ${XCOFFXTRAOBJ} ${LIBSA} ${LIBZ} ${LIBKERN} ${_MKTARGET_LINK} - ${LD} -s -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \ + ${LD} -N -T ${.CURDIR}/../fixcoff/elf32_powerpc_merge.x -e _entry \ -Ttext ${RELOC} -Bstatic -o ${PROG}.mrg ${XCOFFXTRAOBJ} \ ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} ${OBJCOPY} -O aixcoff-rs6000 -R .comment -R .note \
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: macallan Date: Wed Feb 26 21:42:40 UTC 2014 Modified Files: src/sys/arch/macppc/stand/ofwboot: Locore.c Log Message: support 601, from scole_mail To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/stand/ofwboot/Locore.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/macppc/stand/ofwboot/Locore.c diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.24 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.25 --- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.24 Sun Jul 17 20:54:43 2011 +++ src/sys/arch/macppc/stand/ofwboot/Locore.c Wed Feb 26 21:42:40 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.24 2011/07/17 20:54:43 joerg Exp $ */ +/* $NetBSD: Locore.c,v 1.25 2014/02/26 21:42:40 macallan Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -69,6 +69,12 @@ __asm( mtmsr %r0 \n isync \n \n +\n /* test for 601 */ + mfspr %r0,287 \n /* mfpvbr %r0 PVR = 287 */ + srwi%r0,%r0,0x10 \n + cmpi0,1,%r0,0x02 \n /* 601 CPU = 0x0001 */ + blt 1f \n /* skip over non-601 BAT setup */ + /*non PPC 601 BATs*/ mtibatu 0,%r0 \n mtibatu 1,%r0 \n mtibatu 2,%r0 \n @@ -84,7 +90,41 @@ __asm( li %r9,0x1ffe \n /* BATU(0, BAT_BL_256M, BAT_Vs) */ mtibatu 0,%r9 \n mtdbatu 0,%r9 \n - isync \n + b 2f \n + + /* PPC 601 BATs*/ +1: mtibatu 0,%r0 \n + mtibatu 1,%r0 \n + mtibatu 2,%r0 \n + mtibatu 3,%r0 \n + \n + li %r9,0x7f\n + mtibatl 0,%r9 \n + li %r9,0x1a\n + mtibatu 0,%r9 \n +\n + lis %r9,0x80 \n + addi %r9,%r9,0x7f \n + mtibatl 1,%r9 \n + lis %r9,0x80 \n + addi %r9,%r9,0x1a \n + mtibatu 1,%r9 \n +\n + lis %r9,0x100 \n + addi %r9,%r9,0x7f \n + mtibatl 2,%r9 \n + lis %r9,0x100 \n + addi %r9,%r9,0x1a \n + mtibatu 2,%r9 \n +\n + lis %r9,0x180 \n + addi %r9,%r9,0x7f \n + mtibatl 3,%r9 \n + lis %r9,0x180 \n + addi %r9,%r9,0x1a \n + mtibatu 3,%r9 \n +\n +2: isync \n \n mtmsr %r8 \n isync \n
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: tsutsui Date: Sun Feb 19 12:02:56 UTC 2012 Modified Files: src/sys/arch/macppc/stand/ofwboot: boot.c boot.h ofdev.c Log Message: Fix boot failure on OF 2.0 machines. Discussed with phx@ on port-macppc@: http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html Should be pulled up to netbsd-6. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/arch/macppc/stand/ofwboot/boot.c cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/stand/ofwboot/boot.h cvs rdiff -u -r1.25 -r1.26 src/sys/arch/macppc/stand/ofwboot/ofdev.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/macppc/stand/ofwboot/boot.c diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.26 src/sys/arch/macppc/stand/ofwboot/boot.c:1.27 --- src/sys/arch/macppc/stand/ofwboot/boot.c:1.26 Sat Jan 22 19:19:19 2011 +++ src/sys/arch/macppc/stand/ofwboot/boot.c Sun Feb 19 12:02:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.26 2011/01/22 19:19:19 joerg Exp $ */ +/* $NetBSD: boot.c,v 1.27 2012/02/19 12:02:55 tsutsui Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -96,8 +96,8 @@ char bootdev[MAXBOOTPATHLEN]; char bootfile[MAXBOOTPATHLEN]; int boothowto; bool floppyboot; +int ofw_version = 0; -static int ofw_version = 0; static const char *kernels[] = { /netbsd, /netbsd.gz, /netbsd.macppc, NULL }; static void Index: src/sys/arch/macppc/stand/ofwboot/boot.h diff -u src/sys/arch/macppc/stand/ofwboot/boot.h:1.3 src/sys/arch/macppc/stand/ofwboot/boot.h:1.4 --- src/sys/arch/macppc/stand/ofwboot/boot.h:1.3 Wed Jan 28 15:03:28 2009 +++ src/sys/arch/macppc/stand/ofwboot/boot.h Sun Feb 19 12:02:55 2012 @@ -10,6 +10,7 @@ void main(void); #define MAXBOOTPATHLEN 256 extern char bootdev[MAXBOOTPATHLEN]; extern bool floppyboot; +extern int ofw_version; #ifdef HAVE_CHANGEDISK_HOOK struct open_file; Index: src/sys/arch/macppc/stand/ofwboot/ofdev.c diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.25 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.26 --- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.25 Wed Feb 1 21:48:22 2012 +++ src/sys/arch/macppc/stand/ofwboot/ofdev.c Sun Feb 19 12:02:55 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.25 2012/02/01 21:48:22 matt Exp $ */ +/* $NetBSD: ofdev.c,v 1.26 2012/02/19 12:02:55 tsutsui Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -425,7 +425,8 @@ devopen(struct open_file *of, const char return ENXIO; if (!strcmp(buf, block) strrchr(devname, ':') == NULL) /* indicate raw partition, when missing */ - strlcat(devname, :0, sizeof(devname)); + if (ofw_version = 3) + strlcat(devname, :0, sizeof(devname)); if ((handle = OF_open(devname)) == -1) return ENXIO; memset(ofdev, 0, sizeof ofdev);
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: matt Date: Wed Feb 1 21:48:22 UTC 2012 Modified Files: src/sys/arch/macppc/stand/ofwboot: ofdev.c Log Message: Allow ofwboot to read files from FAT(dosfs). To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/stand/ofwboot/ofdev.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/macppc/stand/ofwboot/ofdev.c diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.24 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.25 --- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.24 Thu Jul 7 01:26:55 2011 +++ src/sys/arch/macppc/stand/ofwboot/ofdev.c Wed Feb 1 21:48:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.24 2011/07/07 01:26:55 mrg Exp $ */ +/* $NetBSD: ofdev.c,v 1.25 2012/02/01 21:48:22 matt Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -48,6 +48,7 @@ #include lib/libsa/stand.h #include lib/libsa/byteorder.h #include lib/libsa/cd9660.h +#include lib/libsa/dosfs.h #include lib/libsa/nfs.h #include lib/libsa/ufs.h #include lib/libsa/lfs.h @@ -122,8 +123,9 @@ static struct fs_ops file_system_hfs = F static struct fs_ops file_system_ustarfs = FS_OPS(ustarfs); static struct fs_ops file_system_cd9660 = FS_OPS(cd9660); static struct fs_ops file_system_nfs = FS_OPS(nfs); +static struct fs_ops file_system_dosfs = FS_OPS(dosfs); -struct fs_ops file_system[8]; +struct fs_ops file_system[9]; int nfsys; static struct of_dev ofdev = { @@ -473,7 +475,8 @@ devopen(struct open_file *of, const char file_system[4] = file_system_ustarfs; file_system[5] = file_system_cd9660; file_system[6] = file_system_hfs; - nfsys = 7; + file_system[7] = file_system_dosfs; + nfsys = 8; return 0; } if (!strcmp(buf, network)) {
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: mrg Date: Thu Jul 7 01:26:55 UTC 2011 Modified Files: src/sys/arch/macppc/stand/ofwboot: ofdev.c Log Message: avoid a multi-level cast issue To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/macppc/stand/ofwboot/ofdev.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/macppc/stand/ofwboot/ofdev.c diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.23 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.24 --- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.23 Sun Oct 17 15:33:04 2010 +++ src/sys/arch/macppc/stand/ofwboot/ofdev.c Thu Jul 7 01:26:55 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.23 2010/10/17 15:33:04 phx Exp $ */ +/* $NetBSD: ofdev.c,v 1.24 2011/07/07 01:26:55 mrg Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -439,7 +439,9 @@ || nread != DEV_BSIZE || getdisklabel(buf, label)) { /* Else try APM or MBR partitions */ - if (((struct drvr_map *)buf)-sbSig == DRIVER_MAP_MAGIC) + struct drvr_map *map = (struct drvr_map *)buf; + + if (map-sbSig == DRIVER_MAP_MAGIC) error = search_mac_label(ofdev, buf, label); else error = search_dos_label(ofdev, 0, buf,
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: phx Date: Sun Oct 17 15:33:04 UTC 2010 Modified Files: src/sys/arch/macppc/stand/ofwboot: ofdev.c version Log Message: Read the Apple Partition Map to find a default root partition, when the file name contains no OF path. Tested with OF3 (myself) and OF2 (tsutsui). To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/macppc/stand/ofwboot/ofdev.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/macppc/stand/ofwboot/version 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/macppc/stand/ofwboot/ofdev.c diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.22 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.23 --- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.22 Wed Jan 28 15:03:28 2009 +++ src/sys/arch/macppc/stand/ofwboot/ofdev.c Sun Oct 17 15:33:04 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ofdev.c,v 1.22 2009/01/28 15:03:28 tsutsui Exp $ */ +/* $NetBSD: ofdev.c,v 1.23 2010/10/17 15:33:04 phx Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -132,6 +132,88 @@ char opened_name[MAXBOOTPATHLEN]; +/* + * Check if this APM partition is a suitable root partition and return + * its file system type or zero. + */ +static u_int8_t +check_apm_root(struct part_map_entry *part, int *clust) +{ + struct blockzeroblock *bzb; + char typestr[32], *s; + u_int8_t fstype; + + *clust = 0; /* may become 1 for A/UX partitions */ + fstype = 0; + bzb = (struct blockzeroblock *)(part-pmBootArgs); + + /* convert partition type name to upper case */ + strncpy(typestr, (char *)part-pmPartType, sizeof(typestr)); + typestr[sizeof(typestr) - 1] = '\0'; + for (s = typestr; *s; s++) + if ((*s = 'a') (*s = 'z')) + *s = (*s - 'a' + 'A'); + + if (strcmp(PART_TYPE_NBSD_PPCBOOT, typestr) == 0) { + if ((bzb-bzbMagic == BZB_MAGIC) + (bzb-bzbType FSMAXTYPES)) + fstype = bzb-bzbType; + else + fstype = FS_BSDFFS; + } else if (strcmp(PART_TYPE_UNIX, typestr) == 0 + bzb-bzbMagic == BZB_MAGIC (bzb-bzbFlags BZB_ROOTFS)) { + *clust = bzb-bzbCluster; + fstype = FS_BSDFFS; + } + + return fstype; +} + +/* + * Build a disklabel from APM partitions. + * We will just look for a suitable root partition and insert it into + * the 'a' slot. Should be sufficient to boot a kernel from it. + */ +static int +search_mac_label(struct of_dev *devp, char *buf, struct disklabel *lp) +{ + struct part_map_entry *pme; + struct partition *a_part; + size_t nread; + int blkno, clust, lastblk, lastclust; + u_int8_t fstype; + + pme = (struct part_map_entry *)buf; + a_part = lp-d_partitions[0]; /* disklabel 'a' partition */ + lastclust = -1; + + for (blkno = lastblk = 1; blkno = lastblk; blkno++) { + if (strategy(devp, F_READ, blkno, DEV_BSIZE, pme, nread) + || nread != DEV_BSIZE) + return ERDLAB; + if (pme-pmSig != PART_ENTRY_MAGIC || + pme-pmPartType[0] == '\0') + break; + lastblk = pme-pmMapBlkCnt; + + fstype = check_apm_root(pme, clust); + + if (fstype (lastclust == -1 || clust lastclust)) { + a_part-p_size = pme-pmPartBlkCnt; + a_part-p_offset = pme-pmPyPartStart; + a_part-p_fstype = fstype; + if ((lastclust = clust) == 0) +break; /* we won't find a better match */ + } + } + if (lastclust 0) + return ERDLAB; /* no root partition found */ + + /* pretend we only have partitions 'a', 'b' and 'c' */ + lp-d_npartitions = RAW_PART + 1; + return 0; +} + static u_long get_long(const void *p) { @@ -141,11 +223,11 @@ } /* - * Find a valid disklabel. + * Find a valid disklabel from MBR partitions. */ static int -search_label(struct of_dev *devp, u_long off, char *buf, struct disklabel *lp, - u_long off0) +search_dos_label(struct of_dev *devp, u_long off, char *buf, +struct disklabel *lp, u_long off0) { size_t nread; struct mbr_partition *p; @@ -187,7 +269,7 @@ } } else if (p-mbrp_type == MBR_PTYPE_EXT) { poff = get_long(p-mbrp_start); - if (!search_label(devp, poff, buf, lp, off0)) { + if (!search_dos_label(devp, poff, buf, lp, off0)) { recursion--; return 0; } @@ -202,7 +284,6 @@ return ERDLAB; } - bool parsefilepath(const char *path, char *devname, char *fname, char *ppart) { @@ -340,14 +421,9 @@ return ENOENT; if (OF_getprop(handle, device_type, buf, sizeof buf) 0) return ENXIO; -#if 0 - if (!strcmp(buf, block)) - /* - * For block devices, indicate raw partition - * (:0 in OpenFirmware) - */ + if (!strcmp(buf, block) strrchr(devname, ':') == NULL) + /* indicate raw partition, when missing */ strlcat(devname, :0, sizeof(devname)); -#endif if ((handle = OF_open(devname)) == -1) return ENXIO; memset(ofdev, 0, sizeof ofdev); @@ -357,13 +433,17 @@ if (!strcmp(buf, block)) { ofdev.type = OFDEV_DISK; ofdev.bsize = DEV_BSIZE; - /* First try to find a disklabel without MBR partitions */ + /* First try to find a disklabel without partitions */ if
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: christos Date: Wed Aug 25 16:33:51 UTC 2010 Modified Files: src/sys/arch/macppc/stand/ofwboot: boot.c Log Message: s/LOAD_NOTE/LOAD_BACKWARDS/ To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/arch/macppc/stand/ofwboot/boot.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/macppc/stand/ofwboot/boot.c diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.24 src/sys/arch/macppc/stand/ofwboot/boot.c:1.25 --- src/sys/arch/macppc/stand/ofwboot/boot.c:1.24 Sun Mar 28 20:13:32 2010 +++ src/sys/arch/macppc/stand/ofwboot/boot.c Wed Aug 25 12:33:51 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.24 2010/03/29 00:13:32 mrg Exp $ */ +/* $NetBSD: boot.c,v 1.25 2010/08/25 16:33:51 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -288,7 +288,7 @@ loadflag = LOAD_KERNEL; if (floppyboot) -loadflag = ~LOAD_NOTE; +loadflag = ~LOAD_BACKWARDS; marks[MARK_START] = 0; if (loadfile(kernels[i], marks, loadflag) = 0)
CVS commit: src/sys/arch/macppc/stand/ofwboot
Module Name:src Committed By: mrg Date: Mon Mar 29 00:13:33 UTC 2010 Modified Files: src/sys/arch/macppc/stand/ofwboot: boot.c Log Message: avoid some warnings on powerpc64. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/macppc/stand/ofwboot/boot.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/macppc/stand/ofwboot/boot.c diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.23 src/sys/arch/macppc/stand/ofwboot/boot.c:1.24 --- src/sys/arch/macppc/stand/ofwboot/boot.c:1.23 Wed Jan 28 15:03:28 2009 +++ src/sys/arch/macppc/stand/ofwboot/boot.c Mon Mar 29 00:13:32 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: boot.c,v 1.23 2009/01/28 15:03:28 tsutsui Exp $ */ +/* $NetBSD: boot.c,v 1.24 2010/03/29 00:13:32 mrg Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -332,8 +332,8 @@ esym = (void *)marks[MARK_END]; printf( start=0x%x\n, entry); - __syncicache((void *) entry, (u_int) ssym - (u_int) entry); - chain((boot_entry_t) entry, bootline, ssym, esym); + __syncicache((void *)(uintptr_t)entry, (size_t)ssym - entry); + chain((boot_entry_t)(uintptr_t)entry, bootline, ssym, esym); OF_exit(); }