Commit Graph

333 Commits

Author SHA1 Message Date
Poul-Henning Kamp
3abefc9e56 Remove confused comment. 2004-08-14 21:40:28 +00:00
Yoshihiro Takahashi
5ceae6b826 Correct typo. 2004-07-17 10:05:56 +00:00
Nate Lawson
a6e4d8c453 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
Warner Losh
16629bd982 Remove fdc_alloc_resources, which should have happened in last commit. 2004-07-14 07:04:17 +00:00
Warner Losh
b0c2b92548 Set fdc_dev in attach 2004-07-13 02:44:40 +00:00
Warner Losh
c3ae4c40ef 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
Nate Lawson
752d473505 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
Warner Losh
6d6fa4fdc9 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
Poul-Henning Kamp
de0b7a6307 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
Poul-Henning Kamp
6fba12f206 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
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Warner Losh
bc8d2181b3 Use rman_get_start in preference to reaching into the rman structure. 2004-05-27 22:43:10 +00:00
Warner Losh
734e3cc5fd 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
Bruce Evans
a3a10d1c3c 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
Warner Losh
f36cfd49ad 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
Nate Lawson
5f96beb9e0 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
Poul-Henning Kamp
db42ff97da Remove unused FDNUMTOUNIT() macro 2004-02-29 10:21:40 +00:00
Poul-Henning Kamp
503799ea5c Make mode setting with fdcontrol(8) stick.
Recognize when configured for "auto".
2004-02-25 13:44:58 +00:00
Poul-Henning Kamp
dc08ffec87 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
Poul-Henning Kamp
c9c7976f7f 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
Nate Lawson
64746d0689 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 Wemm
042093540c 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
Poul-Henning Kamp
b52b7f465d Eliminate use bio_blkno. 2003-10-18 17:51:26 +00:00
Poul-Henning Kamp
a2f19df9cc Pick up softc from dev_t rathern than through newbus gymnastics. 2003-09-17 07:40:00 +00:00
Poul-Henning Kamp
f967c4f96e 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
Poul-Henning Kamp
0c7721e8f9 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
Poul-Henning Kamp
7837155fa2 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
John Baldwin
8a9bc9c03b - 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
Yaroslav Tykhiy
62cc1e0584 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
Yaroslav Tykhiy
f79981aca8 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
Yaroslav Tykhiy
83efe35a66 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
Yaroslav Tykhiy
29ec21d1e3 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
David E. O'Brien
8c9bbf484a Use __FBSDID(). 2003-06-11 00:34:37 +00:00
Poul-Henning Kamp
c7b24d7dcd Remove unused variable.
Found by:       FlexeLint
2003-05-31 18:45:32 +00:00
Poul-Henning Kamp
891619a66d 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
Poul-Henning Kamp
8595de4aec Fix a malloc() with no legal modeflag. 2003-03-17 07:26:25 +00:00
Poul-Henning Kamp
1ecc485c1b Call devstat_start_transaction_bio() instead of devstat_start_transaction() 2003-03-15 10:50:44 +00:00
Poul-Henning Kamp
8098046099 Allocate the devstat structure with devstat_new_entry(). 2003-03-08 21:32:59 +00:00
Poul-Henning Kamp
7ac40f5f59 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 Wunsch
294d88444b 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
Poul-Henning Kamp
2b64426519 Remove calls to cdevsw_add(), they are dreprecated on this branch now. 2002-12-28 21:39:04 +00:00
Maxime Henrion
2ac8c61ac4 Capitalize the first letter of device descriptions
for consistency with the rest of the drivers.
2002-11-11 15:26:08 +00:00
Poul-Henning Kamp
42117b6c4d Fix a probably rare and inconsequential memory leak.
Spotted by:	FlexeLint
2002-10-02 20:29:54 +00:00
Poul-Henning Kamp
c91a63aa2c Add support for DIOCGMEDIASIZE and DIOCGSECTORSIZE.
Remove all traces of disklabel.

Sponsored by:	DARPA & NAI Labs.
2002-09-30 13:53:22 +00:00
Poul-Henning Kamp
419f39ce0f Prefix private BIO commands with "FD" so people get a hint that they
are in fact private.

