From olivleh1@kartoffel.salatschuessel.net  Thu Nov  6 15:17:02 2003
Return-Path: <olivleh1@kartoffel.salatschuessel.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id 7CC7616A4CE; Thu,  6 Nov 2003 15:17:02 -0800 (PST)
Received: from kartoffel.salatschuessel.net (pD9520D2A.dip.t-dialin.net [217.82.13.42])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id E3F5643FF2; Thu,  6 Nov 2003 15:16:53 -0800 (PST)
	(envelope-from olivleh1@kartoffel.salatschuessel.net)
Received: from kartoffel.salatschuessel.net (localhost [127.0.0.1])
	by kartoffel.salatschuessel.net (8.12.9p2/8.12.9) with ESMTP id hA6NGqSx027401;
	Fri, 7 Nov 2003 00:16:53 +0100 (CET)
	(envelope-from olivleh1@kartoffel.salatschuessel.net)
Received: (from olivleh1@localhost)
	by kartoffel.salatschuessel.net (8.12.9p2/8.12.9/Submit) id hA6NGqE1027400;
	Fri, 7 Nov 2003 00:16:52 +0100 (CET)
	(envelope-from olivleh1)
Message-Id: <200311062316.hA6NGqE1027400@kartoffel.salatschuessel.net>
Date: Fri, 7 Nov 2003 00:16:52 +0100 (CET)
From: Oliver Lehmann <oliver@freebsd.org>
Reply-To: Oliver Lehmann <oliver@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Oliver Lehmann <oliver@freebsd.org>
Subject: re-add Floppy-Dtectection-Support for FreeBSD/alpha
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         59026
>Category:       alpha
>Synopsis:       re-add Floppy-Dtectection-Support for FreeBSD/alpha
>Confidential:   no
>Severity:       non-critical
>Priority:       high
>Responsible:    freebsd-alpha
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 06 15:20:08 PST 2003
>Closed-Date:    Sun Dec 07 18:56:23 PST 2003
>Last-Modified:  Sun Dec 07 18:56:23 PST 2003
>Originator:     Oliver Lehmann
>Release:        FreeBSD 4.9-RC i386
>Organization:
>Environment:

	FreeBSD 5.1-p10 alpha
	(patch is made against HEAD file)

>Description:
To get back a working and floppydrive detection on FreeBSD/alpha:

I moved in fd_probe() 
	if (fd->type == FDT_NONE && (fd->fdu == 0 || fd->fdu == 1)) {
out of the
#if defined(__i386__) || defined(__amd64__)
block and created an #else section (like it allready was in RELENG_4!)
where the fd->type is set to 144 by force.

Why not just re-create the #else block? Why moving the if statement out of
the #ifdef block? Doing it that way, it's still possible to set
hint.fd.0.flags for example to 3 (720KB Floppy), and only set the 1.44M
type as a fallback when flags is NULL (FDT_NONE) which means in that case,
hint.fd.0.flags isn't defined. (Because we don't query the "BIOS" as we do
it for x86 to get the info what kind of floppy is attached to fdc.)

	before:

orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0
fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> at port 0x3f7,0x3f0-0x3f5 irq 6 drq 2 on isa0
fdc0: interrupting at ISA irq 6
atkbdc0: <Keyboard controller (i8042)> at port 0x64,0x60 on isa0


	after:

orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0
fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> at port 0x3f7,0x3f0-0x3f5 irq 6 drq 2 on isa0
fdc0: interrupting at ISA irq 6
fdc0: FIFO enabled, 8 bytes threshold
fd0: <1440-KB 3.5" drive> on fdc0 drive 0
atkbdc0: <Keyboard controller (i8042)> at port 0x64,0x60 on isa0


>How-To-Repeat:
	make kernel
	<reboot>
	fdc gets detected, but no fd%d
>Fix:

	

--- src::sys::isa::fd.c begins here ---
--- src/sys/isa/fd.c.orig	Thu Oct 23 07:52:52 2003
+++ src/sys/isa/fd.c	Tue Nov  4 20:05:13 2003
@@ -1204,6 +1204,8 @@
 	fd->flags = FD_UA;	/* make sure fdautoselect() will be called */
 
 	fd->type = FD_DTYPE(flags);
+
+	if (fd->type == FDT_NONE && (fd->fdu == 0 || fd->fdu == 1)) {
 /*
  * XXX I think using __i386__ is wrong here since we actually want to probe
  * for the machine type, not the CPU type (so non-PC arch's like the PC98 will
@@ -1211,7 +1213,6 @@
  * == i386 breaks the test on FreeBSD/Alpha.
  */
 #if defined(__i386__) || defined(__amd64__)
-	if (fd->type == FDT_NONE && (fd->fdu == 0 || fd->fdu == 1)) {
 		/* Look up what the BIOS thinks we have. */
 		if (fd->fdu == 0) {
 			if ((fdc->flags & FDC_ISPCMCIA))
@@ -1229,8 +1230,11 @@
 		}
 		if (fd->type == FDT_288M_1)
 			fd->type = FDT_288M;
-	}
+#else
+		fd->type = FDT_144M;
 #endif /* __i386__ || __amd64__ */
+	}
+
 	/* is there a unit? */
 	if (fd->type == FDT_NONE)
 		return (ENXIO);
--- src::sys::isa::fd.c ends here ---


>Release-Note:
>Audit-Trail:

From: des@des.no (Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?=)
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: alpha/59026
Date: Fri, 05 Dec 2003 00:42:46 +0100

 The preferred solution seems to be to add the following line to
 /boot/device.hints:
 
 hint.fd.0.flags=3D"4"
 
 DES
 --=20
 Dag-Erling Sm=F8rgrav - des@des.no
State-Changed-From-To: open->closed 
State-Changed-By: des 
State-Changed-When: Sun Dec 7 18:56:22 PST 2003 
State-Changed-Why:  
See src/sys/alpha/conf/GENERIC.hints rev 1.7 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59026 
>Unformatted:
