1: /*
   2:  *	SCCS id	@(#)raboot.s	2.0 (2.11BSD)	4/13/91
   3:  */
   4: #include "localopts.h"
   5: 
   6: /  The boot options and device are placed in the last SZFLAGS bytes
   7: /  at the end of core for the bootstrap.
   8: ENDCORE=        160000          / end of core, mem. management off
   9: SZFLAGS=        6               / size of boot flags
  10: BOOTOPTS=       2               / location of options, bytes below ENDCORE
  11: BOOTDEV=        4               / boot unit
  12: CHECKWORD=      6
  13: 
  14: .globl  _doboot, hardboot, _bootcsr
  15: .text
  16: _doboot:
  17:         mov     4(sp),r4        / boot options
  18:         mov     2(sp),r3        / boot device
  19: 
  20: #ifndef KERN_NONSEP
  21: /  If running separate I/D, need to turn off memory management.
  22: /  Call the routine unmap in low text, after setting up a jump
  23: /  in low data where the PC will be pointing.
  24: .globl  unmap
  25:         mov     $137,*$unmap+2          / jmp *$hardboot
  26:         mov     $hardboot,*$unmap+4
  27:         jmp     unmap
  28:         / "return" from unmap will be to hardboot in data
  29: .data
  30: #else
  31: /  Reset to turn off memory management
  32:         reset
  33: #endif
  34: 
  35: /  On power fail, hardboot is the entry point (map is already off)
  36: /  and the args are in r4 (RB_POWRFAIL), r3 (rootdev)
  37: 
  38: hardboot:
  39:         mov     r4, ENDCORE-BOOTOPTS
  40:         ash     $-3,r3          / shift out the partition number
  41:         bic     $!7,r3          / save only the drive number
  42:         mov     r3, ENDCORE-BOOTDEV
  43:         com     r4              / if CHECKWORD == ~bootopts, flags are believed
  44:         mov     r4, ENDCORE-CHECKWORD
  45: 1:
  46:         reset
  47: 
  48: /  The remainder of the code is dependent on the boot device.
  49: /  If you have a bootstrap ROM, just jump to the correct entry.
  50: /  Otherwise, use a BOOT opcode, if available;
  51: /  if necessary, read in block 0 to location 0 "by hand".
  52: /
  53: / RA bootstrap.
  54: /
  55: / Note: this is a complex boot, but then MSCP is complex!!!!
  56: /
  57: / Bootstrap for mscp disk controller tucker@gswd-vms
  58: /
  59: 
  60: MSCPSIZE =      64.     / One MSCP command packet is 64bytes long (need 2)
  61: 
  62: RASEMAP =       140000  / RA controller owner semaphore
  63: 
  64: RAERR =         100000  / error bit
  65: RASTEP1 =       04000   / step1 has started
  66: RAGO =          01      / start operation, after init
  67: RASTCON =       4       / Setup controller info
  68: RAONLIN =       11      / Put unit on line
  69: RAREAD =        41      / Read command code
  70: RAWRITE =       42      / Write command code
  71: RAEND =         200     / End command code
  72: 
  73: RACMDI =        4.      / Command Interrupt
  74: RARSPI =        6.      / Response Interrupt
  75: RARING =        8.      / Ring base
  76: RARSPL =        8.      / Response Command low
  77: RARSPH =        10.     / Response Command high
  78: RACMDL =        12.     / Command to controller low
  79: RACMDH =        14.     / Command to controller high
  80: RARSPS =        16.     / Response packet length (location)
  81: RARSPREF =      20.     / Response reference number
  82: RACMDS =        80.     / Command packet length (location)
  83: RACMDREF =      84.     / Command reference number
  84: RAUNIT =        88.     / Command packet unit
  85: RAOPCODE =      92.     / Command opcode offset
  86: RABYTECT =      96.     / Transfer byte count
  87: RABUFL =        100.    / Buffer location (16 bit addressing only)
  88: RABUFH =        102.    / Buffer location high 6 bits
  89: RALBNL =        112.    / Logical block number low
  90: RALBNH =        114.    / Logical block number high
  91: 
  92: BSIZE   =       512.    / Size of boot block
  93: 
  94: /
  95: / Clear RA MSCP command area!
  96: /
  97:         mov     $ra,r0
  98:         mov     $BSIZE,r1
  99:         mov     r0,sp
 100:         add     r1,sp
 101: 1:
 102:         clr     (r0)+
 103:         sob     r1,1b
 104: /
 105: / RA initialize controller
 106: /
 107:         mov     $RASTEP1,r0
 108:         mov     _bootcsr,r1             / get csr of boot controller
 109:         clr     (r1)+                   / go through controller init seq.
 110:         mov     $icons,r2
 111: 1:
 112:         bit     r0,(r1)
 113:         beq     1b
 114:         mov     (r2)+,(r1)
 115:         asl     r0
 116:         bpl     1b
 117:         mov     $ra+RARSPREF,*$ra+RARSPL / set controller characteristics
 118:         mov     $ra+RACMDREF,*$ra+RACMDL
 119:         mov     $RASTCON,r0
 120:         jsr     pc,racmd
 121:         mov     ENDCORE-BOOTDEV,*$ra+RAUNIT     / bring boot unit online
 122:         mov     $RAONLIN,r0
 123:         jsr     pc,racmd
 124: 
 125: /
 126: / Read in block zero and jump to it
 127: /
 128: /
 129: / RA MSCP read block routine.  This is very primative, so don't expect
 130: / too much from it.  Note that MSCP requires large data communications
 131: / space at end of ADDROFF for command area.
 132: /
 133: /	Load block zero into memory location zero.
 134: /	BSIZE	->	size of block to read
 135: /
 136: / Tim Tucker, Gould Electronics, August 23rd 1985
 137: /
 138:         clr     *$ra+RALBNL             / Put in logical block number
 139:         mov     $BSIZE,*$ra+RABYTECT    / Put in byte to transfer
 140:         clr     *$ra+RABUFL             / Put in disk buffer location
 141:         mov     $RAREAD,r0
 142:         jsr     pc,racmd
 143:         mov     ENDCORE-BOOTDEV,r0      / put unit and
 144:         mov     _bootcsr,r1             /   csr where bootblock expects them
 145:         clr     pc                      / and away we go
 146: /
 147: / perform MSCP command -> response poll version
 148: /
 149: racmd:
 150:         movb    r0,*$ra+RAOPCODE        / fill in command type
 151:         mov     $MSCPSIZE,*$ra+RARSPS   / give controller struct sizes
 152:         mov     $MSCPSIZE,*$ra+RACMDS
 153:         mov     $RASEMAP,*$ra+RARSPH    / set mscp semaphores
 154:         mov     $RASEMAP,*$ra+RACMDH
 155:         mov     *_bootcsr,r0            / tap controllers shoulder
 156:         mov     $ra+RACMDI,r0
 157: 1:
 158:         tst     (r0)
 159:         beq     1b                      / Wait till command read
 160:         clr     (r0)+                   / Tell controller we saw it, ok.
 161: 2:
 162:         tst     (r0)
 163:         beq     2b                      / Wait till response written
 164:         clr     (r0)                    / Tell controller we got it
 165:         rts     pc
 166: 
 167: icons:  RAERR
 168:         ra+RARING
 169:         0
 170:         RAGO
 171: ra:     0