Sponsored by:	DARPA & NAI Labs.
2002-09-30 13:42:06 +00:00
Poul-Henning Kamp
37c841831f Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512
2002-09-28 17:15:38 +00:00
Poul-Henning Kamp
f90c382c0c Make FreeBSD "struct disklabel" agnostic, step 311 of 723:
Rename diskerr() to disk_err() for naming consistency.

Drop the by now entirely useless struct disklabel argument.

Add a flag argument for new-line termination.

Fix a couple of printf-format-casts to %j instead of %l.

Correctly print the name of all bio commands.

Move the function from subr_disklabel.c to subr_disk.c,
and from <sys/disklabel.h> to <sys/disk.h>.

Use the new disk_err() throughout, #include <sys/disk.h> as needed.

Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs.

Remove unused disklabel members of softc for aac, amr and mlx, which seem
to originally have been intended for diskerr() use, but which only rotted
and got Copy&Pasted at least two times to many.

Sponsored by:   DARPA & NAI Labs.
2002-09-20 12:52:03 +00:00
Poul-Henning Kamp
c3bdb2f779 Suitably shrink a comment so it applies again.
Submitted by:	bde
2002-09-15 21:25:55 +00:00
Poul-Henning Kamp
02aad38c79 Fix a bug were a struct bio was freed and certain members subsequently
examined.  Use biowait() instead of DIY.
2002-09-13 11:37:38 +00:00
Joerg Wunsch
9a5e3ddb2d Pass the physical instead of the logical block number in
bp->bio_pblkno.  Otherwise, all formats not using 512 byte
physical sectors got screwed.
2002-09-12 20:53:50 +00:00
Joerg Wunsch
a2642c4d67 After some comments from bde, rewrite the loops to avoid turning the
previously used "micro-optimization" (count-down loop) into a
pessimization.  Now the loops are written in the more natural count-up
form.

Also, while being there, i made the logic in out_fdc() similar to the
logic in in_fdc().  The old implementation was a bit bogus anyway
since it first tested the DIO bit and only afterwards the RQM bit.
However, according to the description of the i82077, the DIO bit is
only guaranteed to be valid once the RQM bit is set.  Thus, the old
implementatoin would have had the chance to misbehave on a controller
that is implemented in accordance with the i82077 description (but is
not bug-for-bug compatible).

MFC after:	3 days
2002-05-14 21:28:45 +00:00
Joerg Wunsch
8a0ba81859 style(9) changes before further editing that region:
. add unnecessary parenthesis around return values
. put body of an "if" statement onto a line of its own
2002-05-13 10:28:20 +00:00
Joerg Wunsch
5613959d84 Hide the fd autoselection messages behind the bootverbose case so they
stop bothering people on their consoles.
2002-05-12 17:17:46 +00:00
Joerg Wunsch
cb38bb6c36 Increase the PIO timeout to approximately the value it used to have
before rev 1.229 (~ 100 ms).  According to bde, some (old) broken
hardware could require it.  In order to make timing more accurate than
what could be achieved with a loop around DELAY(1), increase loop
timing after the initial ~ 1 ms.

Also, move the declaration of FDSTS_TIMEOUT out from fdreg.h into fd.c
where it actually belongs to.

MFC after:	2 days
2002-05-12 15:24:21 +00:00
Joerg Wunsch
d0900d6bc0 Change the PIO loops from a hard counter into a loop that calls DELAY()
in each cycle, with a tunable max cycle count defined in fdreg.h.

This is said to fix the problem on some Compaq hardware (and perhaps
on other machines using the Natsemi PC87317 chip) where the fdc(4)
driver failed to operate at all.

PR:		kern/21397
Submitted by:	Jung-uk Kim <jkim@niksun.com>
MFC after:	3 days
2002-05-10 17:56:39 +00:00
Joerg Wunsch
84954bb898 When reading a UFS-style label from a floppy, don't attempt to use a
"raw partition" of any kind since the floppy driver doesn't support
UFS-style partitions at all.

