aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fdc
Commit message (Collapse)AuthorAgeFilesLines
...
* For the moment, treat failures to attach floppy drives as non-fatalWarner Losh2004-09-161-2/+0
| | | | | | | | | | errors for the attachment process for the floppy controller. This is a band-aide because it doesn't try any of the fallback methods when _FDE isn't long enough, but should be sufficient for people experiencing the dreaded mutex not initialized panic. Notes: svn path=/head/; revision=135288
* Use bus_setup_intr in preference to BUS_SETUP_INTR.Warner Losh2004-09-141-1/+1
| | | | Notes: svn path=/head/; revision=135238
* Checkpoint the fdc resource changes:Warner Losh2004-09-144-121/+121
| | | | | | | | | | | | | | | o Allow for up to 3 resource I/O ranges to be given for the floppy controller, rather than just two that are allowed for now. o Make sure that we can work with either a base address of 0x3f0 or 0x3f2. o Create new inline functions to access the YE DATA's unique BDCR register. o Update pccard attachment to add the fd device. o Do some minor style(9) polishing. # I'm guessing that the fdc pccard attachment broke some time ago, since # there are a number of issues with it still. Notes: svn path=/head/; revision=135212
* When ISA_PNP_PROBE is called, it will return 0 when it finds a device,Warner Losh2004-08-311-2/+1
| | | | | | | | | | | | | | | | ENOENT when there's no PNP ID for this device node, or ENXIO when there is one, but it doesn't match. In the nonPNP case (as most Alpha systems appear to be), we were treating the error return as an error, when it should be have ignored it. Version 1.9 properly ignored it, but the attach re-write of 1.10 introduced this logic error. Pointy Hat to: phk (for breaking it then asking me to fix it :-) Sponsored by: The Voices in Bill Paul's Head, LLC Notes: svn path=/head/; revision=134580
* Fix _FDI drive type probing. The new fd child is not an ACPI device whileNate Lawson2004-08-301-3/+10
| | | | | | | | | | | | the old one is. Hence we need to evaluate the old one for _FDI since it has a valid ACPI_HANDLE ivar. This is a minimal fix. Make a note that a more complete one is to make fdc support the ACPI_HANDLE ivar for its children. This and the previous change are MT5 candidates. Notes: svn path=/head/; revision=134534
* Fix _FDE probing by using the buffer contents instead of the bufferNate Lawson2004-08-301-8/+25
| | | | | | | | object itself. ACPI-CA returns an ACPI_OBJECT of type Buffer rather than the buffer contents itself. Notes: svn path=/head/; revision=134533
* Hide a printf under bootverbose.Poul-Henning Kamp2004-08-271-1/+3
| | | | Notes: svn path=/head/; revision=134389
* Attempt to make the probe for hardware more specific.Poul-Henning Kamp2004-08-211-3/+22
| | | | Notes: svn path=/head/; revision=134113
* Remove a check that is too strict. With BIOSen that specify an IO/ctl portNate Lawson2004-08-201-4/+0
| | | | | | | | | | | | | of 0x3f2-0x3f5,0x3f7 the ports are not 7 bytes apart. This should fix floppy probing on such systems. (We handle the case of adjusting for a start of 0x3f2 -> 0x3f0 separately, although that code should still be checked if there are still floppy problems for others.) Tested by: Sarunas Vancevicius <vsarunas_at_eircom.net> MFC after: 3 days Notes: svn path=/head/; revision=134085
* Remove unused file.Poul-Henning Kamp2004-08-201-67/+0
| | | | Notes: svn path=/head/; revision=134082
* Rewrite of the floppy driver to make it MPsafe & GEOM friendly:Poul-Henning Kamp2004-08-205-1881/+1355
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Centralize the fdctl_wr() function by adding the offset in the resource to the softc structure. Bugfix: Read the drive-change signal from the correct place: same place as the ctl register. Remove the cdevsw{} related code and implement a GEOM class. Ditch the state-engine and park a thread on each controller to service the queue. Make the interrupt FAST & MPSAFE since it is just a simple wakeup(9) call. Rely on a per controller mutex to protect the bioqueues. Grab GEOMs topology lock when we have to and Giant when ISADMA needs it. Since all access to the hardware is isolated in the per controller thread, the rest of the driver is lock & Giant free. Create a per-drive queue where requests are parked while the motor spins up. When the motor is running the requests are purged to the per controller queue. This allows requests to other drives to be serviced during spin-up. Only setup the motor-off timeout when we finish the last request on the queue and cancel it when a new request arrives. This fixes the bug in the old code where the motor turned off while we were still retrying a request. Make the "drive-change" work reliably. Probe the drive on first opens. Probe with a recal and a seek to cyl=1 to reset the drive change line and check again to see if we have a media. When we see the media disappear we destroy the geom provider, create a new one, and flag that autodetection should happen next time we see a media (unless a specific format is configured). Add sysctl tunables for a lot of drive related parameters. If you spend a lot of time waiting for floppies you can grab the i82078 pdf from Intels web-page and try tuning these. Add sysctl debug.fdc.debugflags which will enable various kinds of debugging printfs. Add central definitions of our well known floppy formats. Simplify datastructures for autoselection of format and call the code at the right times. Bugfix: Remove at least one piece of code which would have made 2.88M floppies not work. Use implied seeks on enhanced controllers. Use multisector transfers on all controllers. Increase ISADMA bounce buffers accordingly. Fall back to single sector when retrying. Reset retry count on every successful transaction. Sort functions in a more sensible order and generally tidy up a fair bit here and there. Assorted related fixes and adjustments in userland utilities. WORKAROUNDS: Do allow r/w opens of r/o media but refuse actual write operations. This is necessary until the p4::phk_bufwork branch gets integrated (This problem relates to remounting not reopening devices, see sys/*/*/${fs}_vfsops.c for details). Keep PC98's private copy of the old floppy driver compiling and presumably working (see below). TODO (planned) Move probing of drives until after interrupts/timeouts work (like for ATA/SCSI drives). TODO (unplanned) This driver should be made to work on PC98 as well. Test on YE-DATA PCMCIA floppy drive. Fix 2.88M media. This is a MT5 candidate (depends on the bioq_takefirst() addition). Notes: svn path=/head/; revision=134081
* Remove confused comment.Poul-Henning Kamp2004-08-141-4/+0
| | | | Notes: svn path=/head/; revision=133727
* Fix ACPI floppy enumeration for three types of divergent behavior.Nate Lawson2004-07-281-40/+90
| | | | | | | | | | | | | | | | | | | | * Some systems have _FDE and child floppy devices, but no _FDI. This seems to be compatible with the standard. Don't error out if there is no _FDI. Instead, continue on to the next device. The normal fd probe will take care of this device. * Some systems have _FDE but no child devices in AML. For these, add a second pass that compares the results of _FDE to the presence of devices. If not present, add the missing device. * Some BIOS authors didn't read the spec. They use tape drive values for all fdc(4) devices. Since this isn't grossly incompatible with the required boolean value, use them. They also define the _FDE items as a package instead of buffer. Regenerate the buffer from the package if it is present. Tested by: tjr, marcel Notes: svn path=/head/; revision=132810
* Correct typo.Yoshihiro Takahashi2004-07-171-1/+1
| | | | Notes: svn path=/head/; revision=132285
* Remove duplicate include.Yoshihiro Takahashi2004-07-171-1/+0
| | | | Notes: svn path=/head/; revision=132284
* Be consistant with probeWarner Losh2004-07-161-2/+1
| | | | Notes: svn path=/head/; revision=132271
* Clean up resources properly if attach fails. Always reset ISA drives onNate Lawson2004-07-152-15/+31
| | | | | | | probe. Notes: svn path=/head/; revision=132216
* Re-work for fdc_acpi. Expose fdc_add_child() and move the staticNate Lawson2004-07-152-27/+36
| | | | | | | | | | | | hints-based probe to fdc_hints_probe(). Also: * Fix some resource leaks when attach fails. * Remove the FDC_ATTACHED flag. It was supposed to prevent multiple unloads but this is not necessary. Notes: svn path=/head/; revision=132215
* Add an ACPI floppy drive attachment that probes via the _FDE and _FDINate Lawson2004-07-151-0/+260
| | | | | | | | | | methods. It also now handles ordinary floppy drive probing for drives attached to ACPI. Reviewed by: imp Notes: svn path=/head/; revision=132214
* Add a comment separator.Nate Lawson2004-07-141-1/+1
| | | | Notes: svn path=/head/; revision=132166
* Remove fdc_alloc_resources, which should have happened in last commit.Warner Losh2004-07-142-143/+2
| | | | Notes: svn path=/head/; revision=132139
* Fix the pccard attachment to have a chance of working.Warner Losh2004-07-142-32/+214
| | | | | | | Move the resource allocation into the bus front ends. Notes: svn path=/head/; revision=132137
* Set fdc_dev in attachWarner Losh2004-07-131-0/+1
| | | | Notes: svn path=/head/; revision=132081
* Don't depend on implicit include of machine/bus.h in sys/rman.h, but insteadWarner Losh2004-07-133-0/+5
| | | | | | | explicitly include it. Notes: svn path=/head/; revision=132080
* Remove unnecessary softc bzero calls.Nate Lawson2004-07-122-2/+0
| | | | Notes: svn path=/head/; revision=132050
* Update in preparation for adding the ACPI attachment.Nate Lawson2004-07-124-68/+94
| | | | | | | | | | | | | | | | | * Add an fdtype ivar. This will be the equivalent of fd->type. * Move enabling the FIFO to the end of attach. * Unify reset code into fdc_initial_reset(). * Add fdc_write_ivar(). * Update isa and pccard attachments accordingly. * Set the flags unconditionally in probe since they may be overridden by other probe routines. Both before and now, we're depending on probe being called a final time on the winning driver so the flags we get are the ones we intended. * Use the bus accessor macros instead of defining our own. * Remove duplicate assigns of fd->type. Notes: svn path=/head/; revision=132048
* Until I'm ready to commit the better pccard probe/attach routines, effectivelyWarner Losh2004-07-111-0/+2
| | | | | | | comment them out. Notes: svn path=/head/; revision=131983
* Break out the isa and pccard front ends from fdc. This is the firstWarner Losh2004-07-074-304/+405
| | | | | | | | | | | step in making this driver more attachment neutral. Others plan on adding acpi front ends. Still need to cleanup the MI part of the driver because it isn't as bus independent as it could be. Notes: svn path=/head/; revision=131767
* Allocate the DMA channel shareable and only aquire it while thePoul-Henning Kamp2004-07-051-15/+18
| | | | | | | | | device is open. This allows certain old and rather special dual floppy controllers to work on both channels, as long as you only have one open at a time. Notes: svn path=/head/; revision=131648
* Mark our interrupt shareable and don't insist on DMA. This gets us closerPoul-Henning Kamp2004-07-041-4/+4
| | | | | | | to working with a secondary floppy controller on a PC. Notes: svn path=/head/; revision=131599
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-8/+8
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Use rman_get_start in preference to reaching into the rman structure.Warner Losh2004-05-271-1/+1
| | | | Notes: svn path=/head/; revision=129787
* Update to reflect new location in the tree. This has been repo copiedWarner Losh2004-05-171-1/+1
| | | | | | | | from sys/isa/fd.c in preparation for specialization of attachments for different busses. Notes: svn path=/head/; revision=129316
* Fixed breakage of the formatting operation in rev.1.266. The wrongBruce Evans2004-04-251-2/+9
| | | | | | | | | clause of an if-else statement was removed. Reviewed by: no response from maintainer in 12 days Notes: svn path=/head/; revision=128632
* Remove advertising clause from University of California Regent'sWarner Losh2004-04-072-8/+0
| | | | | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson Notes: svn path=/head/; revision=128019
* Convert callers to the new bus_alloc_resource_any(9) API.Nate Lawson2004-03-171-9/+7
| | | | | | | | Submitted by: Mark Santcroos <marks@ripe.net> Reviewed by: imp, dfr, bde Notes: svn path=/head/; revision=127135
* Remove unused FDNUMTOUNIT() macroPoul-Henning Kamp2004-02-291-2/+0
| | | | Notes: svn path=/head/; revision=126400
* Make mode setting with fdcontrol(8) stick.Poul-Henning Kamp2004-02-251-182/+61
| | | | | | | Recognize when configured for "auto". Notes: svn path=/head/; revision=126232
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-1/+2
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* Device megapatch 1/6:Poul-Henning Kamp2004-02-211-2/+0
| | | | | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number. Notes: svn path=/head/; revision=126076
* Workaround some ACPI BIOSen which break the IO port into multipleNate Lawson2004-02-151-1/+35
| | | | | | | | | | | | | | | | resources. (Note that the correct range is 0x3f7,0x3f0-0x3f5.) Such devices will be detected as follows: fdc0: <Enhanced floppy controller (i82077, NE72065 or clone)> port 0x3f7,0x3f4-0x3f5,0x3f2-0x3f3,0x3f0-0x3f1 irq 6 drq 2 on acpi0 To do this, we find the minimum and maximum start addresses for the resources and use them as the base for the IO and control ports. Help from: jhb Notes: svn path=/head/; revision=125851
* Look at the equipment list for amd64 as well as i386 for autodetectingPeter Wemm2003-10-231-2/+2
| | | | | | | floppy drives in the absence of hints. Notes: svn path=/head/; revision=121403
* Eliminate use bio_blkno.Poul-Henning Kamp2003-10-181-16/+10
| | | | Notes: svn path=/head/; revision=121215
* Pick up softc from dev_t rathern than through newbus gymnastics.Poul-Henning Kamp2003-09-171-11/+12
| | | | Notes: svn path=/head/; revision=120154
* Since it is static these days, there is no reason to uppercase thePoul-Henning Kamp2003-09-171-4/+4
| | | | | | | first letter of fdopen() to avoid nameclashing with other stuff. Notes: svn path=/head/; revision=120153
* Disable the use of cloning use in floppy and CD drivers.Poul-Henning Kamp2003-09-111-6/+6
| | | | | | | | | | | | | This commit puts the relevant code snippets under #ifdef GONE_IN_5 (rather than #ifndef BURN_BRIDGES) thereby disabling the code now. The code wil be entirely removed before 5.2 unless we find reasons why this would be a bad idea. Approach suggested by: imp Notes: svn path=/head/; revision=119994
* Put the device cloning functions for disk-drivers under #ifndef BURN_BRIDGES.Poul-Henning Kamp2003-09-051-3/+19
| | | | | | | | | | | | | | For the floppy driver, use fdcontrol to manipulate density selection. For the CD drivers, the 'a' and 'c' suffix is without actual effect and any applications insisting on it can be satisfied with a symlink: ln -s /dev/cd0 /dev/cd0a Ongoing discussion may result in these pieces of code being removed before the 5-stable branch as opposed to after. Notes: svn path=/head/; revision=119761
* - Use the new resource_disabled() helper function to see if devices areJohn Baldwin2003-07-021-3/+2
| | | | | | | | | | | | | | | disabled. - Change the apm driver to match the acpi driver's behavior by checking to see if the device is disabled in the identify routine instead of in the probe routine. This way if the device is disabled it is never created. Note that a few places (ips(4), Alpha SMP) used "disable" instead of "disabled" for their hint names, and these hints must be changed to "disabled". If this is a big problem, resource_disabled() can always be changed to honor both names. Notes: svn path=/head/; revision=117167
* Force media autodetection if the device has lost its parameter table.Yaroslav Tykhiy2003-06-161-1/+7
| | | | | | | | | | | | Previously, any normal I/O on an fdc(4) device would fail with ENXIO if the device had been opened in non-blocking mode and then closed prior to the conventional access; that would last until the floppy disk was ejected and re-inserted to raise the unit attention condition. Add a clarifying comment. Notes: svn path=/head/; revision=116434
* If in non-blocking mode, return EAGAIN instead of ENXIOYaroslav Tykhiy2003-06-161-1/+4
| | | | | | | | | | on an I/O attempt. This is needed for consistency with the concept of the half-opened state of fdc(4). PR: kern/52338 Notes: svn path=/head/; revision=116432