summaryrefslogtreecommitdiff
path: root/sys/arch/hppa/stand/libsa/dev_hppa.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/hppa/stand/libsa/dev_hppa.c')
-rw-r--r--sys/arch/hppa/stand/libsa/dev_hppa.c62
1 files changed, 48 insertions, 14 deletions
diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c
index 8f7583bb257..faee0acd16b 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.1 1998/06/23 18:46:42 mickey Exp $ */
+/* $OpenBSD: dev_hppa.c,v 1.2 1998/09/29 07:30:59 mickey Exp $ */
/* $NOWHERE: dev_hppa.c,v 2.1 1998/06/17 20:51:54 mickey Exp $ */
/*
@@ -39,9 +39,9 @@
#include <sys/reboot.h>
#include <dev/cons.h>
-#include "dev_hppa.h"
+#include <machine/iomod.h>
-struct pz_device ctdev; /* cartridge tape (boot) device path */
+#include "dev_hppa.h"
extern int debug;
@@ -56,11 +56,12 @@ const struct pdc_devs {
int dev_type;
} pdc_devs[] = {
{ "ct", 0 },
+ { "sd", 1 },
+ { "lf", 2 },
{ "", -1 },
{ "rd", -1 },
{ "sw", -1 },
- { "fl", 1 },
- { "sd", 1 },
+ { "fl", -1 },
};
/* pass dev_t to the open routines */
@@ -73,37 +74,70 @@ devopen(f, fname, file)
register const struct pdc_devs *dp = pdc_devs;
register int rc = 1;
- *file = (char *)fname;
+ if (!(*file = strchr(fname, ':')))
+ return ENODEV;
+ else
+ (*file)++;
#ifdef DEBUG
if (debug)
- printf("devopen:");
+ printf("devopen: ");
#endif
for (dp = pdc_devs; dp < &pdc_devs[NENTS(pdc_devs)]; dp++)
- if (strncmp(fname, dp->name, sizeof(dp->name)-1))
+ if (!strncmp(fname, dp->name, sizeof(dp->name)-1))
break;
if (dp >= &pdc_devs[NENTS(pdc_devs)] || dp->dev_type < 0)
return ENODEV;
+#ifdef DEBUG
+ 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 ((f->f_flags & F_NODEV) == 0)
+ if (!(f->f_flags & F_NODEV))
f->f_dev = &devsw[dp->dev_type];
+ if (!f->f_devdata)
+ *file = NULL;
+
return rc;
}
void
-devboot(bootdev, p)
- dev_t bootdev;
+devboot(dev, p)
+ dev_t dev;
char *p;
{
register const char *q;
+ if (!dev) {
+ int type, unit;
+
+ switch (PAGE0->mem_boot.pz_class) {
+ case PCL_RANDOM:
+ type = 0;
+ unit = PAGE0->mem_boot.pz_layers[0];
+ break;
+ case PCL_SEQU:
+ type = 1;
+ unit = PAGE0->mem_boot.pz_layers[0];
+ break;
+ case PCL_NET_MASK|PCL_SEQU:
+ type = 2;
+ unit = 0;
+ break;
+ default:
+ type = 0;
+ unit = 0;
+ break;
+ }
+ dev = bootdev = MAKEBOOTDEV(type, 0, 0, unit, 0);
+ }
#ifdef _TEST
*p++ = '/';
*p++ = 'd';
@@ -113,9 +147,9 @@ devboot(bootdev, p)
*p++ = 'r';
#endif
/* quick copy device name */
- for (q = pdc_devs[B_TYPE(bootdev)].name; (*p++ = *q++););
- *p++ = '0' + B_UNIT(bootdev);
- *p++ = 'a' + B_PARTITION(bootdev);
+ for (q = pdc_devs[B_TYPE(dev)].name; (*p++ = *q++););
+ p[-1] = '0' + B_UNIT(dev);
+ *p++ = 'a' + B_PARTITION(dev);
*p = '\0';
}