Reported by:	"Crist J. Clark" <crist.clark@attbi.com>
Reviewed by:	bde
MFC after:	3 days
2002-04-02 18:29:43 +00:00
John Baldwin
44731cab3b Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API.  The entire API now consists of two functions
similar to the pre-KSE API.  The suser() function takes a thread pointer
as its only argument.  The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0.  The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on:	smp@
2002-04-01 21:31:13 +00:00
Poul-Henning Kamp
d306122d60 Push BIO_FORMAT into a local hack inside the floppy drivers where
it belongs.
2002-03-26 19:16:37 +00:00
Poul-Henning Kamp
817988be19 Disksort will not "munge" requests, BIO_ORDERED or not, so remove
use of BIO_ORDERED.
2002-02-22 09:14:06 +00:00
Joerg Wunsch
038d1bbd1a Change the test for _MACHINE_ARCH == i386 into #ifdef __i386__ since it
otherwise breaks on the Alpha arch.  I think this is wrong since i'd
actually like to probe for a PC architecture, not for a particular CPU
type.  Anyway, now it's again the way it used to be.
2001-12-18 22:16:33 +00:00
Yoshihiro Takahashi
5229d0a11d Remove PC98 code. This file is not used by PC98. 2001-12-16 05:37:22 +00:00
Joerg Wunsch
1a6bed6863 Long promised major enhancement set for the floppy disk driver:
. The main device node now supports automatic density selection for
  commonly used media densities.  So you can stuff your 1.44 MB and
  720 KB media into your drive and just access /dev/fd0, no questions
  asked.  It's all that easy, isn't it? :)

. Device density handling has been completely overhauled.  The old way
  of hardwired kernel density knowledge is no longer there.  Instead,
  the kernel now implements 16 subdevices per drive.  The first
  subdevice uses automatic density selection, while the remaining 15
  devices are freely programmable.  They can be assigned an arbitrary
  name of the form /dev/fd[:digit]+.[:digit:]{1,4}, where the second
  number is meant to either implement device names that are mnemonic
  for their raw capacity (as it used to be), or they can alternatively
  be created as "anonymous" devices like fd0.1 through fd0.15,
  depending on the taste of the administrator.  After creating a
  subdevice, it is initialized to the maximal native density of the
  respective drive type, so it needs to be customized for other
  densities by using fdcontrol(8).  Pseudo-partition devices (fd0a
  through fd0h) are still supported as symlinks.

. The old hack to use flags 0x1 to always assume drive 0 were there is
  no longer supported; this is now supposed to be done by wiring the
  devices down from the loader via device flags.  On IA32
  architectures, the first two drives are looked up in the CMOS
  configuration records though.  On PCMCIA (i. e., the Y-E Data
  controller of the Toshiba Libretto), a single drive is always
  assumed.

. Other specialities like disabling the FIFO and not probing the drive
  at boot-time are selected by per-controller or per-drive flags, too.

. Unit attentions (media has been changed) are supposed to be detected
  now; density autoselection only occurs after a unit attention.  (Can
  be turned off by a per-drive flag, this will cause each Fdopen() to
  perform the autoselection.)

. FM floppies can be handled now (on controllers that actually support
  it -- not all do these days).

. Fdopen() can be told to avoid density selection by setting
  O_NONBLOCK; this leaves the descriptor in a half-opened state where
  only a few ioctls are accepted.  This is necessary to run fdformat
  on a device that uses automatic density selection (since you cannot
  autoselect on an unformatted medium, obviously).

. Just differentiate between a plain old NE765 and the enhanced chips,
  but don't try more; the existing code was wrong and only misdetected
  the chips anyway.

BUGS and TODOs:

. All documentation update still needs to be done.

. Formatting not-so-standard format yields unpredictable results; i
  have yet to figure out why this happens.  "Standard" formats like
  720 and 1440 KB do work, however.

. rc scripts are needed to setup device nodes with nonstandard
  densities (like the old /dev/fdN.MMM we used to have).

. Obtaining device flags from the kernel environment doesn't work yet,
  thus currently only drives that are present in (IA32) CMOS are
  really detected.  Someone who knows the odds and ends about device
  flags is needed here, i can't figure out what i'm doing wrong.

. 2.88 MB still needs to be done.
2001-12-15 19:09:04 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Mike Smith
5f063c7b09 Add ACPI attachments. 2001-08-30 09:17:03 +00:00
Joerg Wunsch
3a5c2c86a8 Hrmpf. nyan's rev 1.25 commit to fdc.h crossed with my removal of it.
Back-integrate his (PC98) changes into fd.c.
2001-07-14 20:28:02 +00:00
Joerg Wunsch
246ed35d55 Yet another large non-function change.
. Integrate fdc.h into fd.c, with the removal of ft(4) there's no longer
  a reason to scatter things across two files.

