aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/fdc
Commit message (Collapse)AuthorAgeFilesLines
* MFC: Fix various minor bugs and nits in callout handling.John Baldwin2006-03-071-9/+5
| | | | | | | Approved by: re (scottl) Notes: svn path=/stable/6/; revision=156394
* MFC: canonify the include of acpi.h.David E. O'Brien2005-11-071-1/+1
| | | | Notes: svn path=/stable/6/; revision=152152
* MFC: 1.380Craig Rodrigues2005-09-021-1/+1
| | | | | | | | | | | | FDOPT_NORETRY is an option, and must be compared with fd->options, not fd->flags. PR: kern/85481 Submitted by: Lev Levinson <llevinson at inbox dot ru> Approved by: re (ken) Notes: svn path=/stable/6/; revision=149699
* Eliminate unused argument in PCMCIA_CARD macro.Warner Losh2005-06-241-1/+1
| | | | | | | | | | | Provide a backwards compatible way to have the extra macro by defining PCCARD_API_LEVEL 5 before including pccarddevs for driver writers that want/need to have the same driver on 5 and 6 with pccard attachments. Approved by: re (dwhite) Notes: svn path=/head/; revision=147580
* If we fail a sanity check for the resources just allocated, make sureWarner Losh2005-03-151-1/+3
| | | | | | | | | | that we free that resource. All the other resources are freed in their own routine, but since we haven't saved a pointer to this one, it is leaked. This is the failure case that lead to the sio ports that weren't working, I think. Notes: svn path=/head/; revision=143618
* Only allocate 1 port for non-zero rids. Either we'll get the properWarner Losh2005-03-141-1/+1
| | | | | | | | length form the enumeration mechanism, or we're dealing with the FDCTL register, which is only 1 port long. Notes: svn path=/head/; revision=143602
* Fix a couple of problems with the probe code when used with pnpbiosWarner Losh2005-03-101-9/+23
| | | | | | | | | | | | | | | | | | | | | resources. When allocating 6 ports for a 4 port range isa code returns an error. I'm not sure yet why this is the case, but suspect it is just a non-regularity in how the resource allocation code works which should be corrected. Use 1 as the ports size in this case. However, in the hints case, we have to specify the length, so use 6 in that case. I believe that this is also acpi friendly. Also, complain when we can't allocate FDOUT register space. Right now we silently fail when we can't. This failure is referred to above. When there's no resource for FDCTL, go ahead and allocate one by hand. Many PNPBIOS tables don't list this resource, and our hints mechanism also doesn't cover that range. If we can't allocate it, whine, but fake up something. Before, we were always bogusly faking it and no one noticed the sham (save the original author who has now fixed his private shame). Notes: svn path=/head/; revision=143380
* Add missing ()Poul-Henning Kamp2005-02-281-3/+3
| | | | Notes: svn path=/head/; revision=142791
* Add missing va_end() in fdc_cmd.Pyun YongHyeon2005-02-281-2/+5
| | | | | | | | | 0 -> NULL in arguments of fdc_sense_int(). Reminded by: joerg Notes: svn path=/head/; revision=142750
* Mask off the upper bits of the resource before using it as an indexWarner Losh2005-01-201-3/+10
| | | | | | | | | | into a small array. Also, re-save the dev in attach to avoid depending on side effects of the probe. Weird stuff Reported by: jeffr Notes: svn path=/head/; revision=140514
* MFp4: overhaul of resource allocationWarner Losh2005-01-194-158/+134
| | | | | | | | | | | | | | | | | | | | Rather than have a twisty maze of special case allocations, move instead to a data driven allocation. This should be the most robust way to cope with the resource problems that the multiplicity of ways of encoding 5 registers that have the misfortune of not being a power of 2 nor contiguous. Also, make it less impossible that pccard will work. I've not been able to get my libretto floppy working, but it now fails later than before. phk and I had similar ideas on this during the 5.3 release cycle, but it wasn't until recently that I could test more than one allocation scenario. MFC After: 1 month (5.4 if possible, 5.5 if not) Notes: svn path=/head/; revision=140469
* Use the standard FreeBSD licenseWarner Losh2005-01-113-21/+15
| | | | Notes: svn path=/head/; revision=140040
* Pass the file->flags down to geom ioctl handlers.Poul-Henning Kamp2004-12-121-1/+7
| | | | | | | | | | | Reject certain ioctls if write permission is not indicated. Bump geom API version. Reported by: Ruben de Groot <mail25@bzerk.org> Notes: svn path=/head/; revision=138732
* Properly wither the geom container on detach. This will allow one toWarner Losh2004-11-211-0/+5
| | | | | | | | | | | then later reload fdc and not have duplicate fd devices in dev. # Maybe this should be moved to a convenience function. Reviewed by: phk Notes: svn path=/head/; revision=137973
* Add the last missing bits to make this unloadable: Two wakeups andPoul-Henning Kamp2004-11-081-3/+11
| | | | | | | | calling of the GEOM modevent from the drivers modevent so we know the order things happen. Notes: svn path=/head/; revision=137398
* Remove a duplicate code.Yoshihiro Takahashi2004-10-301-1/+0
| | | | Notes: svn path=/head/; revision=137068
* Now that filesystems respect and understand GEOM access counts, refusePoul-Henning Kamp2004-10-291-2/+0
| | | | | | | a write open of a read-only floppydisk. Notes: svn path=/head/; revision=137044
* Properly handle failure to allocate isadma bounce bufferPoul-Henning Kamp2004-10-221-2/+6
| | | | Notes: svn path=/head/; revision=136787
* Remove unused variable. Pointy hat candidate.Nate Lawson2004-10-151-1/+0
| | | | Notes: svn path=/head/; revision=136533
* Remove local hacks to set flags now that the device probe does this for us.Nate Lawson2004-10-141-2/+0
| | | | | | | | | | Tested on every device except sio_pci and the pc98 fd.c. Perhaps something similar should be done for the "disabled" hints also. MFC after: 2 weeks Notes: svn path=/head/; revision=136520
* Fix off-by-one error in fd_native_types that results in a panic on bootPeter Edwards2004-10-101-0/+1
| | | | | | | | | for machines with 2.88M floppies. Reviewed By: phk Notes: svn path=/head/; revision=136360
* Yet another case of resources:Warner Losh2004-10-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | + * 9: 0x3f0-0x3f3,0x3f4-0x3f5,0x3f7 This requires only one change to support. Rather than keying on the size of the resource being 2, instead key off the end & 7 being 3. This covers the same cases that the size of 2 would catch, but also covers the new above case. In addition, I think it is clearer to use the end in preference to the size and start for case #8 as well. Turns two tests into one, and catches no other cases. Make minor commentary changes to deal with new case #9. # This change is specifically minimal to allow easy MFC. A more # extensive change will go into current once I've had a chance to test # it on a lot of hardware... Notes: svn path=/head/; revision=136138
* Only fall back to probing the floppy drives via hints if there is a failureJohn Baldwin2004-09-291-5/+9
| | | | | | | | | | | | in the actual _FDE parsing. If the failure occurs earlier such as in fdc_attach() then don't try to probe any drives. MFC after: 3 days Reviewed by: njl Tested by: Christian Laursen xi at borderworlds dot dk Notes: svn path=/head/; revision=135938
* Use the floppy drive unit number to name the /dev entry, not thePoul-Henning Kamp2004-09-251-1/+1
| | | | | | | | | controller unit number. Submitted by: Rostislav Krasny <rosti_bsd@yahoo.com> Notes: svn path=/head/; revision=135788
* Few (trailing) whitespace and spelling fixes.Joerg Wunsch2004-09-241-6/+6
| | | | Notes: svn path=/head/; revision=135766
* Protect fdc->flags within the worker thread, too.Joerg Wunsch2004-09-241-1/+6
| | | | | | | | | Use kthread_exit() instead of falling through the end of the worker thread's main function. Since kthread_exit() wakeup(9)s everyone sleeping on the thread handle, drop the superfluous wakeup() call. Notes: svn path=/head/; revision=135765
* Lock the flags field with the mutex.Poul-Henning Kamp2004-09-241-8/+25
| | | | | | | Improve a number of comments. Notes: svn path=/head/; revision=135736
* Implement terminating the worker thread when the driver is about toJoerg Wunsch2004-09-232-3/+23
| | | | | | | | | | be deregistered. Not yet tested, since by now, GEOM doesn't want us to deregister. PHK wants to fix that RSN. Notes: svn path=/head/; revision=135638
* das@ has a ACPI bios that lists 0x3f0-0x3f1, 0x3f2-0x3f3, 0x3f4-0x3f5Warner Losh2004-09-201-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | and 0x3f7. fdc_isa_alloc_resource() didn't work right in this case (it accessed FDOUT correctly due to an overflow of the first resource. It accesed FDSTS and FDDATA incorrectly via the second resource (which wound up accessing FDOUT and the tape register at 0x3f3) and badly for the CTL register (at location 0x3f4). This is a minimal fix that just 'eats' the first one if it covers two locations and has an offset of 0. This confusion lead the floppy driver to think there'd been a disk change, which uncovered a deadlock in the floppy/geom code which lead to a panic. These changes fix that by fixing the underlying resource problem, but doesn't address the potential deadlock issue that might still be there. This is a minimal fix so it can more safely be merged into 5 w/o risk for known working configurations (hence the use of the ugly goto, which reduces case 8 to case 6 w/o affecting cases 1-7). A more invasive fix that will handle more ACPI resource list diversity is in the pipeline that should kill these issues once and for all, while staying within the resources that we allocate. Tested/Reported by: das Reviewed by: njl MFC before: re->next_release_name(5.3-BETA5); Notes: svn path=/head/; revision=135504
* The long dead hand of the past has pushed forward useless bits in thisWarner Losh2004-09-174-28/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | driver. Trim its fingernails by removing some useless bits before fixing the 'thread not terminated on detach' problem. o dmacnt is no longer used now that we allocate at attach time. Remove it from struct fdc_data. o ISPNP was only ever set, but never tested. It used to be used for the allocation routines to change how it allocated resources. Since that's no longer necessary, retire the flag. o ISPCMICA was only ever tested, but never set. GC it. This removes a special case in determining the drive type. The drive type is now set in fdc_pcmcia.c, so the hack isn't needed anymore. Sadly, this isn't tested with a Y-E Data pcmcia floppy drive because there are a number of other issues that preclude it from working. o Fix ifdef for reading from the rtc. I'm of the opinion that this ifdef should be moved into fdc_isa.c, but not today as ideally there'd be other fixes to the probing of children. So now we just read it on i386 ! pc98 (there's no #define for MACHINE_ARCH, just MACHINE, hence this slightly inelegant kludge) and amd64. The PC98 exclusion likely isn't meaningful since pc98 uses a different driver, but will be when merging of the pc98 floppy code into this driver is complete (this is the other reason I think this block of code belongs outside fdc.c). All of these changes are safe to MT5. Notes: svn path=/head/; revision=135392
* Handle _FDE results of 5 bytes (vs. 5 uint32_t's). BIOS vendors find yetNate Lawson2004-09-171-37/+54
| | | | | | | | | | | | | another way to misinterpret the spec. Also, always fall back to the hints probe on any attach failure, not just when _FDE fails. Thanks to imp and scottl for finding this. Tested by: rwatson (minimally) MFC after: 5 days Notes: svn path=/head/; revision=135355
* default: case shouldn't set an error yet either.Warner Losh2004-09-161-1/+0
| | | | Notes: svn path=/head/; revision=135294
* Reserve the DMA memory at attach time, rather than at use. WhileWarner Losh2004-09-161-15/+12
| | | | | | | | | | | | reserving it at use time is more miserly, low memory (< 16MB) evaporates quickly on many systems, so there may not be any suitable buffers available. This specifically doesn't use the newer, fancier isa_dma_init to ease merging to 5. Reviewed by: tegge, phk Notes: svn path=/head/; revision=135293
* 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-1883/+1357
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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