Cleanup and fixes for uVAX boot.

This commit is contained in:
ragge 1995-04-25 14:14:19 +00:00
parent 7d07096c42
commit 589f248bad
13 changed files with 607 additions and 698 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.2 1995/03/29 21:24:01 ragge Exp $
# $NetBSD: Makefile,v 1.3 1995/04/25 14:14:19 ragge Exp $
#
INCPATH=-I. -I../../.. -I../.. -I../../../lib/libsa
@ -7,14 +7,17 @@ CC= cc
AS= as
RELOC= 100000
VAXTYP= -DVAX750 -DVAX630
CFLAGS= -O ${INCPATH} -DSTANDALONE -DRELOC=0x${RELOC}
MACH= -DVAX750
DEVS= autoconf.o hp.o ra.o
LIBS= libsa.a libsvax.a libkern.a
all: boot xxboot bootxx
all: boot xxboot
machine:
ln -s ../include machine
libsa.a: ../../../lib/libsa/libsa.a
@rm -f libsa.a
@ -43,7 +46,7 @@ srt0.o: srt0.s
${CC} -x assembler-with-cpp -E -DREL srt0.s | as -o srt0.o
boot: boot.o srt0.o devopen.o conf.o ${DEVS} ${LIBS}
boot: boot.o srt0.o devopen.o conf.o ${DEVS} ${LIBS} machine
ld -N -T ${RELOC} -e nisse -o $@ srt0.o devopen.o boot.o \
conf.o ${DEVS} ${LIBS}
@strip boot
@ -64,19 +67,13 @@ conf.o: conf.c
boot.o: boot.c
${CC} -c ${CFLAGS} $*.c
bootblocks: start.o bootxx.o init.o romread.o ${LIBS}
xxboot: start.o bootxx.o init.o romread.o ${LIBS} machine
ld -N -T ${RELOC} -o a.out start.o bootxx.o init.o romread.o ${LIBS}
@strip a.out
@size a.out
@dd if=a.out of=bootblocks bs=32 skip=1
@dd if=a.out of=xxboot bs=32 skip=1
@rm -f a.out
xxboot: bootblocks
dd if=bootblocks of=xxboot bs=512 count=1
bootxx: bootblocks
dd if=bootblocks of=bootxx bs=512 skip=1
start.o: start.s
${CC} -x assembler-with-cpp -E start.s | as -o start.o
@ -91,5 +88,5 @@ bootxx.o: bootxx.c
clean:
rm -f start.o romread.o bootxx.o init.o xxboot bootxx bootblocks \
libsvax.a libsa.a libkern.a udiv.o urem.o consio.o
libsvax.a libsa.a libkern.a udiv.o urem.o consio.o machine
rm -f autoconf.o conf.o boot.o hp.o boot srt0.o devopen.o

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootdefs.h,v 1.1 1995/03/29 21:24:04 ragge Exp $ */
/* $NetBSD: bootdefs.h,v 1.2 1995/04/25 14:14:21 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -36,19 +36,6 @@
/* All bugs are subject to removal without further notice */
/*
* from <sys/disklabel.h>
*/
#define LABELSECTOR 0 /* sector containing label */
#define LABELOFFSET 64 /* offset of label in sector */
#define LABELSTART LABELOFFSET
#define LABELSIZE 276 /* found in disklabel.h */
#define LABELEND (LABELSTART+LABELSIZE)
#ifndef DISKMAGIC
#define DISKMAGIC 0x82564557 /* The disk magic number */
#endif
/*
* some uVAX specific constants
*/
@ -63,101 +50,3 @@
#define SIOFF 0x0A /* byte offset into secondary image */
#define LOADSIZE 40
/*
* Processor Register Summary (KA630 UG, 4-4)
*
* Categories:
* 1: VAX processor registers implemented as described in the
* "VAX Architecture Reference Manual".
* 2: VAX processor register implemented external to the MicroVAX
* CPU Chip by the KA630-AA logic.
* 3: Processor registers read as 0, no operation (NOP) on write.
* 4: Processor registers implemented by MicroVAX CPU chip uniquely
* (that is, registers not described in the "VAX Arch. Ref. Man.").
* 5: Processor register access not allowed. Attempted access results
* in reserved operand fault.
* R: An 'R' following the category number indicates that the register
* is cleared by power-up and by the negation of DC OK.
*/
/*
* Mnemonic Number Type, Category, Register Name
*----------------------------------------------------------------------*/
#define PR_KSP 0 /* R/W, 1, Kernel Stack Pointer */
#define PR_ESP 1 /* R/W, 1, Executive Stack Pointer */
#define PR_SSP 2 /* R/W, 1, Supervisor Stack Pointer */
#define PR_USP 3 /* R/W, 1, User Stack Pointer */
#define PR_ISP 4 /* R/W, 1, Interrupt Stack Pointer */
#define PR_RESERVED_05 5 /* 5 */
#define PR_RESERVED_06 6 /* 5 */
#define PR_RESERVER_07 7 /* 5 */
#define PR_P0BR 8 /* R/W, 1, P0 Base Register */
#define PR_P0LR 9 /* R/W, 1, P0 Length Register */
#define PR_P1BR 10 /* R/W, 1, P1 Base Register */
#define PR_P1LR 11 /* R/W, 1, P1 Length Register */
#define PR_SBR 12 /* R/W, 1, System Base Register */
#define PR_SLR 13 /* R/W, 1, System Length Register */
#define PR_RESERVED_14 14 /* 5 */
#define PR_RESERVED_15 15 /* 5 */
#define PR_PCBB 16 /* R/W, 1, Process Control Block Base */
#define PR_SCBB 17 /* R/W, 1, System Control Block Base */
#define PR_IPL 18 /* R/W, 1R, Interrupt Priority Level */
#define PR_ASTLVL 19 /* R/W, 1R, AST Level */
#define PR_SIRR 20 /* W, 1, Software Interrupt Request */
#define PR_SISR 21 /* R/W, 1R, Software Interrupt Summary */
#define PR_IPIR 22 /* R/W, 5, Interprocessor Interrupt */
#define PR_CMIERR 23 /* R/W, 5, CMI Error Register */
#define PR_ICCS 24 /* R/W, 4R, Interval Clock Control/Status */
#define PR_NICR 25 /* W, 3, Next Interval Count Register */
#define PR_ICR 26 /* R, 3, Interval Count Register */
#define PR_TODR 27 /* R/W, 3, TOY Register */
#define PR_CSRS 28 /* R/W, 3, Console Storage Receiver Status */
#define PR_CSRD 29 /* R, 3, Console Storage Receiver Data */
#define PR_CSTS 30 /* R/W, 3, Console Storage Transmit Status */
#define PR_CSTD 31 /* W, 3, Console Storage Transmit Data */
#define PR_RXCS 32 /* R/W, 2R, Console Receiver Control/Status */
#define PR_RXDB 33 /* R, 2R, Console Receiver Data Buffer */
#define PR_TXCS 34 /* R/W, 2R, Console Transmit Control/Status */
#define PR_TXDB 35 /* W, 2R, Console Transmit Data Buffer */
#define PR_TBDR 36 /* R/W, 3, Translation Buffer Disable */
#define PR_CADR 37 /* R/W, 3, Cache Disable Register */
#define PR_MCESR 38 /* R/W, 3, Machine Check Error Summary */
#define PR_CAER 39 /* R/W, 3, Cache Error Register */
#define PR_ACCS 40 /* R/W, 5, Accelerator Control/Status */
#define PR_SAVISP 41 /* R/W, 4, Console Saved ISP */
#define PR_SAVPC 42 /* R/W, 4, Console Saved PC */
#define PR_SAVPSL 43 /* R/W, 4, Console Saved PSL */
#define PR_WCSA 44 /* R/W, 5, WCS Address */
#define PR_WCSB 45 /* R/W, 5, WCS Data */
#define PR_RESERVED_46 46 /* 5 */
#define PR_RESERVED_47 47 /* 5 */
#define PR_SBIFS 48 /* R/W, 3, SBI Fault/Status */
#define PR_SBIS 49 /* R, 3, SBI Silo */
#define PR_SBISC 50 /* R/W, 3, SBI Silo Comparator */
#define PR_SBIMT 51 /* R/W, 3, SBI Silo Maintenance */
#define PR_SBIER 52 /* R/W, 3, SBI Error Register */
#define PR_SBITA 53 /* R, 3, SBI Timeout Address Register */
#define PR_SBIQC 54 /* W, 3, SBI Quadword Clear */
#define PR_IORESET 55 /* W, 2, I/O Bus Reset */
#define PR_MAPEN 56 /* R/W, 1R, Memory Management Enable */
#define PR_TBIA 57 /* W, 1, TB Invalidate All */
#define PR_TBIS 58 /* W, 1, TB Invalidate Single */
#define PR_TBDATA 59 /* R/W, 3, Translation Buffer Data */
#define PR_MBRK 60 /* R/W, 3, Microprogram Break */
#define PR_PMR 61 /* R/W, 3, Performance Monitor Enable */
#define PR_SID 62 /* R, 1, System Identification */
#define PR_TBCHK 63 /* W, 1, Translation Buffer Check */
/* 64 -- 127 reserved (5) */
/*
* EOF
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: bootxx.c,v 1.1 1995/03/29 21:24:06 ragge Exp $ */
/* $NetBSD: bootxx.c,v 1.2 1995/04/25 14:14:22 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@ -36,112 +36,115 @@
#include "sys/param.h"
#include "sys/reboot.h"
#include "sys/disklabel.h"
#include "lib/libsa/stand.h"
#include "lib/libsa/ufs.h"
#include "sys/disklabel.h"
#include "../mba/mbareg.h"
#include "../mba/hpreg.h"
#include "../include/pte.h"
#include "../include/sid.h"
#include "../include/mtpr.h"
#include "data.h"
#include "vaxstand.h"
#include <a.out.h>
int romstrategy(),romopen();
int romstrategy(), romopen();
/*
* Boot program... arguments passed in r10 and r11 determine
* whether boot stops to ask for system name and which device
* boot comes from.
*
* bertram 22-mar-1995: passing arguments in registers removed.
* also any asm-declaration for fixed registers.
* (this was a problem for my cross-compiler)
* [also in boot.c and init.c]
* Boot program... arguments passed in r10 and r11 determine whether boot
* stops to ask for system name and which device boot comes from.
*
* bertram 22-mar-1995: passing arguments in registers removed. also any
* asm-declaration for fixed registers.
*/
volatile u_int devtype, bootdev;
unsigned opendev,boothowto,bootset;
volatile u_int devtype, bootdev;
unsigned opendev, boothowto, bootset;
int cpu_type, cpunumber;
int cpu_type, cpunumber;
int is_uVAX (void) {
return ((cpunumber == VAX_78032 || cpunumber == VAX_650) ? 1 : 0);
int
is_uVAX()
{
return ((cpunumber == VAX_78032 || cpunumber == VAX_650) ? 1 : 0);
}
int is_750 (void) {
return (cpunumber == VAX_750 ? 1 : 0);
int
is_750()
{
return (cpunumber == VAX_750 ? 1 : 0);
}
main()
{
int io, retry, type, i;
initData ();
int io, retry, type, i;
#ifndef FILES_OK /* need this for now. (bertram) */
printf ("\ncpunumber: %d, cpu_type: %x\n", cpunumber, cpu_type);
printf ("files: %d %d %d %d\n", files[0].f_flags,
files[1].f_flags, files[2].f_flags, files[2].f_flags);
for (i=0; i<SOPEN_MAX; i++)
files[i].f_flags = 0;
initData();
#ifdef VERBOSE
printf("\ncpunumber: %d, cpu_type: %x\n", cpunumber, cpu_type);
#endif
if (is_uVAX()) { /* rpb and bootregs[] are */
bootdev = rpb->devtyp; /* initialized in init.c */
boothowto = bootregs[5];
} else if (is_750()) { /* code in start.s places bdev */
bootdev = bootregs[0]; /* in r0/r10, howto in r5/r11 */
boothowto = bootregs[5]; /* so we can use any
* combination */
} else { /* not (yet) neccessary ... */
bootdev = bootregs[10];
boothowto = bootregs[11];
}
bootset = getbootdev();
if (is_uVAX()) {
boothowto = bootregs[5];
bootdev = rpb->devtyp;
}
else {
bootdev = bootregs[10];
boothowto = bootregs[11];
}
bootset=getbootdev();
printf("howto %x, bdev %x, booting...\n", boothowto, bootdev);
printf("\nhowto %x, bdev %x, booting...\n", boothowto, bootdev);
io = open("boot", 0);
printf ("io = %d\n", io);
if (io >= 0 && io < SOPEN_MAX) {
copyunix(io);
} else {
printf("Boot failed.\n");
printf("Boot failed. errno %d (%s)\n", errno, strerror(errno));
}
asm("halt");
}
/*ARGSUSED*/
/* ARGSUSED */
copyunix(aio)
{
register int esym; /* must be r9 */
struct exec x;
register int io = aio, i;
char *addr;
register int esym; /* must be r9 */
struct exec x;
register int io = aio, i;
char *addr;
i=read(io, (char *)&x, sizeof(x));
i = read(io, (char *) &x, sizeof(x));
if (i != sizeof(x) || N_BADMAG(x)) {
printf("Bad format: errno %s\n",strerror(errno));
printf("Bad format: errno %s\n", strerror(errno));
return;
}
printf("%d", x.a_text);
if (N_GETMAGIC(x) == ZMAGIC && lseek(io, 0x400, SEEK_SET) == -1)
if (N_GETMAGIC(x) == ZMAGIC && lseek(io, N_TXTADDR(x), SEEK_SET) == -1)
goto shread;
if (read(io, (char *)0x10000, x.a_text) != x.a_text)
if (read(io, (char *) 0x10000, x.a_text) != x.a_text)
goto shread;
addr = (char *)x.a_text;
addr = (char *) x.a_text;
if (N_GETMAGIC(x) == ZMAGIC || N_GETMAGIC(x) == NMAGIC)
while ((int)addr & CLOFSET)
while ((int) addr & CLOFSET)
*addr++ = 0;
printf("+%d", x.a_data);
if (read(io, addr+0x10000, x.a_data) != x.a_data)
if (read(io, addr + 0x10000, x.a_data) != x.a_data)
goto shread;
addr += x.a_data;
bcopy((void*)0x10000,0,(int)addr);
bcopy((void *) 0x10000, 0, (int) addr);
printf("+%d", x.a_bss);
for (i = 0; i < x.a_bss; i++)
*addr++ = 0;
for (i = 0; i < 128*512; i++) /* slop */
for (i = 0; i < 128 * 512; i++) /* slop */
*addr++ = 0;
printf(" start 0x%x, bootdev %x\n", x.a_entry,bootset);
printf(" start 0x%x\n", x.a_entry);
hoppabort(x.a_entry, boothowto, bootset);
(*((int (*)()) x.a_entry))();
(*((int (*) ()) x.a_entry)) ();
return;
shread:
printf("Short read\n");
@ -150,148 +153,148 @@ shread:
getbootdev()
{
int i,major, adaptor, controller, unit, partition;
int i, major, adaptor, controller, unit, partition;
if (is_uVAX()) {
unit = rpb->unit;
controller = rpb->slave;
adaptor = rpb->csrphy;
}
else {
unit=bootregs[3];
controller = 0;
adaptor = 0; /* Q22 is the only Unibus adaptor */
controller = rpb->slave; /* e.g. DUA ===> 0, DUB ===>
* 1 */
unit = rpb->unit; /* e.g. DUB2 ==> 2, DUA0 ==> 0 */
} else {
unit = bootregs[3]; /* this is for 11/750 */
controller = 0;
}
partition = 0;
switch(bootdev){
case 0: /* massbuss boot */
major = 0; /* hp / ... */
adaptor=(bootregs[1] & 0x6000) >> 17;
switch (bootdev) {
case 0: /* massbuss boot */
major = 0; /* hp / ... */
adaptor = (bootregs[1] & 0x6000) >> 17;
break;
case 17: /* UDA50 boot */
major = 9; /* ra / mscp */
if (! is_uVAX())
adaptor=(bootregs[1] & 0x40000 ? 0 : 1);
case 17: /* UDA50 boot */
major = 9; /* ra / mscp */
if (!is_uVAX())
adaptor = (bootregs[1] & 0x40000 ? 0 : 1);
break;
case 18: /* TK50 boot */
major = 8; /* tm / tmscp */
if (is_uVAX())
break;
case 18: /* TK50 boot */
major = 8; /* tm / tmscp */
if (is_uVAX())
break;
default:
printf("Unsupported boot device %d, trying anyway.\n",bootdev);
boothowto|=(RB_SINGLE|RB_ASKNAME);
printf("Unsupported boot device %d, trying anyway.\n", bootdev);
boothowto |= (RB_SINGLE | RB_ASKNAME);
}
return MAKEBOOTDEV(major, adaptor, controller, unit, partition);
}
struct devsw devsw[]={
{"rom",romstrategy, nullsys,nullsys,noioctl}
struct devsw devsw[] = {
SADEV("rom", romstrategy,nullsys,nullsys, noioctl),
};
int ndevs = (sizeof(devsw)/sizeof(devsw[0]));
int ndevs = (sizeof(devsw) / sizeof(devsw[0]));
struct fs_ops file_system[] = {
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }
struct fs_ops file_system[] = {
{ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat}
};
int nfsys = (sizeof(file_system) / sizeof(struct fs_ops));
int nfsys = (sizeof(file_system) / sizeof(struct fs_ops));
struct disklabel lp;
devopen(f, fname, file)
struct open_file *f;
char *fname;
char **file;
struct open_file *f;
char *fname;
char **file;
{
char *msg;
char *msg;
f->f_dev = &devsw[0];
*file=fname;
*file = fname;
if (is_uVAX())
initCtrl ();
if (is_uVAX())
initCtrl();
msg=getdisklabel((void*)RELOC+LABELOFFSET, &lp);
if(msg)printf("getdisklabel: %s\n",msg);
msg = getdisklabel((void *) RELOC + LABELOFFSET, &lp);
if (msg)
printf("getdisklabel: %s\n", msg);
return 0;
}
extern int bulkread630 (int lbn, int size, void *buf, int *regs);
extern int bulkread630(int lbn, int size, void *buf, int *regs);
extern int read750 (int block, int *regs);
extern int read630 (int block, int *regs);
extern int read750(int block, int *regs);
extern int read630(int block, int *regs);
romstrategy(sc,func,dblk,size,buf,rsize)
void *sc;
int func;
daddr_t dblk;
char *buf;
int size, *rsize;
romstrategy(sc, func, dblk, size, buf, rsize)
void *sc;
int func;
daddr_t dblk;
char *buf;
int size, *rsize;
{
int nsize=size,block=dblk;
int (*readblk)(int,int*);
int nsize = size, block = dblk;
int (*readblk) (int, int *);
if (is_uVAX() && (bootdev == 17 || bootdev == 18)) {
int res;
*rsize = nsize;
res = bulkread630 (block, size, buf, bootregs);
return (res & 0x01 ? 0 : -1);
int res;
*rsize = nsize;
res = bulkread630(block, size, buf, bootregs);
return (res & 0x01 ? 0 : -1);
}
if (is_750() && bootdev == 0) {
*rsize=nsize;
return hpread(block,size,buf);
*rsize = nsize;
return hpread(block, size, buf);
}
if (is_uVAX())
readblk = read630;
readblk = read630;
else if (is_750())
readblk = read750;
readblk = read750;
else {
printf ("Unuspported VAX-type %d.\n", cpunumber);
return (1);
printf("Unuspported VAX-type %d.\n", cpunumber);
return (1);
}
while (size > 0) {
if (! (readblk (block, bootregs) & 0x01))
return (1); /* low-bit clear indicates error */
if (!(readblk(block, bootregs) & 0x01))
return (1); /* low-bit clear indicates error */
bcopy (0, buf, 512); /* readblk writes at adress 0x0 */
size -= 512;
buf += 512;
block++;
bcopy(0, buf, 512); /* readblk writes at adress 0x0 */
size -= 512;
buf += 512;
block++;
}
*rsize=nsize;
*rsize = nsize;
return 0;
}
hpread(block,size,buf)
char *buf;
hpread(block, size, buf)
char *buf;
{
volatile struct mba_regs *mr=(void *)bootregs[1];
volatile struct hp_drv *hd=&mr->mba_md[bootregs[3]];
struct disklabel *dp=&lp;
u_int pfnum, nsize, mapnr,bn, cn, sn, tn;
volatile struct mba_regs *mr = (void *) bootregs[1];
volatile struct hp_drv *hd = (void*)&mr->mba_md[bootregs[3]];
struct disklabel *dp = &lp;
u_int pfnum, nsize, mapnr, bn, cn, sn, tn;
pfnum=(u_int)buf>>PGSHIFT;
pfnum = (u_int) buf >> PGSHIFT;
for(mapnr=0, nsize=size;(nsize+NBPG)>0;nsize-=NBPG)
mr->mba_map[mapnr++]=PG_V|pfnum++;
for (mapnr = 0, nsize = size; (nsize + NBPG) > 0; nsize -= NBPG)
mr->mba_map[mapnr++] = PG_V | pfnum++;
mr->mba_var=((u_int)buf&PGOFSET);
mr->mba_bc=(~size)+1;
bn=block;
cn=bn / dp->d_secpercyl;
sn=bn % dp->d_secpercyl;
tn=sn / dp->d_nsectors;
sn=sn % dp->d_nsectors;
hd->hp_dc=cn;
hd->hp_da=(tn<<8)|sn;
hd->hp_cs1=HPCS_READ;
while(mr->mba_sr&MBASR_DTBUSY);
if(mr->mba_sr&MBACR_ABORT) return 1;
mr->mba_var = ((u_int) buf & PGOFSET);
mr->mba_bc = (~size) + 1;
bn = block;
cn = bn / dp->d_secpercyl;
sn = bn % dp->d_secpercyl;
tn = sn / dp->d_nsectors;
sn = sn % dp->d_nsectors;
hd->hp_dc = cn;
hd->hp_da = (tn << 8) | sn;
hd->hp_cs1 = HPCS_READ;
while (mr->mba_sr & MBASR_DTBUSY);
if (mr->mba_sr & MBACR_ABORT)
return 1;
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.2 1995/03/29 21:24:07 ragge Exp $ */
/* $NetBSD: conf.c,v 1.3 1995/04/25 14:14:23 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -30,28 +30,28 @@
*/
/* All bugs are subject to removal without further notice */
#include "sys/param.h"
#include "lib/libsa/stand.h"
#include "lib/libsa/ufs.h"
#include "vaxstand.h"
int rastrategy(), raopen();
int hpopen(),hpstrategy();
struct devsw devsw[]={
{"hp",hpstrategy, hpopen, nullsys, noioctl},
{"ht",nodev, nodev, nullsys, noioctl},
{"up",nodev, nodev, nullsys, noioctl},
{"hk",nodev, nodev, nullsys, noioctl},
{ 0 ,nodev, nodev, nullsys, noioctl},
{"tm",nodev, nodev, nullsys, noioctl},
{"ts",nodev, nodev, nullsys, noioctl},
{"mt",nodev, nodev, nullsys, noioctl},
{"tu",nodev, nodev, nullsys, noioctl},
{"ra",rastrategy, raopen, nullsys, noioctl},
SADEV("hp",hpstrategy, hpopen, nullsys, noioctl),
SADEV("ht",nullsys, nodev, nullsys, noioctl),
SADEV("up",nullsys, nodev, nullsys, noioctl),
SADEV("hk",nullsys, nodev, nullsys, noioctl),
SADEV( 0 ,nullsys, nodev, nullsys, noioctl),
SADEV("tm",nullsys, nodev, nullsys, noioctl),
SADEV("ts",nullsys, nodev, nullsys, noioctl),
SADEV("mt",nullsys, nodev, nullsys, noioctl),
SADEV("tu",nullsys, nodev, nullsys, noioctl),
SADEV("ra",rastrategy, raopen, nullsys, noioctl),
};
int ndevs = (sizeof(devsw)/sizeof(devsw[0]));

View File

@ -1,4 +1,4 @@
/* $NetBSD: consio.c,v 1.1 1995/02/13 00:41:09 ragge Exp $ */
/* $NetBSD: consio.c,v 1.2 1995/04/25 14:14:24 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -34,8 +34,11 @@
#include "sys/param.h"
#include "../vax/gencons.h"
#include "../include/mtpr.h"
putchar(ch)
int ch;
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: data.h,v 1.1 1995/03/29 21:24:09 ragge Exp $ */
/* $NetBSD: data.h,v 1.2 1995/04/25 14:14:25 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -49,64 +49,64 @@ extern int bootregs[16];
#endif
struct rpb { /* size description */
long base; /* 4 physical base address of block */
long restart; /* 4 physical address of EXE$RESTART */
long chksum; /* 4 checksum of first 31 longwords of EXE$RESTART */
long rststflg; /* 4 Restart in progress flag */
long haltpc; /* 4 PC at HALT/restart */
/* offset: 20 */
long haltpsl; /* 4 PSL at HALT/restart */
long haltcode; /* 4 reason for restart */
long bootr0; /* 24 Saved bootstrap parameters (R0 through R5) */
long bootr1;
long bootr2;
long bootr3;
long bootr4;
long bootr5;
long iovec; /* 4 Address of bootstrap driver */
long iovecsz; /* 4 Size (in bytes) of bootstrap driver */
/* offset: 60 */
long fillbn; /* 4 LBN of seconday bootstrap file */
long filsiz; /* 4 Size (in blocks) of seconday bootstrap file */
long pfnmap[2]; /* 8 Descriptor of PFN bitmap */
long pfncnt; /* 4 Count of physical pages */
/* offset: 80 */
long svaspt; /* 4 system virtual address of system page table */
long csrphy; /* 4 Physical Address of UBA device CSR */
long csrvir; /* 4 Virtual Address of UBA device CSR */
long adpphy; /* 4 Physical Address of adapter configurate reg. */
long adpvir; /* 4 Virtual Address of adapter configurate reg. */
/* offset: 100 */
short unit; /* 2 Bootstrap device unit number */
byte devtyp; /* 1 Bootstrap device type code */
byte slave; /* 1 Bootstrap device slave unit number */
char file[40]; /* 40 Secondary bootstrap file name */
byte confreg[16]; /* 16 Byte array of adapter types */
/* offset: 160 */
long base; /* 4 physical base address of block */
long restart; /* 4 physical address of EXE$RESTART */
long chksum; /* 4 checksum of first 31 longwords of EXE$RESTART */
long rststflg; /* 4 Restart in progress flag */
long haltpc; /* 4 PC at HALT/restart */
/* offset: 20 */
long haltpsl; /* 4 PSL at HALT/restart */
long haltcode; /* 4 reason for restart */
long bootr0; /* 24 Saved bootstrap parameters (R0 through R5) */
long bootr1;
long bootr2;
long bootr3;
long bootr4;
long bootr5;
long iovec; /* 4 Address of bootstrap driver */
long iovecsz; /* 4 Size (in bytes) of bootstrap driver */
/* offset: 60 */
long fillbn; /* 4 LBN of seconday bootstrap file */
long filsiz; /* 4 Size (in blocks) of seconday bootstrap file */
long pfnmap[2]; /* 8 Descriptor of PFN bitmap */
long pfncnt; /* 4 Count of physical pages */
/* offset: 80 */
long svaspt; /* 4 system virtual address of system page table */
long csrphy; /* 4 Physical Address of UBA device CSR */
long csrvir; /* 4 Virtual Address of UBA device CSR */
long adpphy; /* 4 Physical Address of adapter configurate reg. */
long adpvir; /* 4 Virtual Address of adapter configurate reg. */
/* offset: 100 */
short unit; /* 2 Bootstrap device unit number */
byte devtyp; /* 1 Bootstrap device type code */
byte slave; /* 1 Bootstrap device slave unit number */
char file[40]; /* 40 Secondary bootstrap file name */
byte confreg[16]; /* 16 Byte array of adapter types */
/* offset: 160 */
#if 0
byte hdrpgcnt; /* 1 Count of header pages in 2nd bootstrap image */
short bootndt; /* 2 Type of boot adapter */
byte flags; /* 1 Miscellaneous flag bits */
byte hdrpgcnt; /* 1 Count of header pages in 2nd bootstrap image */
short bootndt; /* 2 Type of boot adapter */
byte flags; /* 1 Miscellaneous flag bits */
#else
long align; /* if the compiler doesnt proper alignment */
long align; /* if the compiler doesnt proper alignment */
#endif
long max_pfn; /* 4 Absolute highest PFN */
long sptep; /* 4 System space PTE prototype register */
long sbr; /* 4 Saved system base register */
long cpudbvec; /* 4 Physical address of per-CPU database vector */
/* offset: 180 */
long cca_addr; /* 4 Physical address of CCA */
long slr; /* 4 Saved system length register */
long memdesc[8]; /* 64 Longword array of memory descriptors */
long smp_pc; /* 4 SMP boot page physical address */
long wait; /* 4 Bugcheck loop code for attached processor */
/* offset: 260 */
long badpgs; /* 4 Number of bad pages found in memory scan */
byte ctrlltr; /* 1 Controller letter designation */
byte scbpagct; /* 1 SCB page count */
byte reserved[6]; /* 6 -- */
long vmb_revision; /* 4 VMB revision label */
} ;
long max_pfn; /* 4 Absolute highest PFN */
long sptep; /* 4 System space PTE prototype register */
long sbr; /* 4 Saved system base register */
long cpudbvec; /* 4 Physical address of per-CPU database vector */
/* offset: 180 */
long cca_addr; /* 4 Physical address of CCA */
long slr; /* 4 Saved system length register */
long memdesc[8]; /* 64 Longword array of memory descriptors */
long smp_pc; /* 4 SMP boot page physical address */
long wait; /* 4 Bugcheck loop code for attached processor */
/* offset: 260 */
long badpgs; /* 4 Number of bad pages found in memory scan */
byte ctrlltr; /* 1 Controller letter designation */
byte scbpagct; /* 1 SCB page count */
byte reserved[6]; /* 6 -- */
long vmb_revision; /* 4 VMB revision label */
};
extern struct rpb *rpb;
@ -118,32 +118,28 @@ extern struct rpb *rpb;
*/
struct bqo {
long qio; /* 4 QIO entry */
long map; /* 4 Mapping entry */
long select; /* 4 Selection entry */
long drivrname; /* 4 Offset to driver name */
short version; /* 2 Version number of VMB */
short vercheck; /* 2 Check field */
/* offset: 20 */
long reselect; /* 4 Reselection entry */
long move; /* 4 Move driver entry */
long unit_init; /* 4 Unit initialization entry */
long auxdrname; /* 4 Offset to auxiliary driver name */
long umr_dis; /* 4 UNIBUS Map Registers to disable */
/* offset: 40 */
long ucode; /* 4 Absolute address of booting microcode */
long unit_disc; /* 4 Unit disconnecting entry */
long devname; /* 4 Offset to boot device name */
long umr_tmpl; /* 4 UNIBUS map register template */
/* offset: 60 */
/*
* the rest is unknown / unneccessary ...
*/
long xxx[6]; /* 24 -- total: 84 bytes */
} ;
long qio; /* 4 QIO entry */
long map; /* 4 Mapping entry */
long select; /* 4 Selection entry */
long drivrname; /* 4 Offset to driver name */
short version; /* 2 Version number of VMB */
short vercheck; /* 2 Check field */
/* offset: 20 */
long reselect; /* 4 Reselection entry */
long move; /* 4 Move driver entry */
long unit_init; /* 4 Unit initialization entry */
long auxdrname; /* 4 Offset to auxiliary driver name */
long umr_dis; /* 4 UNIBUS Map Registers to disable */
/* offset: 40 */
long ucode; /* 4 Absolute address of booting microcode */
long unit_disc; /* 4 Unit disconnecting entry */
long devname; /* 4 Offset to boot device name */
long umr_tmpl; /* 4 UNIBUS map register template */
/* offset: 60 */
/*
* the rest is unknown / unneccessary ...
*/
long xxx[6]; /* 24 -- total: 84 bytes */
};
extern struct bqo *bqo;
/*
* EOF
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: devopen.c,v 1.1 1995/02/13 00:41:10 ragge Exp $ */
/* $NetBSD: devopen.c,v 1.2 1995/04/25 14:14:26 ragge Exp $ */
/*-
* Copyright (c) 1993 John Brezak
* All rights reserved.
@ -38,52 +38,42 @@ u_int opendev;
#define ispart(c) ((c) >= 'a' && (c) <= 'h')
#if 0
static int isdigit(char c){
return(((c>='0')&&(c<='9'))?1:0);
}
static int isupper(char c){
return(((c>='A')&&(c<='Z'))?1:0);
}
static char tolower(char c){
return(((c>='A')&&(c<='Z'))?c+32:c);
}
#endif
atoi(char *cp)
int
atoi(cp)
char *cp;
{
int val = 0;
while(isdigit(*cp))
val = val * 10 + (*cp++ - '0');
return(val);
int val = 0;
while(isdigit(*cp))
val = val * 10 + (*cp++ - '0');
return(val);
}
usage()
{
printf("\
Usage: device(adaptor, controller, drive, partition)file\n\
<device><unit><partitonletter>:file\n\
");
printf("\
Usage: device(adaptor, controller, drive, partition)file\n\
<device><unit><partitonletter>:file\n\
");
}
devlookup(char *d, int len)
devlookup(d,len)
char *d;
int len;
{
struct devsw *dp = devsw;
int i;
struct devsw *dp = devsw;
int i;
for (i = 0; i < ndevs; i++, dp++)
if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0)
return(i);
for (i = 0; i < ndevs; i++, dp++)
if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0)
return(i);
printf("No such device - Configured devices are:\n");
for (dp = devsw, i = 0; i < ndevs; i++, dp++)
if (dp->dv_name)
printf(" %s", dp->dv_name);
printf("\n");
errno = ENODEV;
return(-1);
printf("No such device - Configured devices are:\n");
for (dp = devsw, i = 0; i < ndevs; i++, dp++)
if (dp->dv_name)
printf(" %s", dp->dv_name);
printf("\n");
errno = ENODEV;
return(-1);
}
/*
@ -93,89 +83,96 @@ devlookup(char *d, int len)
* [A-Za-z]*[0-9]*[A-Za-z]:file
* dev unit part
*/
devparse(char *fname, int *dev, int *adapt, int *ctlr, int *unit, int *part, char **file)
devparse(fname, dev, adapt, ctlr, unit, part, file)
char *fname;
int *dev, *adapt, *ctlr, *unit, *part;
char **file;
{
int *argp, i;
char *s, *args[4];
int *argp, i;
char *s, *args[4];
/* get device name and make lower case */
for (s = fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
if (isupper(*s)) *s = tolower(*s);
/* get device name and make lower case */
for(s = fname; *s && *s != '/' && *s != ':' && *s != '('; s++)
if(isupper(*s))
*s = tolower(*s);
/* first form */
if (*s == '(') {
/* lookup device and get index */
if ((*dev = devlookup(fname, s - fname)) < 0)
goto baddev;
/* first form */
if(*s == '('){
/* lookup device and get index */
if ((*dev = devlookup(fname, s - fname)) < 0)
goto baddev;
/* tokenize device ident */
args[0] = ++s;
for (args[0] = s, i = 1; *s && *s != ')'; s++) {
if (*s == ',')
args[i++] = ++s;
}
switch(i) {
case 4:
*adapt = atoi(args[0]);
*ctlr = atoi(args[1]);
*unit = atoi(args[2]);
*part = atoi(args[3]);
break;
case 3:
*ctlr = atoi(args[0]);
*unit = atoi(args[1]);
*part = atoi(args[2]);
break;
case 2:
*unit = atoi(args[0]);
*part = atoi(args[1]);
break;
case 1:
*part = atoi(args[0]);
break;
case 0:
break;
}
*file = ++s;
}
/* tokenize device ident */
args[0] = ++s;
for (args[0] = s, i = 1; *s && *s != ')'; s++)
if (*s == ',')
args[i++] = ++s;
/* second form */
else if (*s == ':') {
/* isolate device */
for (s = fname; *s != ':' && !isdigit(*s); s++);
switch(i) {
case 4:
*adapt = atoi(args[0]);
*ctlr = atoi(args[1]);
*unit = atoi(args[2]);
*part = atoi(args[3]);
break;
case 3:
*ctlr = atoi(args[0]);
*unit = atoi(args[1]);
*part = atoi(args[2]);
break;
case 2:
*unit = atoi(args[0]);
*part = atoi(args[1]);
break;
case 1:
*part = atoi(args[0]);
break;
case 0:
break;
}
*file = ++s;
/* second form */
} else if (*s == ':') {
/* isolate device */
for(s = fname; *s != ':' && !isdigit(*s); s++)
;
/* lookup device and get index */
if ((*dev = devlookup(fname, s - fname)) < 0)
goto baddev;
/* lookup device and get index */
if ((*dev = devlookup(fname, s - fname)) < 0)
goto baddev;
/* isolate unit */
if ((*unit = atoi(s)) > sizeof(char))
goto bad;
for (; isdigit(*s); s++);
/* isolate unit */
if ((*unit = atoi(s)) > sizeof(char))
goto bad;
for (; isdigit(*s); s++)
;
/* translate partition */
if (!ispart(*s))
goto bad;
/* translate partition */
if(!ispart(*s))
goto bad;
*part = *s++ - 'a';
if (*s != ':')
goto bad;
*file = ++s;
}
*part = *s++ - 'a';
if(*s != ':')
goto bad;
*file = ++s;
/* no device present */
else
*file = fname;
/* no device present */
} else
*file = fname;
/* return the remaining unparsed part as the file to boot */
return(0);
/* return the remaining unparsed part as the file to boot */
return(0);
bad:
usage();
bad:
usage();
baddev:
return(-1);
}
baddev:
return(-1);
}
extern int bootdev;
devopen(f, fname, file)
@ -194,7 +191,7 @@ devopen(f, fname, file)
part = B_PARTITION(bootdev);
if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
return(error);
return(error);
dp = &devsw[dev];
@ -206,10 +203,10 @@ devopen(f, fname, file)
f->f_dev = dp;
if ((error = (*dp->dv_open)(f, adapt, ctlr, unit, part)) == 0)
return(0);
return(0);
printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name,
adapt, ctlr, unit, part, strerror(error));
adapt, ctlr, unit, part, strerror(error));
return(error);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: hp.c,v 1.2 1995/03/29 21:24:11 ragge Exp $ */
/* $NetBSD: hp.c,v 1.3 1995/04/25 14:14:27 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -34,14 +34,17 @@
#include "sys/param.h"
#include "lib/libsa/stand.h"
#include "sys/disklabel.h"
#include "vaxstand.h"
#include "lib/libsa/stand.h"
#include "../mba/mbareg.h"
#include "../mba/hpreg.h"
#include "../include/pte.h"
#include "../include/macros.h"
#include "vaxstand.h"
/*
* These routines for HP disk standalone boot is wery simple,
* assuming a lots of thing like that we only working at one hp disk
@ -67,7 +70,7 @@ hpopen(f, adapt, ctlr, unit, part)
struct disklabel *lp=&hplabel;
struct hp_softc *hs=&hp_softc;
volatile struct mba_regs *mr=(void *)mbaaddr[ctlr];
volatile struct hp_drv *hd=&mr->mba_md[unit];
volatile struct hp_drv *hd= (void *)&mr->mba_md[unit];
int i,err;
if(adapt>nsbi) return(EADAPT);
@ -106,7 +109,7 @@ hpstrategy(hs, func, dblk, size, buf, rsize)
{
u_int i,pfnum, mapnr, nsize, bn, cn, sn, tn;
volatile struct mba_regs *mr=(void *)mbaaddr[hs->ctlr];
volatile struct hp_drv *hd=&mr->mba_md[hs->unit];
volatile struct hp_drv *hd= (void *)&mr->mba_md[hs->unit];
struct disklabel *lp=&hplabel;
pfnum=(u_int)buf>>PGSHIFT;

View File

@ -1,158 +1,160 @@
/* $NetBSD: init.c,v 1.1 1995/03/29 21:24:12 ragge Exp $ */
/* $NetBSD: init.c,v 1.2 1995/04/25 14:14:28 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* This code is derived from software contributed to Ludd by
* Bertram Barth.
*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden. All rights reserved.
*
* This code is derived from software contributed to Ludd by Bertram Barth.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed at Ludd, University of
* Lule}, Sweden and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* modification, are permitted provided that the following conditions are
* met: 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer. 2.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. 3. All advertising
* materials mentioning features or use of this software must display the
* following acknowledgement: This product includes software developed at
* Ludd, University of Lule}, Sweden and its contributors. 4. The name of the
* author may not be used to endorse or promote products derived from this
* software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* All bugs are subject to removal without further notice */
/* All bugs are subject to removal without further notice */
#include "lib/libsa/stand.h"
#include "../include/mtpr.h" /* mtpr(), mtpr() */
#include "../include/sid.h" /* cpu_type, cpu_number */
#include "data.h" /* bootregs[], rpb, bqo */
#include "lib/libsa/stand.h"
int bootregs[16];
struct rpb *rpb;
struct bqo *bqo;
#include "../include/mtpr.h" /* mfpr(), mtpr() */
#include "../include/sid.h" /* cpu_type, cpu_number */
/*------------------------------*/
int initData (void) {
int *saved_regs;
int *tmp;
int i;
#define NRSP 0 /* Kludge, must be done before udareg.h
* includes */
#define NCMD 0 /* Kludge */
#include "../uba/udareg.h" /* struct udadevice */
saved_regs = (void*)(RELOC);
saved_regs -= 12;
#include "data.h" /* bootregs[], rpb, bqo */
for (i=0; i<12; i++)
bootregs[i] = saved_regs[i];
int bootregs[16];
struct rpb *rpb;
struct bqo *bqo;
cpu_type = mfpr (PR_SID);
cpunumber = (mfpr (PR_SID) >> 24) & 0xFF;
/*
* initData() sets up data gotten from start routines, mostly for uVAX.
*/
int
initData()
{
int *saved_regs;
int *tmp;
int i;
/*
* for MicroVAXen (KA630, KA410, KA650, ...)
* we need to relocate rpb and iovec.
*/
if (cpunumber == VAX_78032 || cpunumber == VAX_650) {
int cpu_sie; /* sid-extension */
int pfn_size; /* size of bitmap */
unsigned char *pfn_bm; /* the pfn-bitmap */
int ntop = 0; /* top of good memory */
saved_regs = (void *) (RELOC);
saved_regs -= 12;
cpu_sie = *((int *)0x20040004) >> 24;
cpu_type |= cpu_sie;
for (i = 0; i < 12; i++)
bootregs[i] = saved_regs[i];
rpb = (void*)bootregs[11]; /* get old rpb */
cpu_type = mfpr(PR_SID);
cpunumber = (mfpr(PR_SID) >> 24) & 0xFF;
pfn_size = rpb->pfnmap[0];
pfn_bm = (void*) rpb->pfnmap[1];
/*
* for MicroVAXen (KA630, KA410, KA650, ...) we need to relocate rpb
* and iovec.
*/
if (cpunumber == VAX_78032 || cpunumber == VAX_650) {
int cpu_sie; /* sid-extension */
int pfn_size; /* size of bitmap */
unsigned char *pfn_bm; /* the pfn-bitmap */
int ntop = 0; /* top of good memory */
while (pfn_size--) {
if (*pfn_bm++ != 0xFF) /* count contigous good memory */
break;
ntop += (8 * 512); /* 8 pages are coded in 1 byte */
}
cpu_sie = *((int *) 0x20040004) >> 24;
cpu_type |= cpu_sie;
ntop = relocate (rpb->iovec, rpb->iovecsz, ntop);
bqo = (void*) ntop; /* new address of iovec */
rpb = (void *) bootregs[11]; /* get old rpb */
ntop = relocate (rpb, 512, ntop);
rpb = (void*) ntop; /* new address of rpb */
rpb->iovec = (int) bqo; /* update iovec in new rpb */
bootregs[11] = (int) rpb; /* update r11's value */
pfn_size = rpb->pfnmap[0];
pfn_bm = (void *) rpb->pfnmap[1];
/*
* bootregs 0..5 are stored in rpb. Since we want/need to use them
* we must copy them from rpb->bootrX into bootregs[X].
* Don\'t forget to update howto/boothowto from value of R5
*/
tmp = (int*) &(rpb->bootr0);
for (i=0; i<=5; i++)
bootregs[i] = tmp[i];
}
while (pfn_size--) {
if (*pfn_bm++ != 0xFF) /* count contigous good */
break; /* memory */
return (0);
}
/*------------------------------*/
int initCtrl (void) {
register int (*init)(void); /* ROM-based initialization routine */
short *ctrlRegs; /* IP-register / SA-register */
int res = 1;
ntop += (8 * 512); /* 8 pages are coded in 1
* byte */
}
res = 1;
#if 0 /* already set by initData ??? */
rpb = (void *)bootregs[11];
bqo = (void *)rpb->iovec;
#endif
ntop = relocate(rpb->iovec, rpb->iovecsz, ntop);
bqo = (void *) ntop; /* new address of iovec */
if (bqo->unit_init) {
init = (void *)bqo + bqo->unit_init;
if (rpb->devtyp == 17 || /* BTD$K_UDA = 17; */
rpb->devtyp == 18) { /* BTD$K_TK50 = 18; */
ctrlRegs = (void *)rpb->csrphy;
/*
* writing into the base-address of the controller (IP Register)
* initializes the RQDX3 controller module ... [RQDX3 ug]
*
* reading the SA register gives the status ==> wait for OK.
*/
ctrlRegs[0] = 0;
printf ("polling ...");
while (1) {
res = ctrlRegs[1];
#ifdef DEBUG
printf ("device-init: AP-register = 0x%x (%d)\n", res, res);
#endif
printf (".");
/*
* RQDX3: 0x0B40 (2880)
* TQK50: 0x0BC0 (3008)
*/
if ((res & 0xFE00) != 0)
break;
ntop = relocate(rpb, 512, ntop);
rpb = (void *) ntop; /* new address of rpb */
rpb->iovec = (int) bqo; /* update iovec in new rpb */
bootregs[11] = (int) rpb; /* update r11's value */
/*
* bootregs 0..5 are stored in rpb. Since we want/need to use
* them we must copy them from rpb->bootrX into bootregs[X].
* Don\'t forget to update howto/boothowto from value of R5
*/
tmp = (int *) &(rpb->bootr0);
for (i = 0; i < 6; i++)
bootregs[i] = tmp[i];
}
printf ("\n");
}
}
printf ("calling ROM-based init() ... ");
res = init ();
printf ("done. result %d (0x%x)\n", res, res);
return (res);
return (0);
}
int
initCtrl()
{
register int (*init) (void); /* ROM-based initialization routine */
struct udadevice *up; /* IP-register / SA-register */
int res = 1;
if (bqo->unit_init) {
init = (void *) bqo + bqo->unit_init;
if (rpb->devtyp == 17 || /* BTD$K_UDA = 17; */
rpb->devtyp == 18) { /* BTD$K_TK50 = 18; */
/*
* writing into the base-address of the controller
* (IP Register) starts initialisation of the RQDX3
* controller module ...
*/
up = (void *) rpb->csrphy;
up->udaip = 0;
/*
* reading the SA register gives the status. wait
* until initialisation started or error (???)
*/
while (1) {
res = up->udasa;
printf("status: 0x%x (%d)\n", res, res);
if ((res & (UDA_STEP1 | UDA_STEP2 | UDA_STEP3 |
UDA_STEP4 | UDA_ERR)) != 0)
break;
}
/*
* RQDX3: 0x0B40 (2880) TQK50: 0x0BC0
* (3008)
*/
}
printf("init() ... ");
res = init(); /* low bit clear indicates error */
printf("done. (0x%x)\n", res);
}
return (res);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ra.c,v 1.1 1995/03/29 21:24:13 ragge Exp $ */
/* $NetBSD: ra.c,v 1.2 1995/04/25 14:14:30 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -35,15 +35,18 @@
#define NCMD 0 /* Kludge */
#include "sys/param.h"
#include "lib/libsa/stand.h"
#include "sys/disklabel.h"
#include "vaxstand.h"
#include "lib/libsa/stand.h"
#include "../include/pte.h"
#include "../include/macros.h"
#include "../uba/ubareg.h"
#include "../uba/udareg.h"
#include "../vax/mscp.h"
#include "vaxstand.h"
/*
* These routines for RA disk standalone boot is wery simple,
* assuming a lots of thing like that we only working at one ra disk

View File

@ -1,4 +1,4 @@
/* $NetBSD: romread.s,v 1.1 1995/03/29 21:24:14 ragge Exp $ */
/* $NetBSD: romread.s,v 1.2 1995/04/25 14:14:31 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -37,12 +37,12 @@
#include "DEFS.h"
#include "../include/asm.h"
/*
* read630 (int block, int *regs)
*/
ENTRY (read630, 0xFFE)
ENTRY(read630, 0xFFE)
movl 8(ap), r11 # array of bootregs
movl 44(r11), r11 # restore boot-contents of r11 (rpb)
movl 52(r11), r7 # load iovec/bqo into r7
@ -59,7 +59,7 @@ ENTRY (read630, 0xFFE)
/*
* read750 (int block, int *regs)
*/
ENTRY (read750, 0xFFE)
ENTRY(read750, 0xFFE)
movl 8(ap), r8
movl 4(r8), r1
movl 8(r8), r2
@ -77,7 +77,7 @@ ENTRY (read750, 0xFFE)
/*
* bulkread630 (int lbn, int size, void *buf, int *regs)
*/
ENTRY (bulkread630, 0xFFE)
ENTRY(bulkread630, 0xFFE)
movl 16(ap), r11 # array of bootregs
movl 44(r11), r11 # restore boot-contents of r11 (rpb)
movl 52(r11), r7 # load iovec/bqo into r7

View File

@ -1,4 +1,4 @@
/* $NetBSD: start.s,v 1.1 1995/03/29 21:24:16 ragge Exp $ */
/* $NetBSD: start.s,v 1.2 1995/04/25 14:14:32 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -36,22 +36,23 @@
/* All bugs are subject to removal without further notice */
#define LOCORE
#include "sys/disklabel.h"
#undef LOCORE
#include "DEFS.h"
#include "../include/asm.h"
#include "bootdefs.h"
/* ---------------------------------------------------------------------- */
_start: .globl _start # this is the symbolic name for the start
# of code to be relocated. We can use this
# to get the actual/real adress (pc-rel)
# or to get the relocated address (abs).
LBN0:
/* ---------------------------------------------------------------------- */
.org 0x00 # uVAX booted from TK50 starts here
brb from_0x00 # continue behind dispatch-block
.org 0x02 # information used by uVAX-ROM
.byte IAREA_OFFSET # offset in words to identification area
.byte (LABELOFFSET + d_end_)/2 # offset in words to identification area
.byte 1 # this byte must be 1(defined by DEC)
.word 0 # logical block number (word swapped)
.word 0 # of the secondary image
@ -63,9 +64,9 @@ LBN0:
brb from_0x0A # skip ...
.org 0x0C # 11/750 starts here
brw cont_750 # skip ...
brw cont_750
/* -------------------- */
#--------------------
from_0x00: # uVAX from TK50
xorl2 $4, bootinfo # this variable tells the difference
from_0x0A: # uVAX from disk
@ -81,34 +82,37 @@ from_0x08: #
xorl2 $4, bootinfo /* yes, it's a TK50 */
1: brw cont_tape
.org LABELSTART - 6
.org LABELOFFSET - 6
regmask: .word 0x0fff # using a variable saves 3 bytes !!!
bootinfo: .long 0x0 # another 3 bytes if within byte-offset
/* -------------------- */
.org LABELSTART
.org LABELEND
# the complete area reserved for label
# must be empty (i.e. filled with zeroes).
# disklabel(8) checks that before installing
# the bootblocks over existing label.
/* -------------------- */
.org IAREA_OFFSET * 2
.byte 0x18 /* must be 0x18 */
.byte 0x00 /* must be 0x00 (MBZ) */
.byte 0x00 /* any value */
/*
* Parameter block for uVAX boot.
*/
.org LABELOFFSET + d_end_
.byte 0x18 # must be 0x18
.byte 0x00 # must be 0x00 (MBZ)
.byte 0x00 # any value
.byte 0xFF - (0x18 + 0x00 + 0x00)
/* 4th byte holds 1s' complement of sum of previous 3 bytes */
.byte 0x00 /* must be 0x00 (MBZ) */
.byte 0x00 # must be 0x00 (MBZ)
.byte VOLINFO
.byte 0x00 /* any value */
.byte 0x00 /* any value */
.byte 0x00 # any value
.byte 0x00 # any value
.long SISIZE /* size in blocks of secondary image */
.long SILOAD /* load offset (usually 0) */
.long SIOFF /* byte offset into secondary image */
.long (SISIZE + SILOAD + SIOFF) /* sum of previous 3 */
.long SISIZE # size in blocks of secondary image
.long SILOAD # load offset (usually 0)
.long SIOFF # byte offset into secondary image
.long (SISIZE + SILOAD + SIOFF) # sum of previous 3
/* -------------------- */
#--------------------
cont_tape: # uVAXen from tape /* ??? */
movl 52(r11), r7 # load iovec into r7
addl3 (r7), r7, funcaddr # store address of qio-entry
@ -124,31 +128,33 @@ cont_tape: # uVAXen from tape /* ??? */
blbs r0, cont_uvax # if successful, goto next stage
halt # if not: FATAL !!!
/* -------------------- */
cont_uvax:
brw start_uvax
/* -------------------- */
.align 2
/*
* After bootblock (LBN0) has been loaded into the first page
* of good memory by 11/750's ROM-code (transfer address
* of bootblock-code is: base of good memory + 0x0C) registers
* are initialized as:
* R0: type of boot-device
* 0: Massbus device
* 1: RK06/RK07
* 2: RL02
* 17: UDA50
* 35: TK50
* 64: TU58
* R1: (UBA) address of UNIBUS I/O-page
* (MBA) address of boot device's adapter
* R2: (UBA) address of the boot device's CSR
* (MBA) controller number of boot device
* R6: address of driver subroutine in ROM
*
* cont_750 reads in LBN1-15 for further execution.
*/
.align 2
cont_750:
/*
* After bootblock (LBN-0) has been loaded into the first page
* and of good memory by 11/750's ROM-code (transfer address
* of bootblock-code is: base of good memory + 0x0C) registers
* are initialized as:
* R0: type of boot-device
* 0: Massbus device
* 1: RK06/RK07
* 2: RL02
* 17: UDA50
* 35: TK50
* 64: TU58
* R1: (UBA) address of UNIBUS I/O-page
* (MBA) address of boot device's adapter
* R2: (UBA) address of the boot device's CSR
* (MBA) controller number of boot device
* R6: address of driver subroutine in ROM
*/
movl r0,r10
movl r5,r11 /* No conversion of bdev in block 0 */
clrl r5
@ -172,16 +178,15 @@ cont_750:
funcaddr: .long 0x11111111
bufaddr: .long 0x33333333
/*
* Start of LBN1. This is on uVAX brought in by those parameters
* in IAREA, on 750 by code cont_750 in LBN0.
*/
.org 512 /* might be paranoid ... */
/* ---------------------------------------------------------------------- */
/* ---------------------------------------------------------------------- */
LBN1:
/* ---------------------------------------------------------------------- */
.org 512
/* -------------------- */
#--------------------
start_uvax:
popr regmask # restore contents of boot-regs
jsb saveregs # and save them
@ -189,31 +194,34 @@ start_uvax:
movl r5, r11 # r5 holds boot-control-flags (howto)
brb start_all
/* -------------------- */
start_750:
jsb saveregs # and save them ...
#--------------------
start_750: # stack has moved. Thus don\'t pop boot-regs
jsb saveregs # save the boot-registers as they are now
movl r0, r10 # r0 holds type of boot-device (bdev)
movl r5, r11 # r5 holds boot-control-flags (howto)
brb start_all
/* -------------------- */
#--------------------
start_all:
movl $_start, sp # new stack directly beyond reloc
subl2 $48, sp # don\'t overwrite saved boot-registers
pushr $0xfff #
subl3 $_start, $_end, r0 # calculate size of code
moval _start, r1 # get actual base-address of code
movl $_start, r2 # get relocated base-address of code
movc3 r0, (r1), (r2) # copy the code to new location
subl3 $_start, $_edata, r0 # get size of text+data (w/o bss)
moval _start, r1 # get actual base-address of code
subl3 $_start, $_end, r2 # get complete size (incl. bss)
movl $_start, r3 # get relocated base-address of code
movc5 r0, (r1), $0, r2, (r3) # copy code to new location
popr $0xfff
jsb L1 # jump to some subroutine where
L1: movl $relocated, (sp) # return-address on top of stack
jsb 1f # jump to some subroutine where
1: movl $relocated, (sp) # return-address on top of stack
rsb # can be replaced with new address
relocated: # now relocation is done !!!
calls $0, _main # call main() which is
halt # not intended to return ...
/* ---------------------------------------------------------------------- */
#----------------------------------------------------------------------
ENTRY(hoppabort, 0)
movl 4(ap),r6
movl 8(ap),r11
@ -221,15 +229,16 @@ ENTRY(hoppabort, 0)
calls $0,(r6)
halt
/* ---------------------------------------------------------------------- */
#----------------------------------------------------------------------
save_sp: .long
saveregs:
movl sp, save_sp # save stack
movl $_start, sp # make new/dummy stack
pushr $0xfff # push registers r0 - r11
movl save_sp, sp # and restore stack
rsb
/* ---------------------------------------------------------------------- */
#----------------------------------------------------------------------
/*
* int relocate (int base, int size, int top)
*/
@ -239,7 +248,4 @@ ENTRY(relocate, 0)
movc3 8(ap), *4(ap), *12(ap) # copy the area/data
movl 12(ap), r0 # return the new base-address
ret
/*----------------------------------------------------------------------*/
/*
* EOF
*/
#----------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
/* $NetBSD: vaxstand.h,v 1.2 1995/03/29 21:24:18 ragge Exp $ */
/* $NetBSD: vaxstand.h,v 1.3 1995/04/25 14:14:34 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@ -31,12 +31,22 @@
/* All bugs are subject to removal without further notice */
/* Variables used in autoconf */
extern int nmba, nuba, nbi, nsbi, nuda;
extern int *ubaaddr, *mbaaddr, *udaaddr, *uioaddr;
#define MAXNMBA 8 /* Massbussadapters */
#define MAXNUBA 8 /* Unibusadapters */
#define MAXNBI 4 /* Bi-bussadapters */
#define MAXMBAU 8 /* Units on an mba */
#define MAXBIN 16 /* Bi-nodes */
/* Variables used in autoconf */
extern int nmba, nuba, nbi, nsbi, nuda;
extern int *ubaaddr, *mbaaddr, *udaaddr, *uioaddr;
/* devsw type definitions, used in bootxx and conf */
#define SADEV(name,strategy,open,close,ioctl) \
{ name, \
(int(*)(void *, int ,daddr_t , u_int , char *, u_int *))strategy, \
(int(*)(struct open_file *, ...))open, \
(int(*)(struct open_file *))close, \
(int(*)(struct open_file *,u_long, void *))ioctl}