. Sanitize comments.  Convert them into the style(9)-recommended
  multi-line form, make them sentences where apprpriate, etc.

. Declare all functions on top, and declare them in the order they
  appear in the file.  This order is totally chaotic, but Bruce
  convinced me that reordering the file wouldn't make it better either.

. Kill a `possibly uninitialized' warning (only seen with -O2) in
  fd_read_status().

. Make the comments at return (0|1) statements in fdstate() consistent.

. Nuke a ``keep the compiler happy'' dummy return at the end of fdstate(),
  gcc is smart enough to detect that it would never be reached anyway.
2001-07-14 20:25:01 +00:00
Joerg Wunsch
0e17a5bcdb Log when the user is turning debugging on/off.
Also sanitize the TRACE* macros a bit so they syntactically behave like
single C statements (even inside in `if' statement).

Submitted by:	des
2001-07-09 21:11:10 +00:00
Joerg Wunsch
5d54fe9172 Hmpf, remove two variables that got unused by rev 1.214. 2001-07-09 21:00:02 +00:00
Joerg Wunsch
83edbfa5ff Ouch, calculate correctly. With 300 rpm and 25 retries, it's 5 seconds
till timeout.
2001-07-09 20:53:19 +00:00
Joerg Wunsch
e3b525a006 Remove parts of rev 1.211 again: do not delete our children iff they
haven't been probed successfully.  It's a known bug that ISA hints
processing instantiates those devices, and prematurely killing them
has other unwanted side-effects.
2001-07-09 20:50:41 +00:00
Joerg Wunsch
3fef646ef0 As des' example shows us, DMA overruns could happen in a situation
where they will never succeed.  Add a stop-gap measure that will at
least eventually timeout the operation instead of retrying it
indefinately.

MFC after:	1 month
2001-07-09 20:46:45 +00:00
Joerg Wunsch
fb35bd37f2 Another large patchset from Bruce.
Despite of a few cosmetic things like adding ``irritating silly
parentheses'' around all return values, this mainly improves FDC reset
handling by no longer gratuitously resetting the FDC all the time
(which causes it to lose the notion of the current track) but only in
case of errors, and it sanitizes the block and offset calculations in
fdstrategy() and fdstate().  Some additional cleanup added by me, in
particular the large switch in fdstate() now always uses return to
break out, and no branch falls off the end of the switch statement
anymore.  Per Bruce's suggestion, removed M_NOWAIT from the malloc()s
to simplify things.

Submitted by:	bde (mostly)
2001-07-08 20:50:20 +00:00
Joerg Wunsch
6044485346 More cleanup when detaching. Clone device entries will now be
destroyed properly (otherwise bad things would happen after a clone
dev had been created, and the module was kldunloaded).  Allocated
children that have not successfully probed are being deleted again
(otherwise fd0 and fd1 have always been allocated, even if only
fd0 was acutally present, and fd1 even survived kldunloading the
module).

Still, kldunloading leaves remnants of the previously existing devices
intact.  Why doesn't it destroy all the devices?  As a consequence,
since dev->descr now points into no longer allocated memory, the
system panics deep inside printf(9) when running devinfo(1) after
kldunloading the module.  Ideas sought...

Also, when kldloading the module on a hints-populated isab0, this bus
somehow has already created an fdc0 entry (a dummy) so the load
attempt fails and will register fdc1 instead.  What are those dummy
entries for?  Loading the module from the bootloader works, and it
can be unloaded an re-loaded then later.
2001-07-04 22:10:33 +00:00
Joerg Wunsch
f664aeee49 Use the new-born BIO_CMD1 instead of fudging a bio_flag value for reading
the sector ID.

Based on numerous comments made by Bruce, rewrite a good part of the
old fdformat() function, and merge it with fdreadid() into a single
unified fdmisccmd() function.  Various style and a couple of more
serious bugs fixed there.

While i was at it, i also fixed the long-standing "TODO: don't
allocate buffer on stack." in fdcioctl(), fixed a number of style bugs
there, and finally implemented the FD_DEBUG ioctl command that has
been advertised in <sys/fdcio.h> (formerly <machine/ioctl_fd.h>) for
almost seven years now. ;-)

Submitted by:	bde (a lot of fixes for fdformat())
2001-06-29 15:30:48 +00:00
Joerg Wunsch
5f431174f3 This change slipped through hidden in a CVS conflict. Logically belongs
to the previous commit (fix resource deallocation).
2001-06-29 07:53:45 +00:00
Joerg Wunsch
e219897a2a First stab at fixing resource deallocation, and implementing fdc(4) as
a KLD.  Still doesn't work well except in the PCMCIA case (now if only
pccardd(8) could load and unload drivers dynamically...).  Mainly, it
tries to find fdc0 on the PCI bus for whatever obscure reasons, but i
need someone who understands driver(9) to fix this.  However, it's at least
already better than before, and i'm tired of maintaining too many private
changes in my tree, given the large patches bde submitted. :)

Idea of a KLD triggered by:	Michael Reifenberger <root@nihil.plaut.de>
2001-06-29 07:36:29 +00:00
Joerg Wunsch
64860614a4 Merge in parts of a larger patchset i received from Bruce. Untested
by now (except of a compile test), but i believe this to contain no
actual functional changes.

. Fix the copyright of the Regents i accidentally broke in rev 1.197
  (although only a very small part of the original driver survived
  at all...).

. Bump MAX_CYLINDER since some obscure formats really use more than 80
  cylinders.

. Correctly handle BIO_FORMAT which used to be a bitmask but is now a BIO
  command of its own.

. Numerous stylistic fixes.

Submitted by:	bde
2001-06-28 12:35:28 +00:00
Joerg Wunsch
250300ebb0 Implement a new ioctl command for floppies: FD_READID
Reads one sector ID field from a given track.  Useful for analyzing
floppies.
2001-06-26 22:16:30 +00:00
Joerg Wunsch
4c34deeecf Some more cosmetics: kill another couple of K&R function definitions
that survived from old days, fix style of return type in fdcpio(),
kill old Emacs hints that are no longer working that way anyway.
2001-06-26 22:07:25 +00:00
Joerg Wunsch
80909a7db8 Cosmetics:
. staticize out_fdc(), there's no longer an ft(4) driver sharing its use
. remove in_fdc(), has been used by ft(4) last time, long since obsoleted
  by fd_in()
. move the declaration of fd_clone() to where most of the other function
  declarations are
. de-__P()ify fd_clone(), it's been the only _P()ed function in the
  entire file
2001-06-20 20:21:55 +00:00
Peter Wemm
2398f0cd1d Hints overhaul:
- Replace some very poorly thought out API hacks that should have been
  fixed a long while ago.
- Provide some much more flexible search functions (resource_find_*())
- Use strings for storage instead of an outgrowth of the rather
  inconvenient temporary ioconf table from config().  We already had a
  fallback to using strings before malloc/vm was running anyway.
2001-06-12 09:40:04 +00:00
Joerg Wunsch
f8ce7dd521 Cosmetics:
. remove stale comments and a stale #define (from the old days of ft(4))
. make MAX_SEC_SIZE (used in isa_dmainit()) a #define

. fix a typo in a string
. use 0 as the blocksize in devstat_add_entry(), since the actual blocksize
  is unknown (devstat(9) suggests to use 0 in that case)
2001-06-11 10:48:10 +00:00
Joerg Wunsch
e774b25111 Nuke the various poorly maintained copies of ioctl_fd.h. The file is
not machine-dependant, thus it has been moved out (repo-copied) into
<sys/fdcio.h>.
2001-06-06 06:15:03 +00:00
Joerg Wunsch
7998b1245d Make the FDC (state machine) state an enum, as opposed to an int
abusing a bunch of #defines, for clarity and better debugging support.
2001-06-05 21:01:46 +00:00
Joerg Wunsch
06740f7b41 Fix my email address. I accidentally cut'npasted the wrong (old)
hostname laste time.
2001-06-03 20:41:21 +00:00
Poul-Henning Kamp
48c35f87be Don't lie to diskerr() now that it listens to us. 2001-05-25 09:07:23 +00:00
Joerg Wunsch
2995d1100c Implement a few more floppy ioctl commands and IO options, namely:
. FD_CLRERR clears the error counter, thus re-enables kernel error
  printf()s,

