summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/luna88k/stand/boot/autoconf.c104
-rw-r--r--sys/arch/luna88k/stand/boot/bmd.c106
-rw-r--r--sys/arch/luna88k/stand/boot/boot.c17
-rw-r--r--sys/arch/luna88k/stand/boot/device.h55
-rw-r--r--sys/arch/luna88k/stand/boot/font.c4
-rw-r--r--sys/arch/luna88k/stand/boot/if_le.c10
-rw-r--r--sys/arch/luna88k/stand/boot/init_main.c5
-rw-r--r--sys/arch/luna88k/stand/boot/ioconf.c24
-rw-r--r--sys/arch/luna88k/stand/boot/samachdep.h5
-rw-r--r--sys/arch/luna88k/stand/boot/sc.c51
-rw-r--r--sys/arch/luna88k/stand/boot/sd.c37
-rw-r--r--sys/arch/luna88k/stand/boot/sio.c16
12 files changed, 190 insertions, 244 deletions
diff --git a/sys/arch/luna88k/stand/boot/autoconf.c b/sys/arch/luna88k/stand/boot/autoconf.c
index 93223a5a2e3..d4a875a69af 100644
--- a/sys/arch/luna88k/stand/boot/autoconf.c
+++ b/sys/arch/luna88k/stand/boot/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: autoconf.c,v 1.7 2013/01/22 15:48:40 tsutsui Exp $ */
/*
@@ -193,10 +193,7 @@ find_controller(struct hp_hw *hw)
if ((*hc->hp_driver->d_init)(hc)) {
hc->hp_alive = 1;
printf("%s%d", hc->hp_driver->d_name, hc->hp_unit);
- printf(" at %p,", hc->hp_addr);
- if (hc->hp_flags)
- printf(" flags 0x%x", hc->hp_flags);
- printf("\n");
+ printf(" at %p\n", hc->hp_addr);
find_slaves(hc);
} else
hc->hp_addr = oaddr;
@@ -216,13 +213,13 @@ find_device(struct hp_hw *hw)
hw->hw_name, hw->hw_addr, hw->hw_type);
#endif
match_d = NULL;
- for (hd = hp_dinit; hd->hp_driver; hd++) {
- if (hd->hp_alive)
+ for (hd = hp_dinit; hd->hpd_driver; hd++) {
+ if (hd->hpd_alive)
continue;
/* Must not be a slave */
- if (hd->hp_cdriver)
+ if (hd->hpd_cdriver)
continue;
- addr = hd->hp_addr;
+ addr = hd->hpd_addr;
/*
* Exact match; all done.
*/
@@ -241,8 +238,8 @@ find_device(struct hp_hw *hw)
if (acdebug) {
if (match_d)
printf("found %s%d\n",
- match_d->hp_driver->d_name,
- match_d->hp_unit);
+ match_d->hpd_driver->d_name,
+ match_d->hpd_unit);
else
printf("not found\n");
}
@@ -258,17 +255,14 @@ find_device(struct hp_hw *hw)
* Note, we can still fail if HW won't initialize.
*/
hd = match_d;
- oaddr = hd->hp_addr;
- hd->hp_addr = hw->hw_addr;
- if ((*hd->hp_driver->d_init)(hd)) {
- hd->hp_alive = 1;
- printf("%s%d", hd->hp_driver->d_name, hd->hp_unit);
- printf(" at %p", hd->hp_addr);
- if (hd->hp_flags)
- printf(", flags 0x%x", hd->hp_flags);
- printf("\n");
+ oaddr = hd->hpd_addr;
+ hd->hpd_addr = hw->hw_addr;
+ if ((*hd->hpd_driver->d_init)(hd)) {
+ hd->hpd_alive = 1;
+ printf("%s%d", hd->hpd_driver->d_name, hd->hpd_unit);
+ printf(" at %p\n", hd->hpd_addr);
} else
- hd->hp_addr = oaddr;
+ hd->hpd_addr = oaddr;
return(1);
}
@@ -298,7 +292,7 @@ find_slaves(struct hp_ctlr *hc)
new_s = new_c = -1;
for (s = 0; s < maxslaves; s++) {
match_s = NULL;
- for (hd = hp_dinit; hd->hp_driver; hd++) {
+ for (hd = hp_dinit; hd->hpd_driver; hd++) {
/*
* Rule out the easy ones:
* 1. slave already assigned or not a slave
@@ -306,13 +300,13 @@ find_slaves(struct hp_ctlr *hc)
* 3. controller specified but not this one
* 4. slave specified but not this one
*/
- if (hd->hp_alive || hd->hp_cdriver == NULL)
+ if (hd->hpd_alive || hd->hpd_cdriver == NULL)
continue;
- if (!dr_type(hc->hp_driver, hd->hp_cdriver->d_name))
+ if (!dr_type(hc->hp_driver, hd->hpd_cdriver->d_name))
continue;
- if (hd->hp_ctlr >= 0 && hd->hp_ctlr != hc->hp_unit)
+ if (hd->hpd_ctlr >= 0 && hd->hpd_ctlr != hc->hp_unit)
continue;
- if (hd->hp_slave >= 0 && hd->hp_slave != s)
+ if (hd->hpd_slave >= 0 && hd->hpd_slave != s)
continue;
/*
* Case 0: first possible match.
@@ -331,7 +325,7 @@ find_slaves(struct hp_ctlr *hc)
* "reserve" locations for dynamic addition of
* disk/tape drives by fully qualifing the location.
*/
- if (hd->hp_slave == s && hd->hp_ctlr == hc->hp_unit) {
+ if (hd->hpd_slave == s && hd->hpd_ctlr == hc->hp_unit) {
match_s = hd;
break;
}
@@ -339,8 +333,8 @@ find_slaves(struct hp_ctlr *hc)
* Case 2: right controller, wildcarded slave.
* Remember first and keep looking for an exact match.
*/
- if (hd->hp_ctlr == hc->hp_unit &&
- match_s->hp_ctlr < 0) {
+ if (hd->hpd_ctlr == hc->hp_unit &&
+ match_s->hpd_ctlr < 0) {
match_s = hd;
new_s = s;
continue;
@@ -349,8 +343,8 @@ find_slaves(struct hp_ctlr *hc)
* Case 3: right slave, wildcarded controller.
* Remember and keep looking for a better match.
*/
- if (hd->hp_slave == s &&
- match_s->hp_ctlr < 0 && match_s->hp_slave < 0) {
+ if (hd->hpd_slave == s &&
+ match_s->hpd_ctlr < 0 && match_s->hpd_slave < 0) {
match_s = hd;
new_c = hc->hp_unit;
continue;
@@ -370,47 +364,38 @@ find_slaves(struct hp_ctlr *hc)
*/
if (match_s) {
hd = match_s;
- old_c = hd->hp_ctlr;
- old_s = hd->hp_slave;
- if (hd->hp_ctlr < 0)
- hd->hp_ctlr = new_c;
- if (hd->hp_slave < 0)
- hd->hp_slave = new_s;
+ old_c = hd->hpd_ctlr;
+ old_s = hd->hpd_slave;
+ if (hd->hpd_ctlr < 0)
+ hd->hpd_ctlr = new_c;
+ if (hd->hpd_slave < 0)
+ hd->hpd_slave = new_s;
#ifdef DEBUG
if (acdebug)
printf("looking for %s%d at slave %d...",
- hd->hp_driver->d_name,
- hd->hp_unit, hd->hp_slave);
+ hd->hpd_driver->d_name,
+ hd->hpd_unit, hd->hpd_slave);
#endif
- if ((*hd->hp_driver->d_init)(hd)) {
+ if ((*hd->hpd_driver->d_init)(hd)) {
#ifdef DEBUG
if (acdebug)
printf("found\n");
#endif
- printf("%s%d at %s%d, slave %d",
- hd->hp_driver->d_name, hd->hp_unit,
- hc->hp_driver->d_name, hd->hp_ctlr,
- hd->hp_slave);
- if (hd->hp_flags)
- printf(" flags 0x%x", hd->hp_flags);
- printf("\n");
- hd->hp_alive = 1;
+ printf("%s%d at %s%d, slave %d\n",
+ hd->hpd_driver->d_name, hd->hpd_unit,
+ hc->hp_driver->d_name, hd->hpd_ctlr,
+ hd->hpd_slave);
+ hd->hpd_alive = 1;
} else {
#ifdef DEBUG
if (acdebug)
printf("not found\n");
#endif
- hd->hp_ctlr = old_c;
- hd->hp_slave = old_s;
+ hd->hpd_ctlr = old_c;
+ hd->hpd_slave = old_s;
}
}
- /*
- * Reset bogon alive fields prior to attempting next slave
- */
- for (hd = hp_dinit; hd->hp_driver; hd++)
- if (hd->hp_alive == -1)
- hd->hp_alive = 0;
}
}
@@ -421,13 +406,10 @@ same_hw_device(struct hp_hw *hw, struct hp_device *hd)
switch (hw->hw_type) {
case NET:
- found = dr_type(hd->hp_driver, "le");
+ found = dr_type(hd->hpd_driver, "le");
break;
case SCSI:
- found = dr_type(hd->hp_driver, "scsi");
- break;
- case VME:
- case MISC:
+ found = dr_type(hd->hpd_driver, "scsi");
break;
}
return(found);
diff --git a/sys/arch/luna88k/stand/boot/bmd.c b/sys/arch/luna88k/stand/boot/bmd.c
index 8ad672e5eef..18bec2aa7ef 100644
--- a/sys/arch/luna88k/stand/boot/bmd.c
+++ b/sys/arch/luna88k/stand/boot/bmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bmd.c,v 1.2 2013/10/28 22:19:07 miod Exp $ */
+/* $OpenBSD: bmd.c,v 1.3 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: bmd.c,v 1.2 2013/01/20 13:35:43 tsutsui Exp $ */
/*
@@ -81,8 +81,6 @@
#include <sys/param.h>
#include <luna88k/stand/boot/samachdep.h>
-#define isprint(c) ( c < 0x20 ? 0 : 1)
-
/*
* RFCNT register
*/
@@ -95,30 +93,29 @@ union bmd_rfcnt {
uint32_t u;
};
+#define isprint(c) ((c) >= 0x20 && (c) < 0x7f)
/*
- * Width & Hight
+ * Width & Height
*/
-#define PB_WIDTH 2048 /* Plane Width (Bit) */
-#define PB_HIGHT 1024 /* Plane Hight (Bit) */
-#define PS_WIDTH 128 /* Plane Width (short) */
-#define P_WIDTH 256 /* Plane Width (Byte) */
-
-#define SB_WIDTH 1280 /* Screen Width (Bit) */
-#define SB_HIGHT 1024 /* Screen Hight (Bit) */
-#define SS_WIDTH 80 /* Screen Width (short) */
-#define S_WIDTH 160 /* Screen Width (Byte) */
+#define PB_WIDTH 2048 /* Plane Width (Bit) */
+#define PB_HEIGHT 1024 /* Plane Height (Bit) */
+#define PS_WIDTH 128 /* Plane Width (Short) */
+#define P_WIDTH 256 /* Plane Width (Byte) */
-#define FB_WIDTH 12 /* Font Width (Bit) */
-#define FB_HIGHT 20 /* Font Hight (Bit) */
+#define SB_WIDTH 1280 /* Screen Width (Bit) */
+#define SB_HEIGHT 1024 /* Screen Height (Bit) */
+#define SS_WIDTH 80 /* Screen Width (Short) */
+#define S_WIDTH 160 /* Screen Width (Byte) */
+#define FB_WIDTH 12 /* Font Width (Bit) */
+#define FB_HEIGHT 20 /* Font Height (Bit) */
-#define NEXT_LINE(addr) ( addr + (PS_WIDTH * FB_HIGHT) )
-#define SKIP_NEXT_LINE(addr) ( addr += (PS_WIDTH - SS_WIDTH) )
+#define NEXT_LINE(addr) ((addr) + (PS_WIDTH * FB_HEIGHT))
+#define SKIP_NEXT_LINE(addr) (addr) += (PS_WIDTH - SS_WIDTH)
-void bmd_add_new_line(void);
void bmd_draw_char(char *, char *, int, int, int);
void bmd_reverse_char(char *, char *, int, int);
@@ -461,23 +458,14 @@ bmdclear(void)
/*
- *
- */
-
-void
-bmd_add_new_line(void)
-{
-}
-
-
-/*
* charactor operation routines
*/
void
bmd_draw_char(char *raddr, char *waddr, int col, int row, int c)
{
- volatile u_short *p, *q, *fp;
+ volatile u_short *p, *q;
+ const u_short *fp;
int i;
fp = &bmdfont[c][0];
@@ -485,9 +473,9 @@ bmd_draw_char(char *raddr, char *waddr, int col, int row, int c)
switch (col % 4) {
case 0:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ for (i = 0; i < FB_HEIGHT; i++) {
*q = (*p & 0x000F) | (*fp & 0xFFF0);
p += 128;
q += 128;
@@ -496,9 +484,9 @@ bmd_draw_char(char *raddr, char *waddr, int col, int row, int c)
break;
case 1:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ for (i = 0; i < FB_HEIGHT; i++) {
q[0] = (p[0] & 0xFFF0) | ((*fp & 0xF000) >> 12);
q[1] = (p[1] & 0x00FF) | ((*fp & 0x0FF0) << 4);
p += 128;
@@ -508,9 +496,9 @@ bmd_draw_char(char *raddr, char *waddr, int col, int row, int c)
break;
case 2:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
+ for (i = 0; i < FB_HEIGHT; i++) {
q[0] = (p[0] & 0xFF00) | ((*fp & 0xFF00) >> 8);
q[1] = (p[1] & 0x0FFF) | ((*fp & 0x00F0) << 8);
p += 128;
@@ -520,9 +508,9 @@ bmd_draw_char(char *raddr, char *waddr, int col, int row, int c)
break;
case 3:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
+ for (i = 0; i < FB_HEIGHT; i++) {
*q = (*p & 0xF000) | ((*fp & 0xFFF0) >> 4);
p += 128;
q += 128;
@@ -538,15 +526,15 @@ bmd_draw_char(char *raddr, char *waddr, int col, int row, int c)
void
bmd_reverse_char(char *raddr, char *waddr, int col, int row)
{
- volatile u_short *p, *q;
+ volatile u_short *p, *q;
int i;
switch (col%4) {
case 0:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ for (i = 0; i < FB_HEIGHT; i++) {
*q = (*p & 0x000F) | (~(*p) & 0xFFF0);
p += 128;
q += 128;
@@ -554,9 +542,9 @@ bmd_reverse_char(char *raddr, char *waddr, int col, int row)
break;
case 1:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ));
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ));
+ for (i = 0; i < FB_HEIGHT; i++) {
q[0] = (p[0] & 0xFFF0) | (~p[0] & 0x000F);
q[1] = (p[1] & 0x00FF) | (~p[1] & 0xFF00);
p += 128;
@@ -565,9 +553,9 @@ bmd_reverse_char(char *raddr, char *waddr, int col, int row)
break;
case 2:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 2 );
+ for (i = 0; i < FB_HEIGHT; i++) {
q[0] = (p[0] & 0xFF00) | (~p[0] & 0x00FF);
q[1] = (p[1] & 0x0FFF) | (~p[1] & 0xF000);
p += 128;
@@ -576,9 +564,9 @@ bmd_reverse_char(char *raddr, char *waddr, int col, int row)
break;
case 3:
- p = (u_short *) ( raddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
- q = (u_short *) ( waddr + (( row * FB_HIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
- for (i = 0; i < FB_HIGHT; i++) {
+ p = (u_short *) ( raddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
+ q = (u_short *) ( waddr + (( row * FB_HEIGHT ) << 8 ) + (( col / 4 ) * 6 ) + 4 );
+ for (i = 0; i < FB_HEIGHT; i++) {
*q = (*p & 0xF000) | (~(*p) & 0x0FFF);
p += 128;
q += 128;
@@ -608,7 +596,7 @@ bmd_erase_screen(volatile u_short *p)
{
int i, j;
- for (i = 0; i < SB_HIGHT; i++) {
+ for (i = 0; i < SB_HEIGHT; i++) {
for (j = 0; j < SS_WIDTH; j++)
*p++ = 0;
SKIP_NEXT_LINE(p);
@@ -623,10 +611,10 @@ bmd_scroll_screen(volatile u_short *p, volatile u_short *q,
{
int i, j;
- p += ((PS_WIDTH * FB_HIGHT) * (ymin + 1));
- q += ((PS_WIDTH * FB_HIGHT) * ymin);
+ p += ((PS_WIDTH * FB_HEIGHT) * (ymin + 1));
+ q += ((PS_WIDTH * FB_HEIGHT) * ymin);
- for (i = 0; i < ((ymax - ymin -1) * FB_HIGHT); i++) {
+ for (i = 0; i < ((ymax - ymin -1) * FB_HEIGHT); i++) {
for (j = 0; j < SS_WIDTH; j++) {
*q++ = *p++;
}
@@ -634,7 +622,7 @@ bmd_scroll_screen(volatile u_short *p, volatile u_short *q,
q += (PS_WIDTH - SS_WIDTH);
}
- for (i = 0; i < FB_HIGHT; i++) {
+ for (i = 0; i < FB_HEIGHT; i++) {
for (j = 0; j < SS_WIDTH; j++) {
*q++ = 0;
}
diff --git a/sys/arch/luna88k/stand/boot/boot.c b/sys/arch/luna88k/stand/boot/boot.c
index cd6cb3ba650..60f47c7fda4 100644
--- a/sys/arch/luna88k/stand/boot/boot.c
+++ b/sys/arch/luna88k/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: boot.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: boot.c,v 1.3 2013/03/05 15:34:53 tsutsui Exp $ */
/*
@@ -85,12 +85,15 @@
int howto;
+#if 0
static int get_boot_device(const char *, int *, int *, int *);
+#endif
void (*cpu_boot)(uint32_t, uint32_t);
uint32_t cpu_bootarg1;
uint32_t cpu_bootarg2;
+#if 0
int
get_boot_device(const char *s, int *devp, int *unitp, int *partp)
{
@@ -103,14 +106,17 @@ get_boot_device(const char *s, int *devp, int *unitp, int *partp)
p++;
}
- while (*++p != ',') {
+ p++;
+ for (; *p != ',' && *p != ')'; p++) {
if (*p == '\0')
goto error;
if (*p >= '0' && *p <= '9')
unit = (unit * 10) + (*p - '0');
}
- while (*++p != ')') {
+ if (*p == ',')
+ p++;
+ for (; *p != ')'; p++) {
if (*p == '\0')
goto error;
if (*p >= '0' && *p <= '9')
@@ -126,6 +132,7 @@ get_boot_device(const char *s, int *devp, int *unitp, int *partp)
error:
return -1;
}
+#endif
int
boot(int argc, char *argv[])
@@ -146,13 +153,17 @@ int
bootunix(char *line)
{
int io;
+#if 0
int dev, unit, part;
+#endif
u_long marks[MARK_MAX];
+#if 0
if (get_boot_device(line, &dev, &unit, &part) != 0) {
printf("Bad file name %s\n", line);
return ST_ERROR;
}
+#endif
/* Note marks[MARK_START] is passed as an load address offset */
memset(marks, 0, sizeof(marks));
diff --git a/sys/arch/luna88k/stand/boot/device.h b/sys/arch/luna88k/stand/boot/device.h
index a233ddf6f85..c464c8a7413 100644
--- a/sys/arch/luna88k/stand/boot/device.h
+++ b/sys/arch/luna88k/stand/boot/device.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: device.h,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: device.h,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: device.h,v 1.5 2013/01/14 12:28:11 tsutsui Exp $ */
/*
@@ -85,23 +85,13 @@ struct hp_ctlr {
};
struct hp_device {
- struct driver *hp_driver;
- struct driver *hp_cdriver;
- int hp_unit;
- int hp_ctlr;
- int hp_slave;
- uint8_t *hp_addr;
- int hp_dk; /* XXX */
- int hp_flags;
- int hp_alive;
-};
-
-struct devqueue {
- struct devqueue *dq_forw;
- struct devqueue *dq_back;
- int dq_ctlr;
- int dq_unit;
- int dq_slave;
+ struct driver *hpd_driver;
+ struct driver *hpd_cdriver;
+ int hpd_unit;
+ int hpd_ctlr;
+ int hpd_slave;
+ uint8_t *hpd_addr;
+ int hpd_alive;
};
struct hp_hw {
@@ -110,34 +100,19 @@ struct hp_hw {
char *hw_name; /* HP product name */
};
-#define MAX_CTLR 16 /* Totally arbitrary */
-#define MAXSLAVES 8 /* Currently the HPIB limit */
+#define MAX_CTLR 8 /* Totally arbitrary */
+#define MAXSLAVES 8 /* Currently the SCSI limit */
#define WILD_CARD_CTLR 0
/* A controller is a card which can have one or more slaves attached */
#define CONTROLLER 0x10
-#define HPIB 0x16
-#define SCSI 0x17
-#define VME 0x18
-#define FLINK 0x19
-
-/* Slaves are devices which attach to controllers, e.g. disks, tapes */
-#define RD 0x2a
-#define PPI 0x2b
-#define CT 0x2c
+#define SCSI (CONTROLLER | 0)
-/* These are not controllers, but may have their own HPIB address */
-#define BITMAP 1
-#define NET 2
-#define FPA 4
-#define MISC 5
-#define KEYBOARD 6
-#define COMMDCA 7
-#define COMMDCM 8
-#define COMMDCL 9
-#define PPORT 10
-#define SIO 11
+/* Non-disk device types */
+#define NET 1
+#define KEYBOARD 2
+#define SIO 3
extern struct hp_ctlr hp_cinit[];
extern struct hp_device hp_dinit[];
diff --git a/sys/arch/luna88k/stand/boot/font.c b/sys/arch/luna88k/stand/boot/font.c
index f53211c55f8..5170e920372 100644
--- a/sys/arch/luna88k/stand/boot/font.c
+++ b/sys/arch/luna88k/stand/boot/font.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: font.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: font.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: font.c,v 1.2 2013/01/20 13:35:43 tsutsui Exp $ */
/*
@@ -79,7 +79,7 @@
#include <sys/param.h>
-u_short bmdfont[][20] = {
+const u_short bmdfont[][20] = {
{ /* 0x00 */
0x0000, /* ---------------- */
0x0000, /* ---------------- */
diff --git a/sys/arch/luna88k/stand/boot/if_le.c b/sys/arch/luna88k/stand/boot/if_le.c
index 29fe1e61dc7..704f7386324 100644
--- a/sys/arch/luna88k/stand/boot/if_le.c
+++ b/sys/arch/luna88k/stand/boot/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: if_le.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: if_le.c,v 1.3 2013/01/22 15:48:40 tsutsui Exp $ */
/*
@@ -117,19 +117,19 @@ leinit(void *arg)
void *reg, *mem;
uint8_t eaddr[6];
- reg = hd->hp_addr;
+ reg = hd->hpd_addr;
mem = (void *)0x71010000; /* XXX */
myetheraddr(eaddr);
- cookie = lance_attach(hd->hp_unit, reg, mem, eaddr);
+ cookie = lance_attach(hd->hpd_unit, reg, mem, eaddr);
if (cookie == NULL)
return 0;
printf("%s%d: Am7990 LANCE Ethernet, mem at 0x%x\n",
- hd->hp_driver->d_name, hd->hp_unit, (uint32_t)mem);
+ hd->hpd_driver->d_name, hd->hpd_unit, (uint32_t)mem);
printf("%s%d: Ethernet address = %s\n",
- hd->hp_driver->d_name, hd->hp_unit,
+ hd->hpd_driver->d_name, hd->hpd_unit,
ether_sprintf(eaddr));
return 1;
diff --git a/sys/arch/luna88k/stand/boot/init_main.c b/sys/arch/luna88k/stand/boot/init_main.c
index f755848f182..e5004f84396 100644
--- a/sys/arch/luna88k/stand/boot/init_main.c
+++ b/sys/arch/luna88k/stand/boot/init_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init_main.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: init_main.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: init_main.c,v 1.6 2013/03/05 15:34:53 tsutsui Exp $ */
/*
@@ -121,7 +121,6 @@ main(void)
{
int i, status = 0;
const char *machstr;
- int netboot = 0;
int unit, part;
/* Determine the machine type from FUSE ROM data. */
@@ -170,7 +169,7 @@ main(void)
unit = 0; /* XXX should parse monitor's Boot-file constant */
part = 0;
snprintf(default_file, sizeof(default_file),
- "%s(%d,%d)%s", netboot ? "le" : "sd", unit, part, "bsd");
+ "sd(%d,%d)%s", unit, part, "bsd");
/* auto-boot? (SW1) */
if ((dipswitch & 0x8000) != 0) {
diff --git a/sys/arch/luna88k/stand/boot/ioconf.c b/sys/arch/luna88k/stand/boot/ioconf.c
index 9c13a234fb5..9d2c785f010 100644
--- a/sys/arch/luna88k/stand/boot/ioconf.c
+++ b/sys/arch/luna88k/stand/boot/ioconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioconf.c,v 1.1 2013/10/28 22:13:12 miod Exp $ */
+/* $OpenBSD: ioconf.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: ioconf.c,v 1.3 2013/01/14 01:37:57 tsutsui Exp $ */
/*
@@ -75,10 +75,6 @@
#include <luna88k/stand/boot/samachdep.h>
#include <luna88k/stand/boot/device.h>
-
-#define C (void *)
-#define D (struct driver *)
-
extern struct driver scdriver;
extern struct driver sddriver;
extern struct driver ledriver;
@@ -86,20 +82,20 @@ extern struct driver stdriver;
struct hp_ctlr hp_cinit[] = {
/* driver, unit, alive, addr, flags */
- { &scdriver, 0, 0, C 0x0, 0x0 },
- { &scdriver, 1, 0, C 0x0, 0x0 },
+ { &scdriver, 0, 0, NULL, 0x0 },
+ { &scdriver, 1, 0, NULL, 0x0 },
{0},
};
struct hp_device hp_dinit[] = {
-/*driver, cdriver, unit, ctlr, slave, addr, dk, flags*/
-{ &sddriver, &scdriver, 0, 0, 6, C 0x0, 1, 0x0 },
-{ &sddriver, &scdriver, 1, 0, 5, C 0x0, 1, 0x0 },
-{ &sddriver, &scdriver, 2, 1, 6, C 0x0, 1, 0x0 },
-{ &sddriver, &scdriver, 3, 1, 5, C 0x0, 1, 0x0 },
-{ &ledriver, NULL, 0, 0, 0, C 0x0, 0, 0x0 },
+/*driver, cdriver, unit, ctlr, slave */
+{ &sddriver, &scdriver, 0, 0, 6 },
+{ &sddriver, &scdriver, 1, 0, 5 },
+{ &sddriver, &scdriver, 2, 1, 6 },
+{ &sddriver, &scdriver, 3, 1, 5 },
+{ &ledriver, NULL, 0, 0, 0 },
#ifdef notyet
-{ &stdriver, &scdriver, 0, 0, 4, C 0x0, 0, 0x0 },
+{ &stdriver, &scdriver, 0, 0, 4 },
#endif
{0}
};
diff --git a/sys/arch/luna88k/stand/boot/samachdep.h b/sys/arch/luna88k/stand/boot/samachdep.h
index e3c702ef5fa..d9a4e98d272 100644
--- a/sys/arch/luna88k/stand/boot/samachdep.h
+++ b/sys/arch/luna88k/stand/boot/samachdep.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: samachdep.h,v 1.1 2013/10/28 22:13:13 miod Exp $ */
+/* $OpenBSD: samachdep.h,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: samachdep.h,v 1.10 2013/03/05 15:34:53 tsutsui Exp $ */
/*
@@ -93,7 +93,7 @@ int atoi(char *);
int badaddr(void *, int);
/* font.c */
-extern u_short bmdfont[][20];
+extern const u_short bmdfont[][20];
/* getline.c */
int getline(char *, char *);
@@ -141,7 +141,6 @@ int scsi_immed_command(int, int, int, struct scsi_fmt_cdb *, u_char *,
unsigned int);
int scsi_request_sense(int, int, int, u_char *, unsigned int);
int scsi_test_unit_rdy(int, int, int);
-int scintr(void);
/* sd.c */
int sdstrategy(void *, int, daddr32_t, size_t, void *, size_t *);
diff --git a/sys/arch/luna88k/stand/boot/sc.c b/sys/arch/luna88k/stand/boot/sc.c
index d276b4a29fe..b99ad8cd1e5 100644
--- a/sys/arch/luna88k/stand/boot/sc.c
+++ b/sys/arch/luna88k/stand/boot/sc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sc.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */
+/* $OpenBSD: sc.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: sc.c,v 1.4 2013/01/22 15:48:40 tsutsui Exp $ */
/*
@@ -87,15 +87,16 @@
#define SCSI_ID 7
-static int scinit(void *);
-static void screset(int);
-static int issue_select(struct scsidevice *, u_char);
-static void ixfer_start(struct scsidevice *, int, u_char, int);
-static void ixfer_out(struct scsidevice *, int, u_char *);
-static void ixfer_in(struct scsidevice *, int, u_char *);
-static int scrun(int, int, u_char *, int, u_char *, int, volatile int *);
-static int scfinish(int);
-static void scabort(struct scsi_softc *, struct scsidevice *);
+int scinit(void *);
+int scintr(void);
+void screset(int);
+int issue_select(struct scsidevice *, u_char);
+void ixfer_start(struct scsidevice *, int, u_char, int);
+void ixfer_out(struct scsidevice *, int, u_char *);
+void ixfer_in(struct scsidevice *, int, u_char *);
+int scrun(int, int, u_char *, int, u_char *, int, volatile int *);
+int scfinish(int);
+void scabort(struct scsi_softc *, struct scsidevice *);
struct driver scdriver = {
scinit, "sc"
@@ -190,10 +191,10 @@ issue_select(struct scsidevice *hd, u_char target)
hd->scsi_pctl = 0;
hd->scsi_temp = (1 << SCSI_ID) | (1 << target);
- /* select timeout is hardcoded to 2ms */
- hd->scsi_tch = 0;
- hd->scsi_tcm = 32;
- hd->scsi_tcl = 4;
+ /* select timeout is hardcoded to 250ms */
+ hd->scsi_tch = 2;
+ hd->scsi_tcm = 113;
+ hd->scsi_tcl = 3;
hd->scsi_scmd = SCMD_SELECT;
@@ -253,8 +254,14 @@ int
scrun(int ctlr, int slave, u_char *cdb, int cdblen, u_char *buf, int len,
volatile int *lock)
{
- struct scsi_softc *hs = &scsi_softc[ctlr];
- struct scsidevice *hd = (struct scsidevice *) hs->sc_hc->hp_addr;
+ struct scsi_softc *hs;
+ struct scsidevice *hd;
+
+ if (ctlr < 0 || ctlr >= NSC)
+ return 0;
+
+ hs = &scsi_softc[ctlr];
+ hd = (struct scsidevice *)hs->sc_hc->hp_addr;
if (hd->scsi_ssts & (SSTS_INITIATOR|SSTS_TARGET|SSTS_BUSY))
return(0);
@@ -387,8 +394,8 @@ scsi_test_unit_rdy(int ctlr, int slave, int unit)
}
while ((lock == SC_IN_PROGRESS) || (lock == SC_DISCONNECTED)) {
- scintr();
- DELAY(10);
+ if (scintr())
+ DELAY(10);
}
status = scfinish(ctlr);
@@ -433,8 +440,8 @@ scsi_request_sense(int ctlr, int slave, int unit, u_char *buf, unsigned int len)
}
while ((lock == SC_IN_PROGRESS) || (lock == SC_DISCONNECTED)) {
- scintr();
- DELAY(10);
+ if (scintr())
+ DELAY(10);
}
status = scfinish(ctlr);
@@ -471,8 +478,8 @@ scsi_immed_command(int ctlr, int slave, int unit, struct scsi_fmt_cdb *cdb,
}
while ((lock == SC_IN_PROGRESS) || (lock == SC_DISCONNECTED)) {
- scintr();
- DELAY(10);
+ if (scintr())
+ DELAY(10);
}
status = scfinish(ctlr);
diff --git a/sys/arch/luna88k/stand/boot/sd.c b/sys/arch/luna88k/stand/boot/sd.c
index c2b7c78cca3..e87ed96d829 100644
--- a/sys/arch/luna88k/stand/boot/sd.c
+++ b/sys/arch/luna88k/stand/boot/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */
+/* $OpenBSD: sd.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: sd.c,v 1.5 2013/01/22 15:48:40 tsutsui Exp $ */
/*
@@ -90,15 +90,12 @@ struct disklabel sdlabel[NSD];
struct sd_softc {
struct hp_device *sc_hd;
- struct devqueue sc_dq;
- int sc_format_pid; /* process using "format" mode */
short sc_flags;
short sc_type; /* drive type */
short sc_punit; /* physical unit (scsi lun) */
u_short sc_bshift; /* convert device blocks to DEV_BSIZE blks */
u_int sc_blks; /* number of blocks on device */
int sc_blksize; /* device block size in bytes */
- u_int sc_wpms; /* average xfer rate in 16 bit wds/sec. */
};
struct sd_devdata {
@@ -106,8 +103,8 @@ struct sd_devdata {
int part; /* partition */
};
-static int sdinit(void *);
-static int sdident(struct sd_softc *, struct hp_device *);
+int sdinit(void *);
+int sdident(struct sd_softc *, struct hp_device *);
struct driver sddriver = {
sdinit, "sd"
@@ -121,7 +118,6 @@ struct sd_devdata sd_devdata[NSD];
#define sdunit(x) ((minor(x) >> 3) & 0x7)
#define sdpart(x) (minor(x) & 0x7)
-#define sdpunit(x) ((x) & 7)
static struct scsi_inquiry inqbuf;
static struct scsi_fmt_cdb inq = {
@@ -144,8 +140,8 @@ sdident(struct sd_softc *sc, struct hp_device *hd)
int i;
int tries = 10;
- ctlr = hd->hp_ctlr;
- slave = hd->hp_slave;
+ ctlr = hd->hpd_ctlr;
+ slave = hd->hpd_slave;
unit = sc->sc_punit;
/*
@@ -197,7 +193,7 @@ sdident(struct sd_softc *sc, struct hp_device *hd)
if (idstr[i] != ' ')
break;
idstr[i+1] = 0;
- printf("sd%d: %s %s rev %s", hd->hp_unit, idstr, &idstr[8],
+ printf("sd%d: %s %s rev %s", hd->hpd_unit, idstr, &idstr[8],
&idstr[24]);
printf(", %d bytes/sect x %d sectors\n", sc->sc_blksize, sc->sc_blks);
@@ -211,7 +207,6 @@ sdident(struct sd_softc *sc, struct hp_device *hd)
++sc->sc_bshift;
sc->sc_blks <<= sc->sc_bshift;
}
- sc->sc_wpms = 32 * (60 * DEV_BSIZE / 2); /* XXX */
return(inqbuf.type);
}
@@ -219,17 +214,17 @@ int
sdinit(void *arg)
{
struct hp_device *hd = arg;
- struct sd_softc *sc = &sd_softc[hd->hp_unit];
+ struct sd_softc *sc = &sd_softc[hd->hpd_unit];
struct disklabel *lp;
char *msg;
#ifdef DEBUG
- printf("sdinit: hd->hp_unit = %d\n", hd->hp_unit);
- printf("sdinit: hd->hp_ctlr = %d, hd->hp_slave = %d\n",
- hd->hp_ctlr, hd->hp_slave);
+ printf("sdinit: hd->hpd_unit = %d\n", hd->hpd_unit);
+ printf("sdinit: hd->hpd_ctlr = %d, hd->hpd_slave = %d\n",
+ hd->hpd_ctlr, hd->hpd_slave);
#endif
sc->sc_hd = hd;
- sc->sc_punit = sdpunit(hd->hp_flags);
+ sc->sc_punit = 0; /* XXX no LUN support yet */
sc->sc_type = sdident(sc, hd);
if (sc->sc_type < 0)
return(0);
@@ -238,7 +233,7 @@ sdinit(void *arg)
* Use the default sizes until we've read the label,
* or longer if there isn't one there.
*/
- lp = &sdlabel[hd->hp_unit];
+ lp = &sdlabel[hd->hpd_unit];
if (lp->d_secpercyl == 0) {
lp->d_secsize = DEV_BSIZE;
@@ -253,9 +248,9 @@ sdinit(void *arg)
/*
* read disklabel
*/
- msg = readdisklabel(hd->hp_ctlr, hd->hp_slave, lp);
+ msg = readdisklabel(hd->hpd_ctlr, hd->hpd_slave, lp);
if (msg != NULL)
- printf("sd%d: %s\n", hd->hp_unit, msg);
+ printf("sd%d: %s\n", hd->hpd_unit, msg);
sc->sc_flags = SDF_ALIVE;
return(1);
@@ -329,8 +324,8 @@ sdstrategy(void *devdata, int func, daddr32_t dblk, size_t size, void *v_buf,
if (unit < 0 || unit >= NSD)
return(-1);
- ctlr = sc->sc_hd->hp_ctlr;
- slave = sc->sc_hd->hp_slave;
+ ctlr = sc->sc_hd->hpd_ctlr;
+ slave = sc->sc_hd->hpd_slave;
lp = &sdlabel[unit];
blk = dblk + (lp->d_partitions[part].p_offset >> sc->sc_bshift);
diff --git a/sys/arch/luna88k/stand/boot/sio.c b/sys/arch/luna88k/stand/boot/sio.c
index c279fa994f5..5b0f8a2f52d 100644
--- a/sys/arch/luna88k/stand/boot/sio.c
+++ b/sys/arch/luna88k/stand/boot/sio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sio.c,v 1.1 2013/10/28 22:13:13 miod Exp $ */
+/* $OpenBSD: sio.c,v 1.2 2013/10/29 18:51:37 miod Exp $ */
/* $NetBSD: sio.c,v 1.3 2013/01/21 11:58:12 tsutsui Exp $ */
/*
@@ -88,12 +88,6 @@ struct rcvbuf rcvbuf[NSIO];
int sioconsole = -1;
struct siodevice *sio_addr[2];
-int cur_unit;
-
-
-#define siounit(x) ( x & 0xffff )
-#define isprint(c) ((c >= 0x20) && (c < 0x7F) ? 1 : 0)
-
void
_siointr(void)
@@ -153,14 +147,14 @@ siocnprobe(struct consdev *cp)
/* locate the major number */
/* initialize required fields */
- cp->cn_dev = cur_unit = 0;
+ cp->cn_dev = 0;
cp->cn_pri = CN_LOWPRI;
}
void
siocninit(struct consdev *cp)
{
- int unit = siounit(cp->cn_dev);
+ int unit = cp->cn_dev;
sioinit();
sioconsole = unit;
@@ -169,7 +163,7 @@ siocninit(struct consdev *cp)
int
siocngetc(dev_t dev)
{
- int c, unit = siounit(dev);
+ int c, unit = dev;
_siointr();
if (RBUF_EMPTY(unit))
@@ -183,7 +177,7 @@ siocngetc(dev_t dev)
void
siocnputc(dev_t dev, int c)
{
- int unit = siounit(dev);
+ int unit = dev;
if (sioconsole == -1) {
(void) sioinit();