Defined functions

BOOTDEV defined in line 11; used 3 times
BOOTOPTS defined in line 10; used 1 times
  • in line 39
CHECKWORD defined in line 12; used 1 times
  • in line 44
ENDCORE defined in line 8; used 5 times
SZFLAGS defined in line 9; never used
_doboot declared in line 14; defined in line 16; used 1 times
  • in line 14

Defined variables

BSIZE defined in line 92; used 2 times
MSCPSIZE defined in line 60; used 2 times
RABUFH defined in line 88; never used
RABUFL defined in line 87; used 1 times
RABYTECT defined in line 86; used 1 times
RACMDH defined in line 79; used 1 times
RACMDI defined in line 73; used 1 times
RACMDL defined in line 78; used 1 times
RACMDREF defined in line 83; used 1 times
RACMDS defined in line 82; used 1 times
RAEND defined in line 71; never used
RAERR defined in line 64; used 1 times
RAGO defined in line 66; used 1 times
RALBNH defined in line 90; never used
RALBNL defined in line 89; used 1 times
RAONLIN defined in line 68; used 1 times
RAOPCODE defined in line 85; used 1 times
RAREAD defined in line 69; used 1 times
RARING defined in line 75; used 1 times
RARSPH defined in line 77; used 1 times
RARSPI defined in line 74; never used
RARSPL defined in line 76; used 1 times
RARSPREF defined in line 81; used 1 times
RARSPS defined in line 80; used 1 times
RASEMAP defined in line 62; used 2 times
RASTCON defined in line 67; used 1 times
RASTEP1 defined in line 65; used 1 times
RAUNIT defined in line 84; used 1 times
RAWRITE defined in line 70; never used
hardboot declared in line 14; defined in line 38; used 2 times
icons defined in line 167; used 1 times
ra defined in line 171; used 16 times
racmd defined in line 149; used 3 times
Last modified: 1996-06-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3542
Valid CSS Valid XHTML 1.0 Strict