. FD_GSTAT obtains the last FDC operation state, if any,

. FDOPT_NOERRLOG (temporarily) turns off kernel printf() floppy
  error logging,

. FDOPT_NOERROR makes the kernel ignore an FDC error, thus can
  enable the transfer of an erroneous sector to the user application

All options are being cleared on (last) close.

Prime consumer of the last features will be fdread(1), to be committed
shortly.

(FD_CLRERR should be wired into fdcontrol(8), but then fdcontrol(8)
needs a major rewrite anyway.)
2001-05-14 20:20:11 +00:00
Poul-Henning Kamp
a468031ce8 Actually biofinish(struct bio *, struct devstat *, int error) is more general
than the bioerror().

Most of this patch is generated by scripts.
2001-05-06 20:00:03 +00:00
Mark Murray
fb919e4d5a Undo part of the tangle of having sys/lock.h and sys/mutex.h included in
other "system" header files.

Also help the deprecation of lockmgr.h by making it a sub-include of
sys/lock.h and removing sys/lockmgr.h form kernel .c files.

Sort sys/*.h includes where possible in affected files.

OK'ed by:	bde (with reservations)
2001-05-01 08:13:21 +00:00
Poul-Henning Kamp
f83880518b Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.
2001-03-26 12:41:29 +00:00
Mark Murray
3c36743e2d Harvest interrupt entropy off the floppy disk controller. 2001-03-03 14:53:50 +00:00
David Malone
7cc0979fd6 Convert more malloc+bzero to malloc+M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
2000-12-08 21:51:06 +00:00
Poul-Henning Kamp
cb7e609a3c Make diskerr() always log with printf. 2000-11-26 19:29:15 +00:00
Peter Wemm
ada54f9e54 Untangle some resource matching loops that were getting on my nerves
and seemed to be getting cut/pasted to places they shouldn't be.
2000-10-15 08:50:45 +00:00
Poul-Henning Kamp
db90128160 Avoid the modules madness I inadvertently introduced by making the
cloning infrastructure standard in kern_conf.  Modules are now
the same with or without devfs support.

If you need to detect if devfs is present, in modules or elsewhere,
check the integer variable "devfs_present".

This happily removes an ugly hack from kern/vfs_conf.c.

This forces a rename of the eventhandler and the standard clone
helper function.

Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include
like <sys/queue.h>

Remove all #includes of opt_devfs.h they no longer matter.
2000-09-02 19:17:34 +00:00
Poul-Henning Kamp
3f54a085a6 Remove all traces of Julians DEVFS (incl from kern/subr_diskslice.c)
Remove old DEVFS support fields from dev_t.

  Make uid, gid & mode members of dev_t and set them in make_dev().

  Use correct uid, gid & mode in make_dev in disk minilayer.

  Add support for registering alias names for a dev_t using the
  new function make_dev_alias().  These will show up as symlinks
  in DEVFS.

  Use makedev() rather than make_dev() for MFSs magic devices to prevent
  DEVFS from noticing this abuse.

  Add a field for DEVFS inode number in dev_t.

  Add new DEVFS in fs/devfs.

  Add devfs cloning to:
        disk minilayer (ie: ad(4), sd(4), cd(4) etc etc)
        md(4), tun(4), bpf(4), fd(4)

  If DEVFS add -d flag to /sbin/inits args to make it mount devfs.

  Add commented out DEVFS to GENERIC
2000-08-20 21:34:39 +00:00
Nick Hibma
02211bae3b Avoid a '"fd" is usurping ...' message.
PR:		20348
Submitted by:	Andre Albsmeier <andre.albsmeier@mchp.siemens.de>
2000-08-09 12:45:04 +00:00
Peter Wemm
58c9d62373 Fix a warning re: a potentially unused pccard helper function 2000-07-28 23:00:00 +00:00
Poul-Henning Kamp
1fdb6e6c69 Step down a level and issue format requests with a struct bio instead
of a struct buf.
2000-05-06 07:01:47 +00:00
Poul-Henning Kamp
9626b608de Separate the struct bio related stuff out of <sys/buf.h> into
<sys/bio.h>.

<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.

Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.

Still a few bogus uses of struct buf to track down.

Repocopy by:    peter
2000-05-05 09:59:14 +00:00