NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-macppc/48600



The following reply was made to PR port-macppc/48600; it has been noted by GNATS.

From: scole_mail <scole_mail%gmx.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: port-macppc/48600
Date: Mon, 5 Jan 2015 15:45:58 -0500

 I got my powermac 7200 to boot off its scsi disk finally.  The disk
 used was a replacement because the stock one was missing.
 
 Code changes are in
    src/sys/arch/macppc/stand/bootxx/bootxx.c
    src/sys/arch/macppc/stand/ofwboot/Locore.c
 which were basically to deal with 601 bats and alignment exceptions.
 The esp driver worked fine for me unchanged.
 
 In openfirmware 1.0.5, this would boot partition zero disk:
    boot scsi/sd@0:0
 
 or for "permanent" settings:
    setenv boot-device  scsi/sd@0:0
    setenv boot-command catch 5000 ms boot
    setenv auto-boot?   true
    reset-all
 
 I did add a jumper to the scsi disk to make it spin up at power-on.  I
 didn't trying booting off of the cd or floppy, because they both are
 broken on my machine.
 
 Just for completeness, this command can boot an iso image
 installed to the hard disk:
    boot scsi/sd@0:0,OFWBOOT.XCF;1 NETBSD.;1
 
 When I used sysinst, it seemed to be doing:
 
    /usr/sbin/installboot /dev/rsd0a /usr/mdec/bootxx /boot
 
 which didn't work so I did:
 
   mount -t ffs /dev/sd0a /tmp/mnt
   cp .../ofwboot /tmp/mnt/
   umount /tmp/mnt
   /usr/sbin/installboot -v /dev/rsd0c /usr/mdec/bootxx /ofwboot
   File system:         /dev/rsd0c
   File system type:    ffs (blocksize 16384, needswap 0)
   Primary bootstrap:   /home/scole/bootxx
   Secondary bootstrap: /ofwboot
   Bootstrap start sector: 4
   Bootstrap byte count:   1900
   Bootstrap block table:  118 entries of 16384 bytes available, 5 used: 5440 5472 5504 5536 55128
   Writing bootstrap
 
 after disklabeling and newfs.  Sometimes I had to reboot after doing
 the disklabel for newfs to work.  It seems like kernel wasn't aware of
 the new disklabel.
 
 Here is the disklabel for my disk which only had a single partion:
 
 pm7200# disklabel sd0
 # /dev/rsd0c:
 type: unknown
 disk: 0662S12       !
 label: 
 flags:
 bytes/sector: 512
 sectors/track: 99
 tracks/cylinder: 5
 sectors/cylinder: 495
 cylinders: 4119
 total sectors: 2055035
 rpm: 3600
 interleave: 1
 trackskew: 0
 cylinderskew: 0
 headswitch: 0           # microseconds
 track-to-track seek: 0  # microseconds
 drivedata: 0 
 
 16 partitions:
 #        size    offset     fstype [fsize bsize cpg/sgs]
  a:   2055035         0     4.2BSD   2048 16384     0  # (Cyl.      0 -   4151*)
  c:   2055035         0     unused      0     0        # (Cyl.      0 -   4151*)
 
 These code changes had no effect, good or bad, on trying to boot gcc
 4.8 ofwboot.xcf over ethernet which doesn't work:
 http://mail-index.netbsd.org/port-macppc/2014/12/23/msg002129.html
 
 I had all wedge support commented out in the kernel.
 
 Index: sys/arch/macppc/stand/bootxx/bootxx.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/macppc/stand/bootxx/bootxx.c,v
 retrieving revision 1.18
 diff -b -u -r1.18 bootxx.c
 --- sys/arch/macppc/stand/bootxx/bootxx.c	14 Mar 2009 21:04:12 -0000	1.18
 +++ sys/arch/macppc/stand/bootxx/bootxx.c	5 Jan 2015 18:01:42 -0000
 @@ -33,6 +33,7 @@
  
  #include <sys/types.h>
  #include <powerpc/oea/bat.h>
 +#include <powerpc/oea/spr.h>
  
  #include <sys/bootblock.h>
  
 @@ -76,7 +77,13 @@
  "	sync			\n"
  
  "	li	%r0,0		\n"
 -"	mtdbatu	3,%r0		\n"
 +"                               \n"     /* test for 601 */
 +"       mfspr   %r9,287         \n"     /* mfpvbr %r9 PVR = 287 */
 +"       srwi    %r9,%r9,0x10    \n"
 +"       cmpi    0,1,%r9,0x02    \n"     /* 601 CPU = 0x0001 */
 +"       blt     2f              \n"     /* skip over non-601 BAT setup */
 +"                               \n"
 +"       mtdbatu 3,%r0           \n"     /* non-601 BAT */
  "	mtibatu	3,%r0		\n"
  "	isync			\n"
  "	li	%r8,0x1ffe	\n"	/* map the lowest 256MB */
 @@ -86,13 +93,64 @@
  "	mtibatl	3,%r9		\n"
  "	mtibatu	3,%r8		\n"
  "	isync			\n"
 +"       b 3f                    \n"
 +"                               \n"
 +"2:                             \n"
 +"       mfmsr   %r8             \n"     /* 601 BAT */
 +"       mtmsr   %r0             \n"
 +"       isync                   \n"
 +"                               \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"
 +"                               \n"
 +"       isync                   \n"
 +"                               \n"
 +"       mtmsr   %r8             \n"
 +"       isync                   \n"
 +"                               \n"
  
  	/*
  	 * setup 32 KB of stack with 32 bytes overpad (see above)
  	 */
 +"3:                             \n"
  "	lis	%r1,(stack+32768)@ha\n"
  "	addi	%r1,%r1,(stack+32768)@l\n"
 -"	stw	%r0,0(%r1)	\n"	/* terminate the frame link chain */
 +        /*
 +         * terminate the frame link chain,
 +         * clear by bytes to avoid ppc601 alignment exceptions
 +         */
 +"       stb     %r0,0(%r1)      \n"
 +"       stb     %r0,1(%r1)      \n"
 +"       stb     %r0,2(%r1)      \n"
 +"       stb     %r0,3(%r1)      \n"
  
  "	b	startup		\n"
  );
 @@ -257,6 +315,7 @@
  void
  startup(int arg1, int arg2, void *openfirm)
  {
 +        uint32_t pvr;
  	int fd, blk, chosen, options, j;
  	size_t i;
  	char *addr;
 @@ -302,6 +361,9 @@
  	}
  	putstr(". done!\r\nstarting stage 2...\r\n");
  
 +        __asm volatile ("mfpvr %0" : "=r"(pvr));
 +
 +        if (pvr != MPC601) {
  	/*
  	 * enable D/I cache
  	 */
 @@ -313,6 +375,7 @@
  		"isync"
  	   ::	"r"(BATU(0, BAT_BL_256M, BAT_Vs)),
  		"r"(BATL(0, 0, BAT_PP_RW)));
 +        }
  
  	entry_point(0, 0, openfirm);
  	for (;;);			/* just in case */
 
 Index: sys/arch/macppc/stand/ofwboot/Locore.c
 ===================================================================
 RCS file: /cvsroot/src/sys/arch/macppc/stand/ofwboot/Locore.c,v
 retrieving revision 1.25
 diff -b -u -r1.25 Locore.c
 --- sys/arch/macppc/stand/ofwboot/Locore.c	26 Feb 2014 21:42:40 -0000	1.25
 +++ sys/arch/macppc/stand/ofwboot/Locore.c	5 Jan 2015 18:01:44 -0000
 @@ -70,9 +70,9 @@
  "	isync			\n"
  "				\n"
  "				\n" /* test for 601 */
 -"       mfspr   %r0,287      	\n" /* mfpvbr %r0 PVR = 287 */
 -"       srwi    %r0,%r0,0x10   	\n"
 -"       cmpi    0,1,%r0,0x02  	\n" /* 601 CPU = 0x0001 */
 +"       mfspr   %r9,287         \n" /* mfpvbr %r9 PVR = 287 */
 +"       srwi    %r9,%r9,0x10    \n"
 +"       cmpi    0,1,%r9,0x02    \n" /* 601 CPU = 0x0001 */
  "       blt     1f		\n" /* skip over non-601 BAT setup */
  	/*non PPC 601 BATs*/
  "	mtibatu	0,%r0		\n"
 @@ -141,7 +141,13 @@
  "				\n"
  "5:	cmpw	0,%r8,%r9	\n"
  "	bge	6f		\n"
 -"	stw	%r0,0(%r8)	\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"
  "	addi	%r8,%r8,4	\n"
  "	b	5b		\n"
  "				\n"
 


Home | Main Index | Thread Index | Old Index