-/* $OpenBSD: biosdev.c,v 1.10 1997/04/18 04:23:51 mickey Exp $ */
+/* $OpenBSD: biosdev.c,v 1.11 1997/04/18 06:54:40 weingart Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
if (debug)
printf(" (%d,%d,%d,%d)@%p", cyl, hd, sect, n, bb);
#endif
- for (error = 1, j = 5; error && j--;) {
- error = (rw == F_READ)?
- biosread (bd->biosdev, cyl, hd, sect, n, bb)
- : bioswrite(bd->biosdev, cyl, hd, sect, n, bb);
+ /* Try to do operation up to 5 times */
+ for (error = 1, j = 5; error && (j > 0); j--) {
+ if(rw == F_READ)
+ error = biosread(bd->biosdev, cyl, hd, sect, n, bb);
+ else
+ error = bioswrite(bd->biosdev, cyl, hd, sect, n, bb);
switch (error) {
case 0x00: /* No errors */
error = 0;
break;
- default:
-#ifdef BIOS_DEBUG
- if (debug) {
- for (p = bd_errors; p < &bd_errors[bd_nents] &&
- p->bd_id != error; p++);
- printf("\nBIOS error %x (%s)\n", p->bd_id, p->msg);
- }
-#endif
- continue;
+ default: /* All other errors */
+ for (p = bd_errors; p < &bd_errors[bd_nents] &&
+ p->bd_id != error; p++);
+ printf("\nBIOS error %x (%s)\n", p->bd_id, p->msg);
+ biosdreset();
+ break;
}
}
-/* $OpenBSD: biosdev.h,v 1.4 1997/04/09 08:39:17 mickey Exp $ */
+/* $OpenBSD: biosdev.h,v 1.5 1997/04/18 06:54:42 weingart Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
/* biosdisk.S */
u_int16_t biosdinfo __P((int dev));
+int biosdreset __P((void));
int biosread __P((int dev, int cyl, int hd, int sect, int nsect, void *));
int bioswrite __P((int dev, int cyl, int hd, int sect, int nsect, void *));
-/* $OpenBSD: biosdisk.S,v 1.5 1997/04/09 08:39:20 mickey Exp $ */
+/* $OpenBSD: biosdisk.S,v 1.6 1997/04/18 06:54:43 weingart Exp $ */
/*
* Ported to boot 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
popl %ebp
ret
+
+/*
+#
+# biosdreset(): reset disk system
+#
+*/
+
+ENTRY(biosdreset)
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %ebx
+ pushl %ecx
+
+ movb $0x00, %ah # ask for disk info
+ BIOSINT(0x13)
+
+ popl %ecx
+ popl %ebx
+ popl %ebp
+ ret
+