Commit Graph

294 Commits

Author SHA1 Message Date
nyan
2527e98255 Correct typo. 2004-07-17 10:05:56 +00:00
nyan
36da044b35 Remove duplicate include. 2004-07-17 10:05:32 +00:00
imp
77a331dc4e Be consistant with probe 2004-07-16 23:07:38 +00:00
njl
db94b43487 Clean up resources properly if attach fails. Always reset ISA drives on
probe.
2004-07-15 16:41:07 +00:00
njl
c36db208d3 Re-work for fdc_acpi. Expose fdc_add_child() and move the static
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.
2004-07-15 16:39:40 +00:00
njl
b29a887bf7 Add an ACPI floppy drive attachment that probes via the _FDE and _FDI
methods.  It also now handles ordinary floppy drive probing for drives
attached to ACPI.

Reviewed by:	imp
2004-07-15 16:38:07 +00:00
njl
ea079c2c7b Add a comment separator. 2004-07-14 22:09:32 +00:00
imp
a352301884 Remove fdc_alloc_resources, which should have happened in last commit. 2004-07-14 07:04:17 +00:00
imp
29fd908e9d Fix the pccard attachment to have a chance of working.
Move the resource allocation into the bus front ends.
2004-07-14 06:59:58 +00:00
imp
d35148311b Set fdc_dev in attach 2004-07-13 02:44:40 +00:00
imp
02b4d8a438 Don't depend on implicit include of machine/bus.h in sys/rman.h, but instead
explicitly include it.
2004-07-13 02:42:23 +00:00
njl
7c75fe7d97 Remove unnecessary softc bzero calls. 2004-07-12 21:15:36 +00:00
njl
7b5fb1c0fe Update in preparation for adding the ACPI attachment.
* 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.
2004-07-12 20:49:26 +00:00
imp
a6214e1123 Until I'm ready to commit the better pccard probe/attach routines, effectively
comment them out.
2004-07-11 16:01:25 +00:00
imp
78dfca3951 Break out the isa and pccard front ends from fdc. This is the first
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.
2004-07-07 22:35:27 +00:00
phk
fe7583f88c Allocate the DMA channel shareable and only aquire it while the
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.
2004-07-05 20:56:06 +00:00
phk
d0b755c141 Mark our interrupt shareable and don't insist on DMA. This gets us closer
to working with a secondary floppy controller on a PC.
2004-07-04 23:16:04 +00:00
phk
dfd1f7fd50 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
imp
868f939e2e Use rman_get_start in preference to reaching into the rman structure. 2004-05-27 22:43:10 +00:00
imp
bce3d87f9e Update to reflect new location in the tree. This has been repo copied
from sys/isa/fd.c in preparation for specialization of attachments for
different busses.
2004-05-17 05:42:04 +00:00
bde
6001f5dc12 Fixed breakage of the formatting operation in rev.1.266. The wrong
clause of an if-else statement was removed.

Reviewed by:	no response from maintainer in 12 days
2004-04-25 04:33:56 +00:00
imp
b49b7fe799 Remove advertising clause from University of California Regent's
license, per letter dated July 22, 1999 and email from Peter Wemm,
Alan Cox and Robert Watson.

