Looking for testers with a floppy drive

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Looking for testers with a floppy drive

Stefan Fritsch
Hi,

is anyone still using floppies? If yes, it would be nice if they could
give the diff below a test. It defers probing of the drives which reduces
boot time quite a bit. If floppy does not work with the diff, please also
test if it works without it. On qemu, floppy access seems to be broken (or
I did something wrong).

Cheers,
Stefan


diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c
index 3e16d054428..460830a97cc 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -210,11 +210,11 @@ fdprobe(struct device *parent, void *match, void *aux)
  /* select drive and turn on motor */
  bus_space_write_1(iot, ioh, fdout, drive | FDO_FRST | FDO_MOEN(drive));
  /* wait for motor to spin up */
- delay(250000);
+ tsleep(fdc, 0, "fdprobe", 250 * hz / 1000);
  out_fdc(iot, ioh, NE7CMD_RECAL);
  out_fdc(iot, ioh, drive);
  /* wait for recalibrate */
- delay(2000000);
+ tsleep(fdc, 0, "fdprobe", 2000 * hz / 1000);
  out_fdc(iot, ioh, NE7CMD_SENSEI);
  n = fdcresult(fdc);
 #ifdef FD_DEBUG
@@ -228,7 +228,7 @@ fdprobe(struct device *parent, void *match, void *aux)
 #endif
 
  /* turn off motor */
- delay(250000);
+ tsleep(fdc, 0, "fdprobe", 250 * hz / 1000);
  bus_space_write_1(iot, ioh, fdout, FDO_FRST);
 
  /* flags & 0x20 forces the drive to be found even if it won't probe */
diff --git a/sys/dev/isa/fdc.c b/sys/dev/isa/fdc.c
index c7b7ae4562c..ee195367322 100644
--- a/sys/dev/isa/fdc.c
+++ b/sys/dev/isa/fdc.c
@@ -57,6 +57,7 @@
 #include <sys/syslog.h>
 #include <sys/queue.h>
 #include <sys/timeout.h>
+#include <sys/kthread.h>
 
 #include <machine/cpu.h>
 #include <machine/bus.h>
@@ -79,6 +80,8 @@
 /* controller driver configuration */
 int fdcprobe(struct device *, void *, void *);
 void fdcattach(struct device *, struct device *, void *);
+void fdcattach_deferred(void *);
+void fdc_create_kthread(void *);
 
 struct cfattach fdc_ca = {
  sizeof(struct fdc_softc), fdcprobe, fdcattach
@@ -139,8 +142,6 @@ fdcattach(struct device *parent, struct device *self, void *aux)
  bus_space_handle_t ioh;
  bus_space_handle_t ioh_ctl;
  struct isa_attach_args *ia = aux;
- struct fdc_attach_args fa;
- int type;
 
  iot = ia->ia_iot;
 
@@ -163,6 +164,22 @@ fdcattach(struct device *parent, struct device *self, void *aux)
  fdc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
     IPL_BIO, fdcintr, fdc, fdc->sc_dev.dv_xname);
 
+ kthread_create_deferred(fdc_create_kthread, fdc);
+}
+
+void
+fdc_create_kthread(void *arg)
+{
+ kthread_create(fdcattach_deferred, arg, NULL, "fdcattach");
+}
+
+void
+fdcattach_deferred(void *arg)
+{
+ struct fdc_softc *fdc = arg;
+ struct fdc_attach_args fa;
+ int type;
+
 #if defined(__i386__) || defined(__amd64__)
  /*
  * The NVRAM info only tells us about the first two disks on the
@@ -187,8 +204,9 @@ fdcattach(struct device *parent, struct device *self, void *aux)
  else
 #endif
  fa.fa_deftype = NULL; /* unknown */
- (void)config_found(self, (void *)&fa, fddprint);
+ (void)config_found(&fdc->sc_dev, (void *)&fa, fddprint);
  }
+ kthread_exit(0);
 }
 
 /*

Reply | Threaded
Open this post in threaded view
|

Re: Looking for testers with a floppy drive

Miod Vallat

> Hi,
>
> is anyone still using floppies? If yes, it would be nice if they could
> give the diff below a test. It defers probing of the drives which reduces
> boot time quite a bit. If floppy does not work with the diff, please also
> test if it works without it. On qemu, floppy access seems to be broken (or
> I did something wrong).

With this diff, floppies still work here.

$ dmesg
OpenBSD 6.2-beta (GENERIC) #0: Fri Aug 25 23:36:31 GMT 2017
    [hidden email]:/data/src/sys/arch/i386/compile/GENERIC
cpu0: AMD-K6tm w/ multimedia extensions ("AuthenticAMD" 586-class) 234 MHz
cpu0: FPU,V86,DE,PSE,TSC,MSR,MCE,CX8,MMX
real mem  = 66600960 (63MB)
avail mem = 51343360 (48MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 02/26/98, BIOS32 rev. 0 @ 0xfb440
apm0 at bios0: Power Management spec V1.2 (slowidle)
pcibios0 at bios0: rev 2.1 @ 0xf0000/0xb8b8
pcibios0: PCI IRQ Routing Table rev 1.0 @ 0xfdd30/128 (6 entries)
pcibios0: PCI Exclusive IRQs: 5 9 10 11
pcibios0: PCI Interrupt Router at 000:07:0 ("Intel 82371SB ISA" rev 0x00)
pcibios0: PCI bus #0 is the last bus
bios0: ROM list: 0xc0000/0x8000
cpu0 at mainbus0: (uniprocessor)
pci0 at mainbus0 bus 0: configuration mode 1 (bios)
pchb0 at pci0 dev 0 function 0 "Intel 82439TX" rev 0x01
piixpcib0 at pci0 dev 7 function 0 "Intel 82371AB PIIX4 ISA" rev 0x01
pciide0 at pci0 dev 7 function 1 "Intel 82371AB IDE" rev 0x01: DMA, channel 0 wired to compatibility, channel 1 wired to compatibility
wd0 at pciide0 channel 0 drive 0: <IBM-DAQA-33240>
wd0: 16-sector PIO, LBA, 3098MB, 6346368 sectors
wd0(pciide0:0:0): using PIO mode 4, DMA mode 2
atapiscsi0 at pciide0 channel 1 drive 0
scsibus1 at atapiscsi0: 2 targets
cd0 at scsibus1 targ 0 lun 0: <LITEON, CD-ROM LTN485S, JOU2> ATAPI 5/cdrom removable
cd0(pciide0:1:0): using PIO mode 4, Ultra-DMA mode 2
uhci0 at pci0 dev 7 function 2 "Intel 82371AB USB" rev 0x01: irq 11
piixpm0 at pci0 dev 7 function 3 "Intel 82371AB Power" rev 0x01: SMI
iic0 at piixpm0
"eeprom" at iic0 addr 0x50 not configured
vga1 at pci0 dev 11 function 0 "S3 ViRGE DX/GX" rev 0x01
wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
yds0 at pci0 dev 13 function 0 "Yamaha 724" rev 0x05: irq 9
rl0 at pci0 dev 15 function 0 "Realtek 8139" rev 0x10: irq 10, address 00:e0:7d:e6:ae:d5
rlphy0 at rl0 phy 0: RTL internal PHY
isa0 at piixpcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pckbd0 at pckbc0 (kbd slot)
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 configuration 1 interface 0 "Intel UHCI root hub" rev 1.00/1.00 addr 1
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on wd0a (4330659be0e105e7.a) swap on wd0b dump on wd0b
ac97: codec id 0x414b4d00 (Asahi Kasei AK4540 rev 0)
audio0 at yds0
opl at yds0 not configured
opl at yds0 not configured
opl at yds0 not configured
opl at yds0 not configured
mpu at yds0 not configured
mpu at yds0 not configured
mpu at yds0 not configured
mpu at yds0 not configured
fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
$ disklabel fd0
# /dev/rfd0c:
type: floppy
disk: floppy disk
label: fictitious
duid: 0000000000000000
flags:
bytes/sector: 512
sectors/track: 18
tracks/cylinder: 2
sectors/cylinder: 36
cylinders: 80
total sectors: 2880
boundstart: 0
boundend: 2880
drivedata: 0

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  c:             2880                0  unused                    
  i:             2880                0   MSDOS                    
$ doas mount -o ro /dev/fd0i /mnt
...