Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 61832 - gentoo-dev-sources-2.6.8-r3 floppy does not work
Summary: gentoo-dev-sources-2.6.8-r3 floppy does not work
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: Daniel Drake (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 62095
  Show dependency tree
 
Reported: 2004-08-26 10:23 UTC by Antonio
Modified: 2004-09-30 01:15 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
differences between Gentoo's drivers/acpi/scan.c and "-mm" one (gentoo-vs-mm,7.39 KB, patch)
2004-08-28 03:29 UTC, Paolo Ornati
Details | Diff
Quick hack to get floppy working with ACPI enabled (floppy_patch.diff,792 bytes, patch)
2004-08-29 01:41 UTC, Paolo Ornati
Details | Diff
2310_fix-floppy-v2.patch (2310_fix-floppy-v2.patch,6.16 KB, patch)
2004-09-05 04:22 UTC, Daniel Drake (RETIRED)
Details | Diff
acpi-hack.patch (acpipatch,830 bytes, patch)
2004-09-05 04:27 UTC, Daniel Drake (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio 2004-08-26 10:23:30 UTC
I have emerge and compile gentoo-dev-sources-2.6.8-r3, but the floppy driver does not work.

On boot appear this:

...........
...........
acpi_floppy_resource: 6 ioports at 0x3f0
acpi_floppy_resource: 1 ioports at 0x3f7
floppy: controller ACPI FDC0 at I/O 0x3f0-0x3f5, 0x3f7-0x3f7 irq 6 dma channel 2
RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize
..........
..........

/dev/fd0 does not exist.

With kernel gentoo-dev-sources-2.6.7-r14 floppy work well

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Daniel Drake (RETIRED) gentoo-dev 2004-08-26 11:04:28 UTC
Hmm.. floppy was broke for many in 2.6.8, we introduced a patch in -r3 to fix it. Would you mind trying  gentoo-dev-sources-2.6.8-r2 ?
Comment 2 lefti 2004-08-27 11:57:57 UTC
On kernel gentoo-dev-sources-2.6.8-r2 i have /dev/fd0, but *not* on -r3.
Comment 3 Paolo Ornati 2004-08-28 02:25:22 UTC
I'm having the same problem...

2.6.8-gentoo-r3 --> floppy doesn't work
2.6.8.1 (vanilla) --> it works
2.6.9-rc1-mm1 --> it works

I've noticed that 2.6.8-gentoo-r3 adds ACPI floppy detection (or something like that) as 2.6.9-rc1-mm1 does: "drivers/block/floppy.c" is the same for both.
The only difference is that -mm1 works, so it seems that -mm1 has some useful patches that -gentoo-r3 wants ;-)
Comment 4 Paolo Ornati 2004-08-28 03:29:00 UTC
Created attachment 38375 [details, diff]
differences between Gentoo's drivers/acpi/scan.c and "-mm" one
Comment 5 Paolo Ornati 2004-08-28 03:29:58 UTC
I have found where the problem comes from...

"drivers/block/floppy.c"
##########################
static int acpi_floppy_init(void)
{
        if (no_acpi)
                return -ENODEV;
        return acpi_bus_register_driver(&acpi_floppy_driver);
}
[...]
int __init floppy_init(void)
{
        int i, unit, drive;
        int err, dr;

#ifdef CONFIG_ACPI_BUS
        if (acpi_floppy_init() == 0)
                return -ENODEV;
#endif
##########################

floppy_init() return -ENODEV... why?
because acpi_floppy_init() returns 0... why?
because acpi_bus_register_driver(&acpi_floppy_driver) resturn 0... why?

look at this attached diff:
diff -up 2.6.8-gentoo-r3/drivers/acpi/scan.c 2.6.9-rc1-mm1/drivers/acpi/scan.c

and focus on this:

#######################
 static int acpi_driver_detach(struct acpi_driver * drv)
@@ -328,28 +424,30 @@ static int acpi_driver_detach(struct acp
  * acpi_bus_register_driver 
  * ------------------------ 
  * Registers a driver with the ACPI bus.  Searches the namespace for all
- * devices that match the driver's criteria and binds.
+ * devices that match the driver's criteria and binds.  Returns the
+ * number of devices that were claimed by the driver, or a negative
+ * error status for failure.
  */
 int
 acpi_bus_register_driver (
        struct acpi_driver      *driver)
 {
-       int error = 0;
+       int count;
[....]
-       return_VALUE(error);
+       spin_lock(&acpi_device_lock);
+       list_add_tail(&driver->node, &acpi_bus_drivers);
+       spin_unlock(&acpi_device_lock);
+       count = acpi_driver_attach(driver);
+
+       return_VALUE(count);
#########################

In the previous version the function acpi_driver_detach() returned the error code (0 on success) while in the new one it returns "the number of devices that were claimed by the driver".

In other words: new code in "drivers/block/floppy.c" depends on these changes in "drivers/acpi/scan.c".

:)
Comment 6 Daniel Drake (RETIRED) gentoo-dev 2004-08-28 08:33:05 UTC
But changing drivers/block/scan.c is bound to break many other drivers that rely on its old behaviour. I think a quick hack to our floppy.c patch would be the best bet here. I'll look into this once I'm back home after the weekend.
Comment 7 Paolo Ornati 2004-08-29 01:41:05 UTC
Created attachment 38417 [details, diff]
Quick hack to get floppy working with ACPI enabled

This patch fix floppy for gentoo-dev-sources-2.6.8-r3...

another workaround for users: append "floppy=no_acpi" to kernel command line
Comment 8 Antonio 2004-08-29 02:14:55 UTC
With append "floppy=no_acpi" to kernel command line floppy work well
Comment 9 Paolo Ornati 2004-08-29 03:44:01 UTC
> With append "floppy=no_acpi" to kernel command line floppy work well

of course, because with that option the driver simply avoid to use the new code (the new code is correct, but depends on a new "acpi_bus_register_driver" function)
Comment 10 Michael Steiner 2004-09-02 12:23:25 UTC
On my system, (2.6.8r3), patching the floppy.c with the attached patch file above results in the following situation:

floppy.c compiled as module
after restart, "modprobe floppy" -> error on system console: 
"Inserting floppy driver for 2.6.8-gentoo-r3
 floppy0: no floppy controllers found"

after I try a second time, it works as usual "modprobe floppy":
"Inserting floppy driver blabla
 FDC 0 is a post-1991 82077"

Any idea how to fix that? Is annoying always to run modprobe twice ...
Comment 11 Selecter 2004-09-04 11:11:14 UTC
Confirm that the problem is with -r3 only. On -r1 it works fine.
Comment 12 Yokeo Yu 2004-09-04 19:55:05 UTC
Nothing changed after append "floppy=no_acpi" to kernel command line on my Dual PIII box, "acpi=off" does work :(
Comment 13 Daniel Drake (RETIRED) gentoo-dev 2004-09-05 04:22:08 UTC
Created attachment 38967 [details, diff]
2310_fix-floppy-v2.patch

Here's a patch which I'm about to send to get merged into g-d-s. It replaces
the current 2310_fix-floppy.patch, so if you test it, make sure you reverse
that one first.
Again its a resync to -mm with an ACPI hack applied.
Comment 14 Daniel Drake (RETIRED) gentoo-dev 2004-09-05 04:27:12 UTC
Created attachment 38968 [details, diff]
acpi-hack.patch

Here's the ACPI hack I put in place. This doesn't need to be applied, I just
put it here for reference and incase anyone is interested.
Paolo, thanks a lot for the research and patching you did into this problem,
it's been very helpful.
Comment 15 Paolo Ornati 2004-09-05 09:25:10 UTC
> Paolo, thanks a lot for the research and patching you did into this problem,
> it's been very helpful.

Please ;)
Comment 16 Michael Steiner 2004-09-07 02:38:01 UTC
I just tried to "patch floppy.c 2310_fix-floppy-v2.patch" and it wouldn't work - floppy.c is from gentoo-dev-sources 2.6.8-gentoo-r3.

What am I doing wrong?

Result is:
patching file floppy.c
Hunk #1 succeeded at 188 with fuzz 2 (offset 7 lines).
Hunk #2 FAILED at 4164.
Hunk #3 FAILED at 4239.
Hunk #4 succeeded at 4733 (offset 152 lines).
Hunk #5 succeeded at 4951 (offset 152 lines).
2 out of 5 hunks FAILED -- saving rejects to file floppy.c.rej
Comment 17 Daniel Drake (RETIRED) gentoo-dev 2004-09-07 05:02:44 UTC
You have to revert the old 2310 patch first (i.e. patch -R). You can find that in one of the genpatches tarball.
Comment 18 Michael Steiner 2004-09-07 14:57:26 UTC
Thanks Daniel, I wasn't aware that the first patch was already applied to and distributed with the "generic" 2.6.8-r3 sources.
Comment 19 Ashe 2004-09-08 19:46:35 UTC
This doesn't appear to have been included in r4. I still get the same problem.
Comment 20 Daniel Drake (RETIRED) gentoo-dev 2004-09-30 01:15:15 UTC
Please retry with gentoo-dev-sources-2.6.8-r5 .. i dropped this patching altogether, should work like the original 2.6.8.1 now