Hi. I try set floppy support in SeaBIOS like this:
root@debian:~# cd /coreboot root@debian:/coreboot# ./build/seabios/scripts/encodeint.py floppy0 4 root@debian:/coreboot# ./build/cbfstool build/coreboot.rom add -f floppy0 -n etc/floppy0 -t raw root@debian:/coreboot# ./build/cbfstool build/coreboot.rom print coreboot.rom: 256 kB, bootblocksize 848, romsize 262144, offset 0x0 alignment: 64 bytes ================================================= Name Offset Type Size fallback/romstage 0x0 stage 17988 fallback/coreboot_ram 0x4680 stage 105981 fallback/payload 0x1e4c0 payload 59988 pci10ec,8139.rom 0x2cf80 raw 57344 etc/floppy0 0x3afc0 raw 8 (empty) 0x3b000 null 19544 ============================================================= After PC boot, press F12 and have menu:
Press F12 for boot menu.
Select boot device:
1. Floppy [drive A] 2. DVD/CD [ata1-0: OEM CD-ROM F563E ATAPI-0 DVD/CD] 3. ata0-0: Maxtor 2F020J0 ATA-7 Hard-Disk (19881 MiBytes) 4. gPXE (PCI 00:11.0)
but after press 1 boot from floppy not working (FDD LED not light) and:
Boot failed: could not read the boot disk
I tray boot from Win95 boot floppy disk. In CMOS is set FDD 3.5' 1.44MB. In WinXP FDD read OK floppy content but after restart not possible copy any files from floppy. Also after restart I press F12 and select 1. Floppy [drive A]. Now FDD LED light but errors:
Disk I/O error Replace the disk, and then press any key
In terminal over COM:
floppy error: 40 04 10 01 00 00 02
Please see winxp_restart.log
I tray also boot from other floppy gPXE 5.4.4 and have other errors: ------------------------------------ 2000 AX:020F BX:3C00 CX:0101 DX:0000 2000 AX:020F BX:3C00 CX:0101 DX:0000 2000 AX:020F BX:3C00 CX:0101 DX:0000 2000 AX:020F BX:3C00 CX:0101 DX:0000 etc. ------------------------------------ and terminal also print: ------------------------------------ floppy error: 40 04 10 01 00 00 02 floppy error: 40 04 10 01 00 00 02 floppy error: 40 04 10 01 00 00 02 floppy error: 40 04 10 01 00 00 02 etc. ------------------------------------
On Wed, Dec 04, 2013 at 09:27:20AM +0100, Gelip wrote:
Hi. I try set floppy support in SeaBIOS like this:
The floppy support in SeaBIOS has been tested on qemu, but has never been tested on real hardware. Your test indicates the SeaBIOS floppy support is not complete.
If you want to help debug this, apply the patch below to the latest seabios code from the seabios git, compile seabios with a debug level of 8, retry the test, and forward the results back to seabios@seabios.org. If you can capture the serial port traffic with the scripts/readserial.py tool from the seabios repo that would help (by providing additional timing information).
-Kevin
diff --git a/src/hw/floppy.c b/src/hw/floppy.c index e73b303..4cf9684 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -183,6 +183,7 @@ find_floppy_type(u32 size) static void floppy_disable_controller(void) { + dprintf(1, "floppy_disable_controller\n"); outb(inb(PORT_FD_DOR) & ~0x04, PORT_FD_DOR); }
@@ -191,8 +192,10 @@ floppy_wait_irq(void) { u8 frs = GET_BDA(floppy_recalibration_status); SET_BDA(floppy_recalibration_status, frs & ~FRS_IRQ); + dprintf(1, "floppy_wait_irq frs=%x\n", frs); for (;;) { if (!GET_BDA(floppy_motor_counter)) { + warn_timeout(); floppy_disable_controller(); return DISK_RET_ETIMEOUT; } @@ -218,6 +221,7 @@ struct floppy_pio_s { static int floppy_pio(struct floppy_pio_s *pio) { + dprintf(1, "floppy_pio\n"); // Send command to controller. u32 end = timer_calc(FLOPPY_PIO_TIMEOUT); int i = 0; @@ -225,6 +229,7 @@ floppy_pio(struct floppy_pio_s *pio) u8 sts = inb(PORT_FD_STATUS); if (!(sts & 0x80)) { if (timer_check(end)) { + warn_timeout(); floppy_disable_controller(); return DISK_RET_ETIMEOUT; } @@ -253,6 +258,7 @@ floppy_pio(struct floppy_pio_s *pio) u8 sts = inb(PORT_FD_STATUS); if (!(sts & 0x80)) { if (timer_check(end)) { + warn_timeout(); floppy_disable_controller(); return DISK_RET_ETIMEOUT; } @@ -273,6 +279,7 @@ floppy_pio(struct floppy_pio_s *pio) static int floppy_enable_controller(void) { + dprintf(1, "floppy_enable_controller\n"); outb(inb(PORT_FD_DOR) | 0x04, PORT_FD_DOR); int ret = floppy_wait_irq(); if (ret) @@ -289,6 +296,7 @@ floppy_enable_controller(void) static int floppy_select_drive(u8 floppyid) { + dprintf(1, "floppy_select_drive %d\n", floppyid); // reset the disk motor timeout value of INT 08 SET_BDA(floppy_motor_counter, FLOPPY_MOTOR_TICKS);
@@ -302,6 +310,7 @@ floppy_select_drive(u8 floppyid)
// Turn on motor of selected drive, DMA & int enabled, normal operation dor = (floppyid ? 0x20 : 0x10) | 0x0c | floppyid; + dprintf(1, "floppy_select_drive enable motor dor=%x\n", dor); outb(dor, PORT_FD_DOR);
return DISK_RET_SUCCESS; @@ -321,6 +330,7 @@ set_diskette_current_cyl(u8 floppyid, u8 cyl) static int floppy_drive_recal(u8 floppyid) { + dprintf(1, "floppy_drive_recal %d\n", floppyid); int ret = floppy_select_drive(floppyid); if (ret) return ret; @@ -353,6 +363,8 @@ floppy_drive_recal(u8 floppyid) static int floppy_drive_readid(u8 floppyid, u8 data_rate, u8 head) { + dprintf(1, "floppy_drive_readid %d rate=%x head=%x\n" + , floppyid, data_rate, head); int ret = floppy_select_drive(floppyid); if (ret) return ret; @@ -380,6 +392,7 @@ floppy_media_sense(struct drive_s *drive_gf) { u8 ftype = GET_GLOBALFLAT(drive_gf->floppy_type), stype = ftype; u8 floppyid = GET_GLOBALFLAT(drive_gf->cntl_id); + dprintf(1, "floppy_media_sense %d ftype=%x\n", floppyid, ftype);
u8 data_rate = GET_GLOBAL(FloppyInfo[stype].data_rate); int ret = floppy_drive_readid(floppyid, data_rate, 0); @@ -413,6 +426,8 @@ floppy_media_sense(struct drive_s *drive_gf) < GET_GLOBAL(FloppyInfo[ftype].chs.cylinder)) fms |= FMS_DOUBLE_STEPPING; SET_BDA(floppy_media_state[floppyid], fms); + dprintf(1, "floppy_media_sense finish %d data_rate=%x fms=%x stype=%x\n" + , floppyid, data_rate, fms, stype);
return DISK_RET_SUCCESS; } @@ -425,6 +440,7 @@ check_recal_drive(struct drive_s *drive_gf) && (GET_BDA(floppy_media_state[floppyid]) & FMS_MEDIA_DRIVE_ESTABLISHED)) // Media is known. return DISK_RET_SUCCESS; + dprintf(1, "check_recal_drive %d\n", floppyid);
// Recalibrate drive. int ret = floppy_drive_recal(floppyid);
On Wed, Dec 04, 2013 at 10:22:17AM -0500, Kevin O'Connor wrote:
On Wed, Dec 04, 2013 at 09:27:20AM +0100, Gelip wrote:
Hi. I try set floppy support in SeaBIOS like this:
The floppy support in SeaBIOS has been tested on qemu, but has never been tested on real hardware. Your test indicates the SeaBIOS floppy support is not complete.
If you want to help debug this, apply the patch below to the latest seabios code from the seabios git, compile seabios with a debug level of 8, retry the test, and forward the results back to seabios@seabios.org. If you can capture the serial port traffic with the scripts/readserial.py tool from the seabios repo that would help (by providing additional timing information).
-Kevin
Sorry, try the patch below with the very latest seabios git.
-Kevin
diff --git a/src/hw/floppy.c b/src/hw/floppy.c index d43b489..190ef30 100644 --- a/src/hw/floppy.c +++ b/src/hw/floppy.c @@ -183,6 +183,7 @@ find_floppy_type(u32 size) static void floppy_disable_controller(void) { + dprintf(1, "floppy_disable_controller\n"); outb(inb(PORT_FD_DOR) & ~0x04, PORT_FD_DOR); }
@@ -219,6 +220,7 @@ struct floppy_pio_s { static int floppy_pio(struct floppy_pio_s *pio) { + dprintf(1, "floppy_pio\n"); // Send command to controller. u32 end = timer_calc(FLOPPY_PIO_TIMEOUT); int i = 0; @@ -276,6 +278,7 @@ floppy_pio(struct floppy_pio_s *pio) static int floppy_enable_controller(void) { + dprintf(1, "floppy_enable_controller\n"); outb(inb(PORT_FD_DOR) | 0x04, PORT_FD_DOR); int ret = floppy_wait_irq(); if (ret) @@ -292,6 +295,7 @@ floppy_enable_controller(void) static int floppy_select_drive(u8 floppyid) { + dprintf(1, "floppy_select_drive %d\n", floppyid); // reset the disk motor timeout value of INT 08 SET_BDA(floppy_motor_counter, FLOPPY_MOTOR_TICKS);
@@ -305,6 +309,7 @@ floppy_select_drive(u8 floppyid)
// Turn on motor of selected drive, DMA & int enabled, normal operation dor = (floppyid ? 0x20 : 0x10) | 0x0c | floppyid; + dprintf(1, "floppy_select_drive enable motor dor=%x\n", dor); outb(dor, PORT_FD_DOR);
return DISK_RET_SUCCESS; @@ -324,6 +329,7 @@ set_diskette_current_cyl(u8 floppyid, u8 cyl) static int floppy_drive_recal(u8 floppyid) { + dprintf(1, "floppy_drive_recal %d\n", floppyid); int ret = floppy_select_drive(floppyid); if (ret) return ret; @@ -356,6 +362,8 @@ floppy_drive_recal(u8 floppyid) static int floppy_drive_readid(u8 floppyid, u8 data_rate, u8 head) { + dprintf(1, "floppy_drive_readid %d rate=%x head=%x\n" + , floppyid, data_rate, head); int ret = floppy_select_drive(floppyid); if (ret) return ret; @@ -383,6 +391,7 @@ floppy_media_sense(struct drive_s *drive_gf) { u8 ftype = GET_GLOBALFLAT(drive_gf->floppy_type), stype = ftype; u8 floppyid = GET_GLOBALFLAT(drive_gf->cntl_id); + dprintf(1, "floppy_media_sense %d ftype=%x\n", floppyid, ftype);
u8 data_rate = GET_GLOBAL(FloppyInfo[stype].data_rate); int ret = floppy_drive_readid(floppyid, data_rate, 0); @@ -416,6 +425,8 @@ floppy_media_sense(struct drive_s *drive_gf) < GET_GLOBAL(FloppyInfo[ftype].chs.cylinder)) fms |= FMS_DOUBLE_STEPPING; SET_BDA(floppy_media_state[floppyid], fms); + dprintf(1, "floppy_media_sense finish %d data_rate=%x fms=%x stype=%x\n" + , floppyid, data_rate, fms, stype);
return DISK_RET_SUCCESS; } @@ -428,6 +439,7 @@ check_recal_drive(struct drive_s *drive_gf) && (GET_BDA(floppy_media_state[floppyid]) & FMS_MEDIA_DRIVE_ESTABLISHED)) // Media is known. return DISK_RET_SUCCESS; + dprintf(1, "check_recal_drive %d\n", floppyid);
// Recalibrate drive. int ret = floppy_drive_recal(floppyid);