diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-05-30 02:21:53 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1997-05-30 02:21:53 +0000 |
commit | e0307728e5d73b765b7c0293b17c5573b696894d (patch) | |
tree | ede990793ea9e9637a0c14f2e54384b472c413d2 /sys | |
parent | 17dc69f58e515ad8a31ac2f0325d9425229421a8 (diff) |
EDD support functions, EDD detection code.
com prototypes changes
some indentation
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdev.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdev.h | 37 | ||||
-rw-r--r-- | sys/arch/i386/stand/libsa/biosdisk.S | 103 |
3 files changed, 122 insertions, 27 deletions
diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c index 29ec6df94d6..0faa11cb554 100644 --- a/sys/arch/i386/stand/libsa/biosdev.c +++ b/sys/arch/i386/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.15 1997/04/30 18:10:07 mickey Exp $ */ +/* $OpenBSD: biosdev.c,v 1.16 1997/05/30 02:21:52 mickey Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -51,6 +51,7 @@ struct biosdisk { struct disklabel disklabel; dev_t bsddev; u_int8_t biosdev; + int edd_flags; }; int @@ -145,12 +146,14 @@ biosopen(struct open_file *f, ...) return ENXIO; } + bd->edd_flags = EDDcheck((dev_t)bd->biosdev); bd->dinfo = biosdinfo((dev_t)bd->biosdev); #ifdef BIOS_DEBUG if (debug) { - printf("BIOS geometry: heads: %u, s/t: %u\n", - BIOSNHEADS(bd->dinfo), BIOSNSECTS(bd->dinfo)); + printf("BIOS geometry: heads=%u, s/t=%u; EDD=%d\n", + BIOSNHEADS(bd->dinfo), BIOSNSECTS(bd->dinfo), + bd->edd_flags); } #endif diff --git a/sys/arch/i386/stand/libsa/biosdev.h b/sys/arch/i386/stand/libsa/biosdev.h index 3fca437122a..2e56626e71f 100644 --- a/sys/arch/i386/stand/libsa/biosdev.h +++ b/sys/arch/i386/stand/libsa/biosdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.h,v 1.8 1997/04/28 07:39:01 weingart Exp $ */ +/* $OpenBSD: biosdev.h,v 1.9 1997/05/30 02:21:52 mickey Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -50,31 +50,40 @@ int biosioctl __P((struct open_file *, u_long, void *)); /* biosdisk.S */ u_int16_t biosdinfo __P((int dev)); -int biosdreset __P((int dev)); -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 *)); +int biosdreset __P((int dev)); +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 *)); +int EDDcheck __P((dev_t)); +int EDDread __P((dev_t, u_int64_t, u_int32_t, void *)); +int EDDwrite __P((dev_t, u_int64_t, u_int32_t, void *)); /* bioskbd.S */ -int kbd_probe __P((void)); -void kbd_putc __P((int c)); -int kbd_getc __P((void)); -int kbd_ischar __P((void)); +int kbd_probe __P((void)); +void kbd_putc __P((int c)); +int kbd_getc __P((void)); +int kbd_ischar __P((void)); /* bioscom.S */ -int com_probe __P((void)); -void com_putc __P((int c)); -int com_getc __P((void)); -int com_ischar __P((void)); +#define COM_PROTO(n) \ +int com##n##_probe __P((void)); \ +void com##n##_putc __P((int c)); \ +int com##n##_getc __P((void)); \ +int com##n##_ischar __P((void)); +COM_PROTO(0) +COM_PROTO(1) +COM_PROTO(2) +COM_PROTO(3) +#undef COM_PROTO /* biosmem.S */ -u_int biosmem __P((void)); +u_int biosmem __P((void)); /* time.c */ void time_print __P((void)); time_t getsecs __P((void)); /* biostime.S */ -int usleep __P((u_long)); +int usleep __P((u_long)); int biostime __P((char *)); int biosdate __P((char *)); #endif diff --git a/sys/arch/i386/stand/libsa/biosdisk.S b/sys/arch/i386/stand/libsa/biosdisk.S index 84267f3e836..a546c07b536 100644 --- a/sys/arch/i386/stand/libsa/biosdisk.S +++ b/sys/arch/i386/stand/libsa/biosdisk.S @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdisk.S,v 1.8 1997/04/23 14:49:24 weingart Exp $ */ +/* $OpenBSD: biosdisk.S,v 1.9 1997/05/30 02:21:51 mickey Exp $ */ /* * Copyright (c) 1997 Michael Shalayeff @@ -38,6 +38,9 @@ #include "biosdev.h" #undef _LOCORE + + .globl _C_LABEL(errno) /* XXX used for bios errors */ + /* * int biosread(dev,cyl,head,sect,nsect,buf) * read number of sectors from disk @@ -84,11 +87,11 @@ ENTRY(bioswrite) ret /* -# -# u_int16_t biosdinfo(): return a word that represents the -# max number of sectors and heads and drives for this device -# -*/ + * + * u_int16_t biosdinfo(): return a word that represents the + * max number of sectors and heads and drives for this device + * + */ ENTRY(biosdinfo) pushl %ebp @@ -115,10 +118,10 @@ ENTRY(biosdinfo) /* -# -# biosdreset(): reset disk system -# -*/ + * + * biosdreset(): reset disk system + * + */ ENTRY(biosdreset) pushl %ebx @@ -132,3 +135,83 @@ ENTRY(biosdreset) popl %ebx ret +/* + * int EDDcheck(dev) + * check the features supported by the bios for the drive + */ +ENTRY(EDDcheck) + pushl %ebp + movl %esp, %ebp + pushl %ecx + pushl %ebx + + movb $0x44, %ah + movw $0x55aa, %bx + movl 8(%ebp), %edx + BIOSINT(0x13) + movl $-1, %eax + jc 1f + cmpw $0xaa55, %bx + jne 1f + xorl %eax, %eax + movw %cx, %ax /* API support bitmap */ +1: + popl %ebx + popl %ecx + popl %ebp + ret + + .data + +ddp: .byte 0x10 # size of packet + .byte 0 # reserved + .word 0 # # of blocks to transfer + .long 0 # address to read/write to + .long 0,0 # start to read here + + .text +/* + * int EDDread(dev,abs_sect,nsect,buf) + * read nsect starting on absolute sector #abs_sect into buf + */ +ENTRY(EDDread) + pushl %ebp + movl %esp, %ebp + pushl %ecx + pushl %ebx + pushl %esi + + movl 8(%ebp), %edx /* drive */ + movl ddp, %esi + movl 20(%ebp), %eax /* nblks */ + movw %ax, 2(%esi) + movl 12(%ebp), %eax /* abs starting sector */ + movl %eax, 8(%esi) + movl 16(%ebp), %eax + movl %eax, 12(%esi) + movl 24(%ebp), %eax /* buffer */ + movl %eax, 4(%esi) + movb $0x42, %ah + BIOSINT(0x13) + jnc 1f + xorl %eax, %eax + +1: movzbl %ah, %eax + movl %eax, _C_LABEL(errno) + movw 2(%esi), %ax /* return number of blocks read ok */ + + popl %esi + popl %ebx + popl %ecx + popl %ebp + ret + +/* + * int EDDwrite(dev,abs_sect,nsect,buf) + * read nsect starting on absolute sector #abs_sect into buf + */ +ENTRY(EDDwrite) + movl $19, _C_LABEL(errno) + movl $0, %eax + ret + |