summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hppa/stand/libsa/ct.c31
-rw-r--r--sys/arch/hppa/stand/libsa/dev_hppa.c28
-rw-r--r--sys/arch/hppa/stand/libsa/dev_hppa.h17
-rw-r--r--sys/arch/hppa/stand/libsa/dk.c33
-rw-r--r--sys/arch/hppa/stand/libsa/exec_hppa.c6
-rw-r--r--sys/arch/hppa/stand/libsa/itecons.c9
-rw-r--r--sys/arch/hppa/stand/libsa/lf.c21
-rw-r--r--sys/arch/hppa/stand/libsa/machdep.c34
-rw-r--r--sys/arch/hppa/stand/libsa/pdc.c21
9 files changed, 81 insertions, 119 deletions
diff --git a/sys/arch/hppa/stand/libsa/ct.c b/sys/arch/hppa/stand/libsa/ct.c
index 7e09d20105b..6b30f5a5458 100644
--- a/sys/arch/hppa/stand/libsa/ct.c
+++ b/sys/arch/hppa/stand/libsa/ct.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ct.c,v 1.4 1999/02/13 04:43:18 mickey Exp $ */
+/* $OpenBSD: ct.c,v 1.5 1999/04/20 20:01:01 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -56,6 +56,7 @@
#include <sys/param.h>
#include <sys/disklabel.h>
#include <sys/reboot.h>
+
#include <machine/pdc.h>
#include <machine/iomod.h>
@@ -64,23 +65,6 @@
struct pz_device ctdev;
iodcio_t ctiodc; /* cartridge tape IODC entry point */
int ctcode[IODC_MAXSIZE/sizeof(int)];
-char ctbuf[IODC_MAXSIZE] __attribute__ ((aligned(MINIOSIZ)));
-
-/* hp800-specific comments:
- *
- * Tape driver ALWAYS uses "Alternate Boot Device", which is assumed to ALWAYS
- * be the boot device in pagezero (meaning we booted from it).
- *
- * NOTE about skipping file, below: It's assumed that a read gets 2k (a page).
- * This is done because, even though the cartridge tape has record sizes of 1k,
- * and an EOF takes one record, reads through the IODC must be in 2k chunks,
- * and must start on a 2k-byte boundary. This means that ANY TAPE FILE TO BE
- * SKIPPED OVER IS GOING TO HAVE TO BE AN ODD NUMBER OF 1 KBYTE RECORDS so the
- * read of the subsequent file can start on a 2k boundary. If a real error
- * occurs, the record count is reset below, so this isn't a problem.
- */
-int ctbyteno; /* block number on tape to access next */
-int ctworking; /* flag: have we read anything successfully? */
int
#ifdef __STDC__
@@ -90,6 +74,7 @@ ctopen(f)
struct open_file *f;
#endif
{
+ register struct hppa_dev *dp = f->f_devdata;
int ret;
if (ctiodc == 0) {
@@ -102,9 +87,12 @@ ctopen(f)
ctdev.pz_iodc_io = ctiodc = (iodcio_t) ctcode;
}
+ dp->pz_dev = &ctdev;
+
if (ctiodc != NULL)
if ((ret = (*ctiodc)(ctdev.pz_hpa, IODC_IO_READ, ctdev.pz_spa,
- ctdev.pz_layers, pdcbuf,0, ctbuf,0,0)) < 0)
+ ctdev.pz_layers, pdcbuf, 0,
+ dp->buf, 0, 0)) < 0)
printf("ct: device rewind ret'd %d\n", ret);
return (0);
@@ -115,8 +103,7 @@ int
ctclose(f)
struct open_file *f;
{
- ctbyteno = 0;
- ctworking = 0;
-
+ free (f->f_devdata, sizeof(struct hppa_dev));
+ f->f_devdata = NULL;
return 0;
}
diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c
index 6a575d05663..f2a7f43a918 100644
--- a/sys/arch/hppa/stand/libsa/dev_hppa.c
+++ b/sys/arch/hppa/stand/libsa/dev_hppa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev_hppa.c,v 1.4 1999/02/13 04:43:18 mickey Exp $ */
+/* $OpenBSD: dev_hppa.c,v 1.5 1999/04/20 20:01:01 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -55,7 +55,7 @@ const struct pdc_devs {
int dev_type;
} pdc_devs[] = {
{ "ct", 0 },
- { "sd", 1 },
+ { "dk", 1 },
{ "lf", 2 },
{ "", -1 },
{ "rd", -1 },
@@ -70,6 +70,7 @@ devopen(f, fname, file)
const char *fname;
char **file;
{
+ register struct hppa_dev *hpd;
register const struct pdc_devs *dp = pdc_devs;
register int rc = 1;
@@ -78,7 +79,7 @@ devopen(f, fname, file)
else
(*file)++;
-#ifdef DEBUG
+#ifdef DEBUGBUG
if (debug)
printf("devopen: ");
#endif
@@ -89,14 +90,27 @@ devopen(f, fname, file)
if (dp >= &pdc_devs[NENTS(pdc_devs)] || dp->dev_type < 0)
return ENODEV;
-#ifdef DEBUG
+#ifdef DEBUGBUG
if (debug)
printf("%s\n", dp->name);
#endif
- if ((rc = (*devsw[dp->dev_type].dv_open)(f, file)) == 0) {
- f->f_dev = &devsw[dp->dev_type];
- return 0;
+ if (!(hpd = alloc(sizeof *hpd))) {
+#ifdef DEBUG
+ printf ("devopen: no mem\n");
+#endif
+ } else {
+ bzero(hpd, sizeof *hpd);
+ hpd->bootdev = bootdev;
+ hpd->buf = (char *)(((u_int)hpd->ua_buf + IODC_MINIOSIZ-1) &
+ ~(IODC_MINIOSIZ-1));
+ f->f_devdata = hpd;
+ if ((rc = (*devsw[dp->dev_type].dv_open)(f, file)) == 0) {
+ f->f_dev = &devsw[dp->dev_type];
+ return 0;
+ }
+ free (hpd, 0);
+ f->f_devdata = NULL;
}
if (!(f->f_flags & F_NODEV))
diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.h b/sys/arch/hppa/stand/libsa/dev_hppa.h
index 99e59722734..f4c6e75cb40 100644
--- a/sys/arch/hppa/stand/libsa/dev_hppa.h
+++ b/sys/arch/hppa/stand/libsa/dev_hppa.h
@@ -1,12 +1,9 @@
-/* $OpenBSD: dev_hppa.h,v 1.2 1998/09/29 07:30:59 mickey Exp $ */
+/* $OpenBSD: dev_hppa.h,v 1.3 1999/04/20 20:01:01 mickey Exp $ */
-#define MINIOSIZ 64 /* minimum buffer size for IODC call */
-#define MAXIOSIZ (64 * 1024) /* maximum buffer size for IODC call */
-#define IONBPG (2 * 1024) /* page alignment for I/O buffers */
-#define IOPGSHIFT 11 /* LOG2(IONBPG) */
-#define IOPGOFSET (IONBPG-1) /* byte offset into I/O buffer */
-#define BTIOSIZ (8 * 1024) /* size of boot device I/O buffer */
+#define IOPGSHIFT 11
+#define IONBPG (1 << IOPGSHIFT)
+#define IOPGOFSET (IONBPG - 1)
struct disklabel;
struct hppa_dev {
@@ -14,9 +11,11 @@ struct hppa_dev {
struct pz_device *pz_dev; /* device descriptor */
daddr_t last_blk; /* byte offset for last read blk */
size_t last_read; /* amount read last time */
- char buf[BTIOSIZ+MINIOSIZ]; /* will be used for unaligned io */
-
struct disklabel *label;
+ /* buffer to cache data (aligned properly) */
+ char *buf;
+ char ua_buf[IODC_MAXIOSIZ + IODC_MINIOSIZ];
+
};
#ifdef PDCDEBUG
diff --git a/sys/arch/hppa/stand/libsa/dk.c b/sys/arch/hppa/stand/libsa/dk.c
index 1b9cde6bcef..b974fec4085 100644
--- a/sys/arch/hppa/stand/libsa/dk.c
+++ b/sys/arch/hppa/stand/libsa/dk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dk.c,v 1.4 1998/10/30 19:42:17 mickey Exp $ */
+/* $OpenBSD: dk.c,v 1.5 1999/04/20 20:01:01 mickey Exp $ */
/*
* Copyright 1996 1995 by Open Software Foundation, Inc.
@@ -39,12 +39,12 @@ dk_disklabel(dp, label)
struct hppa_dev *dp;
struct disklabel *label;
{
- char buf[IONBPG];
- size_t ret;
+ char buf[DEV_BSIZE];
+ int ret;
- if (iodcstrategy(dp, F_READ, LABELSECTOR, IONBPG, buf, &ret))
+ if (iodcstrategy(dp, F_READ, LABELSECTOR, DEV_BSIZE, buf, &ret))
if (ret != DEV_BSIZE)
- return "cannot read LIF header";
+ return "cannot read disklabel";
return (getdisklabel(buf, label));
}
@@ -58,8 +58,7 @@ dkopen(f, va_alist)
#endif
{
register struct disklabel *lp;
- register struct hppa_dev *dp;
- register struct pz_device *pzd;
+ register struct hppa_dev *dp = f->f_devdata;
register const char *st;
#ifdef DEBUG
@@ -67,24 +66,9 @@ dkopen(f, va_alist)
printf("dkopen(%p)\n", f);
#endif
- if (!(pzd = pdc_findev(-1, PCL_RANDOM)))
+ if (!(dp->pz_dev = pdc_findev(-1, PCL_RANDOM)))
return ENXIO;
-#ifdef DEBUG
- if (debug)
- printf("alloc\n");
-#endif
- if (!(dp = alloc(sizeof *dp))) {
-#ifdef DEBUG
- printf ("dkopen: no mem\n");
-#endif
- return ENODEV;
- }
-
- bzero(dp, sizeof *dp);
-
- dp->bootdev = bootdev;
- dp->pz_dev = pzd;
lp = dp->label;
st = NULL;
#if 0
@@ -107,11 +91,10 @@ dkopen(f, va_alist)
}
}
#endif
-#ifdef DEBUG
+#ifdef DEBUGBUG
if (debug)
printf ("dkopen() ret\n");
#endif
- f->f_devdata = dp;
return (0);
}
diff --git a/sys/arch/hppa/stand/libsa/exec_hppa.c b/sys/arch/hppa/stand/libsa/exec_hppa.c
index f3a151e8bd9..788f3a9b92f 100644
--- a/sys/arch/hppa/stand/libsa/exec_hppa.c
+++ b/sys/arch/hppa/stand/libsa/exec_hppa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec_hppa.c,v 1.5 1999/02/13 04:35:07 mickey Exp $ */
+/* $OpenBSD: exec_hppa.c,v 1.6 1999/04/20 20:01:02 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -64,8 +64,6 @@ machdep_exec(xp, howto, loadaddr)
makebootargs(av, &ac);
#endif
- fcacheall();
-
#ifdef EXEC_DEBUG
if (debug) {
printf("ep=0x%x [", xp->xp_entry);
@@ -81,6 +79,8 @@ machdep_exec(xp, howto, loadaddr)
}
#endif
+ fcacheall();
+
__asm("mtctl %r0, %cr17");
__asm("mtctl %r0, %cr17");
/* stack and the gung is ok at this point, so, no need for asm setup */
diff --git a/sys/arch/hppa/stand/libsa/itecons.c b/sys/arch/hppa/stand/libsa/itecons.c
index 007d9df9a33..e87e4980208 100644
--- a/sys/arch/hppa/stand/libsa/itecons.c
+++ b/sys/arch/hppa/stand/libsa/itecons.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: itecons.c,v 1.5 1998/09/29 07:28:35 mickey Exp $ */
+/* $OpenBSD: itecons.c,v 1.6 1999/04/20 20:01:02 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -69,7 +69,7 @@ pz_device_t *cons_pzdev, *kbd_pzdev;
* Console.
*/
-char cnbuf[MINIOSIZ] __attribute__ ((aligned (MINIOSIZ)));
+char cnbuf[IODC_MINIOSIZ] __attribute__ ((aligned (IODC_MINIOSIZ)));
int kycode[IODC_MAXSIZE/sizeof(int)];
int
@@ -168,7 +168,7 @@ ite_getc(dev)
dev_t dev;
{
static int stash = 0;
- register int err, c, l;
+ register int err, c, l, i;
if (kyiodc == NULL)
return(0x100);
@@ -180,6 +180,7 @@ ite_getc(dev)
return c;
}
+ i = 16;
do {
err = (*kyiodc)(kbd_pzdev->pz_hpa, IODC_IO_CONSIN,
kbd_pzdev->pz_spa, kbd_pzdev->pz_layers,
@@ -192,7 +193,7 @@ ite_getc(dev)
#endif
/* if we are doing ischar() report immidiatelly */
- if (dev & 0x80 && l == 0) {
+ if (!i-- && (dev & 0x80) && l == 0) {
#ifdef DEBUG
if (debug > 2)
printf("ite_getc(0x%x): no char %d(%x)\n",
diff --git a/sys/arch/hppa/stand/libsa/lf.c b/sys/arch/hppa/stand/libsa/lf.c
index f773e1178be..5440e4dbee6 100644
--- a/sys/arch/hppa/stand/libsa/lf.c
+++ b/sys/arch/hppa/stand/libsa/lf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lf.c,v 1.2 1998/09/29 07:17:46 mickey Exp $ */
+/* $OpenBSD: lf.c,v 1.3 1999/04/20 20:01:02 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -45,26 +45,11 @@ lfopen(f, va_alist)
struct open_file *f;
#endif
{
- struct hppa_dev *dp;
- struct pz_device *pzd;
+ register struct hppa_dev *dp = f->f_devdata;;
- if (!(pzd = pdc_findev(-1, PCL_NET_MASK|PCL_SEQU)))
+ if (!(dp->pz_dev = pdc_findev(-1, PCL_NET_MASK|PCL_SEQU)))
return ENXIO;
- if (!(dp = alloc(sizeof(struct hppa_dev)))) {
-#ifdef DEBUG
- printf("lfopen: no mem\n");
-#endif
- return ENODEV;
- }
-
- bzero (dp, sizeof (struct hppa_dev));
- dp->pz_dev = pzd;
- dp->bootdev = bootdev;
- dp->last_blk = 0;
- dp->last_read = 0;
- f->f_devdata = dp;
-
return 0;
}
diff --git a/sys/arch/hppa/stand/libsa/machdep.c b/sys/arch/hppa/stand/libsa/machdep.c
index 6f0eccca0a3..79b285cee48 100644
--- a/sys/arch/hppa/stand/libsa/machdep.c
+++ b/sys/arch/hppa/stand/libsa/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.3 1999/02/13 04:43:18 mickey Exp $ */
+/* $OpenBSD: machdep.c,v 1.4 1999/04/20 20:01:02 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -53,38 +53,32 @@ machdep()
#ifdef PDCDEBUG
if (debug) {
+ register int i;
+
printf("SSTOR:\n");
printf("pri_boot="); DEVPATH_PRINT(&sstor.ss_pri_boot);
printf("alt_boot="); DEVPATH_PRINT(&sstor.ss_alt_boot);
printf("console ="); DEVPATH_PRINT(&sstor.ss_console);
printf("keyboard="); DEVPATH_PRINT(&sstor.ss_keyboard);
- printf("mem=%d, fn=%s, osver=%d\n"
- "os={%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,\n"
- "%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x}\n",
+ printf("mem=%d, fn=%s, osver=%d\nos={",
sstor.ss_fast_size, sstor.ss_filenames,
- sstor.ss_os_version,
- sstor.ss_os[0], sstor.ss_os[1], sstor.ss_os[2],
- sstor.ss_os[3], sstor.ss_os[4], sstor.ss_os[5],
- sstor.ss_os[6], sstor.ss_os[7], sstor.ss_os[8],
- sstor.ss_os[9], sstor.ss_os[10], sstor.ss_os[11],
- sstor.ss_os[12], sstor.ss_os[13], sstor.ss_os[14],
- sstor.ss_os[15], sstor.ss_os[16], sstor.ss_os[17],
- sstor.ss_os[18], sstor.ss_os[19], sstor.ss_os[20],
- sstor.ss_os[21]);
+ sstor.ss_os_version);
+ for (i = 0; i < sizeof(sstor.ss_os); i++)
+ printf ("%x%c", sstor.ss_os[i], (i%8)? ',' : '\n');
- printf("PAGE0:\n");
- printf("ivec=%x, pf=%p[%u], toc=%p[%u], rendz=%p\n"
- "mem: cont=%u, phys=%u, pdc_spa=%u, resv=%u, free=%x\n"
- "cpu_hpa=%p, pdc=%p, imm_hpa=%p[%u,%u]\n"
- "soft=%u, tic/10ms=%u\n",
+ printf("}\nPAGE0:\n");
+ printf("ivec=%x, pf=%p[%u], toc=%p[%u], rndz=%p, clk/10ms=%u\n",
PAGE0->ivec_special, PAGE0->ivec_mempf,
PAGE0->ivec_mempflen, PAGE0->ivec_toc,
PAGE0->ivec_toclen, PAGE0->ivec_rendz,
+ PAGE0->mem_10msec);
+ printf ("mem: cont=%u, phys=%u, pdc_spa=%u, resv=%u, free=%x\n"
+ "cpu_hpa=%p, pdc=%p, imm_hpa=%p[%u,%u], soft=%u\n",
PAGE0->memc_cont, PAGE0->memc_phsize, PAGE0->memc_adsize,
PAGE0->memc_resv, PAGE0->mem_free, PAGE0->mem_hpa,
PAGE0->mem_pdc, PAGE0->imm_hpa, PAGE0->imm_spa_size,
- PAGE0->imm_max_mem, PAGE0->imm_soft_boot,
- PAGE0->mem_10msec);
+ PAGE0->imm_max_mem, PAGE0->imm_soft_boot);
+
printf("console: "); PZDEV_PRINT(&PAGE0->mem_cons);
printf("boot: "); PZDEV_PRINT(&PAGE0->mem_boot);
printf("keyboard: "); PZDEV_PRINT(&PAGE0->mem_kbd);
diff --git a/sys/arch/hppa/stand/libsa/pdc.c b/sys/arch/hppa/stand/libsa/pdc.c
index 4f65f6552ac..98e6a9c6db0 100644
--- a/sys/arch/hppa/stand/libsa/pdc.c
+++ b/sys/arch/hppa/stand/libsa/pdc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pdc.c,v 1.8 1999/02/13 04:43:18 mickey Exp $ */
+/* $OpenBSD: pdc.c,v 1.9 1999/04/20 20:01:02 mickey Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -139,8 +139,6 @@ iodcstrategy(devdata, rw, blk, size, buf, rsize)
struct hppa_dev *dp = devdata;
struct pz_device *pzdev = dp->pz_dev;
register int offset, xfer, ret;
- register char *bbuf = (void*) /* align */
- ((((int)dp->buf) + MINIOSIZ - 1) & ~(MINIOSIZ - 1));
#ifdef PDCDEBUG
if (debug)
@@ -162,7 +160,7 @@ iodcstrategy(devdata, rw, blk, size, buf, rsize)
twiddle();
if ((ret = (pzdev->pz_iodc_io)(pzdev->pz_hpa,
IODC_IO_READ, pzdev->pz_spa, pzdev->pz_layers,
- pdcbuf, 0, bbuf, 0, 0)) < 0) {
+ pdcbuf, 0, dp->buf, 0, 0)) < 0) {
#ifdef DEBUG
if (debug)
printf("IODC_IO: %d\n", ret);
@@ -183,9 +181,9 @@ iodcstrategy(devdata, rw, blk, size, buf, rsize)
twiddle();
dp->last_blk += dp->last_read;
if ((ret = (pzdev->pz_iodc_io)(pzdev->pz_hpa,
- IODC_IO_READ,
- pzdev->pz_spa, pzdev->pz_layers, pdcbuf,
- dp->last_blk, bbuf, BTIOSIZ, BTIOSIZ)) < 0) {
+ IODC_IO_READ, pzdev->pz_spa, pzdev->pz_layers,
+ pdcbuf, dp->last_blk, dp->buf, IODC_MAXIOSIZ,
+ IODC_MAXIOSIZ)) < 0) {
#ifdef DEBUG
if (debug)
printf("IODC_IO: %d\n", ret);
@@ -218,7 +216,7 @@ iodcstrategy(devdata, rw, blk, size, buf, rsize)
printf("off=%d,xfer=%d,size=%d,blk=%d\n",
offset, xfer, size, blk);
#endif
- bcopy(bbuf + offset, buf, xfer);
+ bcopy(dp->buf + offset, buf, xfer);
buf += xfer;
}
@@ -231,11 +229,12 @@ iodcstrategy(devdata, rw, blk, size, buf, rsize)
if ((ret = (pzdev->pz_iodc_io)(pzdev->pz_hpa,
(rw == F_READ? IODC_IO_READ: IODC_IO_WRITE),
pzdev->pz_spa, pzdev->pz_layers, pdcbuf,
- blk - offset, bbuf, BTIOSIZ, BTIOSIZ)) < 0) {
+ blk - offset, dp->buf, IODC_MAXIOSIZ,
+ IODC_MAXIOSIZ)) < 0) {
#ifdef DEBUG
if (debug)
printf("iodc_read(%d,%d): %d\n",
- blk - offset, BTIOSIZ, ret);
+ blk - offset, IODC_MAXIOSIZ, ret);
#endif
if (xfer)
break;
@@ -248,7 +247,7 @@ iodcstrategy(devdata, rw, blk, size, buf, rsize)
dp->last_read = ret;
if ((ret -= offset) > size)
ret = size;
- bcopy(bbuf + offset, buf, ret);
+ bcopy(dp->buf + offset, buf, ret);
#ifdef PDCDEBUG
if (debug)
printf("read %d(%d,%d)@%x ", ret,