Subject: Re: Need proofreaders for updated installation instructions
To: None <port-sparc@netbsd.org>
From: Michael Wolfson <mw@costello.cnf.cornell.edu>
List: port-sparc
Date: 10/21/2000 13:26:02
Thanks for all the feedback, guys!

Here's the rewritten section on boot ROMs and SCSI.  Comments?

  -- MW

     The OBP1 machines (SPARCstation/server 1, SPARCstation/server 1+, IPC,
     and SLC) have an odd SCSI quirk you should be aware of.  There are three
     SCSI addressing schemes used by your system: SCSI ID (set by physical
     jumpers on the device), SCSI target (set by OBP1, based on its SCSI ID),
     and the name you reference within an operating system (set by the kernel,
     based on the SCSI target).

     Sun shipped these systems with the internal drive at SCSI ID 0.  The de-
     fault value of the OBP variable `sd-targets' is 31204567.  The means that
     the device at SCSI ID 3 is at SCSI target 0, and the SCSI device at ID 0
     is at target 3.  When you type ``boot scsi(0,0,0)'', OBP will boot from
     target 0 (that is, SCSI ID 3).  The SunOS kernel is hard-wired to map sd0
     to SCSI target 3, and sd3 to SCSI target 0.  This means that SCSI ID 0
     (target 3) is sd0, SCSI ID 1 (target 1) is sd1, and so on.  Essentially,
     SunOS reverses the OBP target remapping.

           SCSI ID    SCSI Target    SunOS name
              0          3              sd0
              1          1              sd1
              2          2              sd2
              3          0              sd3
              4          4              st0
              5          5              st1
              6          6              cdrom

     The NetBSD kernel is not hard-wired in this manner and names the disks in
     the order that the targets are probed (01234567).  If you only have one
     disk, it is always sd0 irregardless of its SCSI ID or target, and there
     are no problems.  If you have two disks, one at SCSI ID 2 (target 2) and
     SCSI ID 3 (target 0), then they are recognized as sd1 and sd0 respective-
     ly.  This can be a problem if you are not aware of it, particularly when
     creating an fstab.

     There are two approaches to fixing this problem: changing OBP1, and
     changing the NetBSD kernel.  To get OBP1 to number the SCSI targets the
     same as the SCSI IDs, you need to run this command:
           ok setenv sd-targets 01234567
     This may, however, cause problems if you were to later attempt to use
     SunOS on this machine or if you reset the OBP variables.

     The other approach is to use a NetBSD kernel that reverses this odd tar-
     get mapping by treating target 0 (i.e. SCSI ID 3) as sd3 and target 3
     (i.e. SCSI ID 0) as sd0.  The GENERIC_SCSI3 kernel performs this target
     remapping, but the GENERIC and INSTALL kernels do not.

     Note:  This is also a concern when you start building your own customised
            kernels.

     The sun4 models and the machines with OBP2 (SPARCstation/server 2, ELC,
     IPX, and all sun4m models) do not have this target mapping problem.  You
     should be aware, however, that some models have their internal hard
     drives fixed at SCSI ID 3, so it may still be advantageous to use the
     GENERIC_SCSI3 kernel to ensure that your internal drive shows up as sd0.

     Determining how to access your SCSI disk from the ROM

     sunmon and OBP1 use an archaic sd(c,u,p) syntax to address SCSI devices.
     OBP2 uses a more intuitive syntax using device aliases.

     To calculate the parameters for sunmon and OBP1:

     c    specifies the SCSI controller number (first is 0, second is 1, ...)

     u    the hexadecimal number obtained from evaluating the expression `(8 *
          TARGET) + LUN'

     p    the partition number from which to boot (0=`a', 1=`b', etc).
     Therefore, to boot from the swap partition on the internal hard drive
     (first SCSI bus, target 0, lun 0, partition 1), one would use:
           ok boot sd(0,0,1)
     To boot from a CD-ROM (first SCSI bus, target 6, lun 0, partition dynami-
     cally determined), one would use:
           ok boot sd(0,30,)
     And, to boot from the fourth partition (`d', often the /usr partition) on
     an external hard drive (first SCSI bus, target 2, lun 0, partition 3),
     one would use:
           ok boot sd(0,10,3)

     Now, for OBP2, SCSI devices are specified by an OpenBOOT `devalias' which
     provides simple mnemonics for the full path to the device.  Type
     `devalias' in OBP2 to get a list of all of the available aliases.  Just
     the alias and partition are necessary when booting.

     Therefore, to boot from the swap partition on the internal hard drive
     (OBP2 assumes the internal hard drive is at target 3), one would use:
           ok boot disk:b
     To boot from a CD-ROM (OBP2 assumes the CD-ROM is at target 6), one would
     use:
           ok boot cdrom
     And, to boot from the fourth partition (`d', often the /usr partition) on
     an external hard drive (target 2, partition 3), one would use:
           ok boot disk2:d

     The full device path specifier for OBP2 depends on how OBP2 recognizes
     your SCSI controller.  Typically, one would use something like:
     /sbus/esp/sd@t,p where t is the SCSI target and p is the partition num-
     ber.