Subject: Re: Support for PS/2 esdi disks in bootblocks
To: =?iso-8859-1?Q?Jarom=EDr_Dolecek?= <jdolecek@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: port-i386
Date: 05/05/2001 02:45:34
BTW, you should modify arch/i386/i386/autoconf.c to recognise `ed' devices
as the boot device.
Andrew
Jaromír Dolecek <jdolecek@netbsd.org> wrote:
> Hi,
> I'd like to add some support code to identify the PS/2 ESDI disks
> correctly and pass appropriate info to kernel. The code identifies
> currently all DTYPE_ESDI disks as ed(4) device. I think this
> is safe, but I'm not quite sure.
>
> I'm appending the patch. Is it correct to do what I need this way?
>
> Jaromir
> --
> Jaromir Dolecek <jdolecek@NetBSD.org> http://www.ics.muni.cz/~dolecek/
> NetBSD - just plain best OS! -=*=- Got spare MCA cards or docs? Hand me them!
> Index: biosboot/version
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/arch/i386/stand/biosboot/version,v
> retrieving revision 1.9
> diff -u -p -r1.9 version
> --- biosboot/version 2000/09/24 12:32:35 1.9
> +++ biosboot/version 2001/05/04 21:17:44
> @@ -15,3 +15,4 @@ is taken as the current.
> 2.6: Support ELF boot.
> 2.7: Support on-the-fly switching of console devices.
> 2.8: Support verbose/quiet boot.
> +2.9: Recognize ESDI disks and identify them as ed(4)
> Index: biosboot/devopen.c
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/arch/i386/stand/biosboot/devopen.c,v
> retrieving revision 1.9
> diff -u -p -r1.9 devopen.c
> --- biosboot/devopen.c 1999/10/28 05:20:05 1.9
> +++ biosboot/devopen.c 2001/05/04 21:17:44
> @@ -68,6 +68,9 @@ static struct {
> },
> {
> "sd", 0x80
> + },
> + {
> + "ed", 0x80
> }
> #endif
> };
> @@ -105,6 +108,8 @@ bios2dev(biosdev, devname, unit)
> if(disklabel.d_magic == DISKMAGIC) {
> if(disklabel.d_type == DTYPE_SCSI)
> *devname = biosdevtab[3].name;
> + else if (disklabel.d_type == DTYPE_ESDI)
> + *devname = biosdevtab[4].name;
> else
> *devname = biosdevtab[2].name;
> } else
> Index: lib/exec.c
> ===================================================================
> RCS file: /cvsroot/syssrc/sys/arch/i386/stand/lib/exec.c,v
> retrieving revision 1.15
> diff -u -p -r1.15 exec.c
> --- lib/exec.c 2000/02/22 07:45:04 1.15
> +++ lib/exec.c 2001/05/04 21:17:44
> @@ -67,13 +67,21 @@ dev2major(devname, major)
> char *devname;
> int *major;
> {
> - static char *devices[] = {"wd", "", "fd", "", "sd"};
> -#define NUMDEVICES (sizeof(devices)/sizeof(char *))
> + static const struct {
> + const char *name;
> + int maj;
> + } devices[] = {
> + { "wd", 0 },
> + { "fd", 3 },
> + { "sd", 5 },
> + { "ed", 20 },
> + };
> +#define NUMDEVICES (sizeof(devices)/sizeof(devices[0]))
> int i;
>
> for (i = 0; i < NUMDEVICES; i++)
> - if (!strcmp(devname, devices[i])) {
> - *major = i;
> + if (!strcmp(devname, devices[i].name)) {
> + *major = devices[i].maj;
> return (0);
> }
> return (-1);
> @@ -168,6 +176,8 @@ exec_netbsd(file, loadaddr, boothowto)
>
> if (biosdisk_gettype(f) == DTYPE_SCSI)
> devname = "sd";
> + else if (biosdisk_gettype(f) == DTYPE_ESDI)
> + devname = "ed";
> else
> devname = "wd";
>