Date: Fri, 24 Sep 2004 21:24:51 -0700 (PDT) From: Rostislav Krasny <rosti_bsd@yahoo.com> To: John Baldwin <jhb@FreeBSD.org>, freebsd-current@FreeBSD.org Cc: phk@FreeBSD.org Subject: Re: interesting bug of new fdc(4) - two /dev/fd0 device files Message-ID: <20040925042451.23863.qmail@web14823.mail.yahoo.com> In-Reply-To: <200409241535.37511.jhb@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--- John Baldwin <jhb@FreeBSD.org> wrote: > On Friday 24 September 2004 03:12 pm, Rostislav Krasny wrote: > > I have FreeBSD 5.3-BETA5 and 5.3-BETA4 installed on separate disks > > of the same computer. After the installation I added a second floppy > > drive (disk B in DOS). See following logs about how both systems > > work after that: > > > > dmesg and shell logs of 5.3-BETA5 (two /dev/fd0 device files): > > > > PNP0700: adding dma mask 0x4 > > PNP0700: adding io range 0x3f2-0x3f5, size=0x4, align=0 > > PNP0700: adding irq mask 0x40 > > pnpbios: handle 12 device ID PNP0700 (0007d041) > > [snipped] > > fdc0: ic_type 90 part_id 80 > > fdc0: <Enhanced floppy controller> at port 0x3f0-0x3f5 irq 6 drq 2 > > on isa0 > > fdc0: ic_type 90 part_id 80 > > fdc0: [MPSAFE] > > fdc0: [FAST] > > fd0: <1440-KB 3.5" drive> on fdc0 drive 0 > > fd1: <1440-KB 3.5" drive> on fdc0 drive 1 > > > > > ls -il /dev/fd[0-9] > > > > 73 crw-r----- 1 root operator 4, 10 Sep 24 20:21 /dev/fd0 > > 73 crw-r----- 1 root operator 4, 10 Sep 24 20:21 /dev/fd0 > > > > > > dmesg and shell logs of 5.3-BETA4 (no such bug): > > > > PNP0700: adding dma mask 0x4 > > PNP0700: adding io range 0x3f2-0x3f5, size=0x4, align=0 > > PNP0700: adding irq mask 0x40 > > pnpbios: handle 12 device ID PNP0700 (0007d041) > > [snipped] > > fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> at > > port 0x3f7,0x3f0-0x3f5 irq 6 drq 2 on isa0 > > fdc0: FIFO enabled, 8 bytes threshold > > fd0: <1440-KB 3.5" drive> on fdc0 drive 0 > > fd1: <1440-KB 3.5" drive> on fdc0 drive 1 > > > > > ls -il /dev/fd[0-9] > > > > 32 crw-r----- 1 root operator 242, 0 Sep 24 19:05 /dev/fd0 > > 34 crw-r----- 1 root operator 242, 1 Sep 24 19:05 /dev/fd1 > > > > > > P.S. having two floppy drives became rare at our days but this is > > still possible and correct to be used by anyone. > > Looks like a bug in fd2_attach(): > > fd->fd_geom = g_new_geomf(&g_fd_class, > "fd%d", device_get_unit(fd->fdc->fdc_dev)); > > Try changing that line in sys/dev/fdc/fdc.c (about line 1909) to use > fd->fd_dev rather than fd->fdc->fdc_dev. > > Or, alternatively, change the two lines to: > > fd->fd_geom = g_new_geomf(&g_fd_class, "%s", > device_get_nameunit(fd)); You probably meant fd_attach2() function because there is no fd2_attach() function in the sys/dev/fdc/fdc.c Both variants of the change cannot be compiled but I've understood your idea. I made following change: --- fdc.c.orig Fri Sep 24 22:32:28 2004 +++ /usr/src/sys/dev/fdc/fdc.c Sat Sep 25 02:28:11 2004 @@ -1906,7 +1906,7 @@ fd = arg; fd->fd_geom = g_new_geomf(&g_fd_class, - "fd%d", device_get_unit(fd->fdc->fdc_dev)); + "fd%d", device_get_unit(fd->dev)); fd->fd_provider = g_new_providerf(fd->fd_geom, fd->fd_geom->name); fd->fd_geom->softc = fd; g_error_provider(fd->fd_provider, 0); and it works well: > ls -il /dev/fd[0-9] 73 crw-r----- 1 root operator 4, 10 Sep 25 05:37 /dev/fd0 75 crw-r----- 1 root operator 4, 11 Sep 25 05:43 /dev/fd1 I also have tested fd0 and fd1 by running 'fdformat fd1' and 'fdformat fd0' or 'newfs fd1' and 'fdformat fd0' simultaneously. P.S. function fd_attach() (below the fd_attach2()) have one redundant "return (0)". __________________________________ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040925042451.23863.qmail>