Approved by: core, peter, alc, rwatson
2004-04-07 20:46:16 +00:00
njl
05a1f56fc9 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
phk
355cdf2848 Remove unused FDNUMTOUNIT() macro 2004-02-29 10:21:40 +00:00
phk
1ca01a5f39 Make mode setting with fdcontrol(8) stick.
Recognize when configured for "auto".
2004-02-25 13:44:58 +00:00
phk
ad925439e0 Device megapatch 4/6:
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.
2004-02-21 21:10:55 +00:00
phk
df397dedea Device megapatch 1/6:
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.
2004-02-21 19:42:58 +00:00
njl
d3d2282375 Workaround some ACPI BIOSen which break the IO port into multiple
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
2004-02-15 20:30:22 +00:00
peter
951b71c1b7 Look at the equipment list for amd64 as well as i386 for autodetecting
floppy drives in the absence of hints.
2003-10-23 05:52:52 +00:00
phk
5a1c5c9c13 Eliminate use bio_blkno. 2003-10-18 17:51:26 +00:00
phk
ab6ce03a9b Pick up softc from dev_t rathern than through newbus gymnastics. 2003-09-17 07:40:00 +00:00
phk
b6b3a2e051 Since it is static these days, there is no reason to uppercase the
first letter of fdopen() to avoid nameclashing with other stuff.
2003-09-17 07:21:20 +00:00
phk
1ea5197e3f Disable the use of cloning use in floppy and CD drivers.
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
2003-09-11 19:27:24 +00:00
phk
c5dc1fb629 Put the device cloning functions for disk-drivers under #ifndef BURN_BRIDGES.
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.
2003-09-05 10:40:16 +00:00
jhb
17958a749f - Use the new resource_disabled() helper function to see if devices are
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.
2003-07-02 16:09:02 +00:00
yar
2efdcd558c Force media autodetection if the device has lost its parameter table.
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.
2003-06-16 08:42:20 +00:00
yar
6bc6b7ee8b If in non-blocking mode, return EAGAIN instead of ENXIO
on an I/O attempt.  This is needed for consistency with
the concept of the half-opened state of fdc(4).

PR:		kern/52338
2003-06-16 07:50:17 +00:00
yar
180cfbc14f Always set bio_resid properly in fdstrategy(),
as should every block device strategy routine.
There was at least one evil consequence of not doing so:
Some errors returned by fdstrategy() could be lost (EAGAIN,
in particular.)

PR:		kern/52338 (in the audit-trail)
Discussed with:	bde
2003-06-15 18:13:17 +00:00
yar
66f662a622 Check whether the floppy type pointer has been set before trying
to access floppy parameters through it.

Note: The DIOCGSECTORSIZE and DIOCGMEDIASIZE handlers withing
fdioctl() couldn't be just moved to below the existing check
for blocking mode because fd->ft can be non-NULL while still
in non-blocking mode (fd->ft can be set with the FD_STYPE ioctl.)

PR:		kern/52338
No MFC:		Not applicable to STABLE
2003-06-15 16:18:58 +00:00
obrien
a63f21d732 Use __FBSDID(). 2003-06-11 00:34:37 +00:00
phk
ed8b540a0c Remove unused variable.
Found by:       FlexeLint
2003-05-31 18:45:32 +00:00
phk
c235e25328 Use bioq_flush() to drain a bio queue with a specific error code.
Retain the mistake of not updating the devstat API for now.

Spell bioq_disksort() consistently with the remaining bioq_*().

#include <geom/geom_disk.h> where this is more appropriate.
2003-04-01 15:06:26 +00:00
phk
4509129869 Fix a malloc() with no legal modeflag. 2003-03-17 07:26:25 +00:00
phk
d41f2cb2dc Call devstat_start_transaction_bio() instead of devstat_start_transaction() 2003-03-15 10:50:44 +00:00
phk
2dfffca0ff Allocate the devstat structure with devstat_new_entry(). 2003-03-08 21:32:59 +00:00
phk
0ae911eb0e Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
joerg
fc7b77b485 Bail out of fd_clone() if the parsed unit number doesn't match our
expectation.

This solves the problem, where in a constellation with two (or more)
drives, an attempt is made to access a device name for that device
using a historic partition letter, like /dev/fd1c.  This is supposed
to create a symlink to the master device, but previously, the link was
always created to /dev/fd0, even if the request was for fd1*.
2003-01-11 20:10:41 +00:00
phk
75fab78fe6 Remove calls to cdevsw_add(), they are dreprecated on this branch now. 2002-12-28 21:39:04 +00:00
mux
873c175b8f Capitalize the first letter of device descriptions
for consistency with the rest of the drivers.
2002-11-11 15:26:08 +00:00
phk
f4c70e659f Fix a probably rare and inconsequential memory leak.
Spotted by:	FlexeLint
2002-10-02 20:29:54 +00:00