Skip to content

Commit aed4bca

Browse files
authored
Merge pull request #2682 from ghaerr/martypc1
[kernel] Allow unimplemented FDC version command for MartyPC in direct FD driver
2 parents 4b8d0b2 + 182b0a0 commit aed4bca

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

elks/Makefile-rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ include $(TOPDIR)/Make.defs
5858
VERSION = 0 # (0-255)
5959
PATCHLEVEL = 9 # (0-255)
6060
SUBLEVEL = 2 # (0-255)
61-
PRE = dev
61+
PRE = -dev
6262

6363
#########################################################################
6464
# Specify the architecture we will use.

elks/arch/i86/drivers/block/directfd.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,18 +1447,17 @@ static void DFPROC floppy_deregister(void)
14471447
set_irq();
14481448
}
14491449

1450-
/* Try to determine the floppy controller type */
1451-
static int DFPROC get_fdc_version(void)
1450+
/* Try to determine the floppy controller type; sets fdc_version global */
1451+
static void DFPROC get_fdc_version(void)
14521452
{
14531453
int type = FDC_TYPE_8272A;
14541454
const char *name;
14551455

14561456
do_floppy = ignore_interrupt;
14571457
output_byte(FD_VERSION); /* get FDC version code */
1458-
if (result() != 1) {
1459-
printk("df: can't get FDC version\n");
1460-
return 0;
1461-
}
1458+
if (result() != 1)
1459+
reply_buffer[0] = 0; /* NOTE: fixes unimplemented command in MartyPC */
1460+
14621461
switch (reply_buffer[0]) {
14631462
case 0x80:
14641463
if (arch_cpu >= CPU_80286) { /* PC/AT or better */
@@ -1473,19 +1472,18 @@ static int DFPROC get_fdc_version(void)
14731472
name = "82077";
14741473
break;
14751474
default:
1476-
name = "Unknown";
1475+
name = "8272A assumed";
14771476
}
14781477
printk("df: direct floppy FDC %s (0x%x), irq %d, dma %d\n",
14791478
name, reply_buffer[0], FLOPPY_IRQ, FLOPPY_DMA);
1479+
fdc_version = type; /* must set version before reset_floppy called */
14801480

14811481
/* Not all FDCs seem to be able to handle the version command
14821482
* properly, so force a reset for the standard FDC clones,
14831483
* to avoid interrupt garbage.
14841484
*/
14851485
initial_reset_flag = 1;
14861486
reset_floppy();
1487-
1488-
return type;
14891487
}
14901488

14911489
static int DFPROC floppy_register(void)
@@ -1502,7 +1500,7 @@ static int DFPROC floppy_register(void)
15021500
return err;
15031501
}
15041502

1505-
fdc_version = get_fdc_version();
1503+
get_fdc_version();
15061504
if (!fdc_version) return -EIO;
15071505
return 0;
15081506
}

elkscmd/rootfs_template/bootopts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ hma=kernel
2020
#root=cfa1
2121
#root=hda1 ro
2222
#root=df0
23+
#enable=df0
24+
#disable=fd0
2325
#task=16 buf=64 cache=8 file=64 inode=96 heap=44000 # std
2426
#task=6 buf=8 cache=4 file=20 inode=24 heap=15000 n # min
2527
#sync=30

0 commit comments

Comments
 (0)