History log of /freebsd-current/sys/dev/fdc/fdc_acpi.c
Revision Date Author Comments
# fdafd315 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 7c146c0c 06-May-2022 John Baldwin <jhb@FreeBSD.org>

fd/fdc: Remove unused devclass arguments to DRIVER_MODULE.


# 5efca36f 25-Oct-2018 Takanori Watanabe <takawata@FreeBSD.org>

Distinguish _CID match and _HID match and make lower priority probe
when _CID match.

Reviewed by: jhb, imp
Differential Revision:https://reviews.freebsd.org/D16468


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# e45163b2 04-May-2016 John Baldwin <jhb@FreeBSD.org>

Fix the acpi attachment to always start the worker thread.

The previous change to split the worker thread start out of fdc_attach()
did not start the worker thread if the fdc device in the ACPI namespace
did not have an _FDE method. This fixes hangs when booting with a
floppy controller enabled on certain machines with ACPI.

Tested by: joel


# fed2c48a 21-Apr-2016 John Baldwin <jhb@FreeBSD.org>

Adjust the fdc worker thread startup to work when APs are started earlier.

- Enable the commented out locking in fd_probe(). The worker thread
should not be running yet (even after these changes), but better to be
safe than sorry.
- Defer starting the worker thread until after the child drives have been
probed. The worker thread startup is moved into a fdc_start_worker()
thread that the various front ends call at the end of attach. As a
side effect this fixes a few edge cases that weren't shutting down the
worker thread if attach encountered a late failure.
- When executing the initial reset requested by attach in the worker
thread, use DELAY() instead of a tsleep() if cold is set.

Tested by: Howard Su <howard0su@gmail.com>
Sponsored by: Netflix


# 61bfd867 30-Jan-2013 Sofian Brabez <sbz@FreeBSD.org>

Use DEVMETHOD_END macro defined in sys/bus.h instead of {0, 0} sentinel on device_method_t arrays

Reviewed by: cognet
Approved by: cognet


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 32aa4ac7 02-Jun-2010 Jung-uk Kim <jkim@FreeBSD.org>

MFC: r208650

Fix a regression from r203544 (MFC of r200554), which broke fdc(4)
attachment to acpi(4).

Approved by: re (kib)


# 4affd626 29-May-2010 Jung-uk Kim <jkim@FreeBSD.org>

Fix a regression from r200554, which broke fdc(4) attachment to acpi(4).
I removed too many lines and a wrong pointer was accidentally passed down.

Tested by: Scott Allendorf (scott-allendorf at uiowa dot edu), kib
MFC after: 3 days


# e21bbd17 05-Feb-2010 Andriy Gapon <avg@FreeBSD.org>

MFC r197104,197105,197106,197107,197688,198237,199337,199338,200553,200554,
202771,202773: bring acpica version to 20100121

MFC details:
r197104 | jkim | 2009-09-12 01:48:53 +0300 (Sat, 12 Sep 2009) | 4 lines
MFV: r196804
Import ACPICA 20090903

r197105 | jkim | 2009-09-12 01:49:34 +0300 (Sat, 12 Sep 2009) | 2 lines
Catch up with ACPICA 20090903.

r197106 | jkim | 2009-09-12 01:50:15 +0300 (Sat, 12 Sep 2009) | 2 lines
Catch up with ACPICA 20090903.

r197107 | jkim | 2009-09-12 01:56:08 +0300 (Sat, 12 Sep 2009) | 2 lines
Canonify include paths for newly added files.

r197688 | jkim | 2009-10-01 23:56:15 +0300 (Thu, 01 Oct 2009) | 4 lines
Compile ACPI debugger and disassembler for kernel modules
unconditionally.
These files will generate almost empty object files without
ACPI_DEBUG/DDB
options. As a result, size of acpi.ko will increase slightly.

r198237 | jkim | 2009-10-19 19:12:58 +0300 (Mon, 19 Oct 2009) | 2 lines
Merge ACPICA 20091013.

r199337 | jkim | 2009-11-16 23:47:12 +0200 (Mon, 16 Nov 2009) | 2 lines
Merge ACPICA 20091112.

r199338 | jkim | 2009-11-16 23:53:56 +0200 (Mon, 16 Nov 2009) | 2 lines
Add a forgotten module Makefile change from the previous commit.

r200553 | jkim | 2009-12-15 00:24:04 +0200 (Tue, 15 Dec 2009) | 2 lines
Merge ACPICA 20091214.

r200554 | jkim | 2009-12-15 00:28:32 +0200 (Tue, 15 Dec 2009) | 3 lines
Remove _FDE quirk handling as these quirks are automatically repaired
by ACPICA layer since ACPICA 20091214.

r202771 | jkim | 2010-01-21 23:14:28 +0200 (Thu, 21 Jan 2010) | 2 lines
Merge ACPICA 20100121.

r202773 | jkim | 2010-01-21 23:31:39 +0200 (Thu, 21 Jan 2010) | 2 lines
Fix a new header inclusion.

Discussed with: jkim, jhb
No objections from: acpi@


# 871d21ce 14-Dec-2009 Jung-uk Kim <jkim@FreeBSD.org>

Remove _FDE quirk handling as these quirks are automatically repaired
by ACPICA layer since ACPICA 20091214.


# 129d3046 05-Jun-2009 Jung-uk Kim <jkim@FreeBSD.org>

Import ACPICA 20090521.


# aaac7452 02-Jun-2009 Jung-uk Kim <jkim@FreeBSD.org>

Chase ACPICA API changes (for kernel and boot loader).


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# ce1a23d3 20-Feb-2006 Nate Lawson <njl@FreeBSD.org>

Remove unused variable.

Coverity ID: 558
Found by: Coverity Prevent


# 2a191126 11-Sep-2005 David E. O'Brien <obrien@FreeBSD.org>

Canonize the include of acpi.h.


# 30b49000 29-Sep-2004 John Baldwin <jhb@FreeBSD.org>

Only fall back to probing the floppy drives via hints if there is a failure
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


# 27df52f9 17-Sep-2004 Warner Losh <imp@FreeBSD.org>

The long dead hand of the past has pushed forward useless bits in this
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.


# a3f51d19 16-Sep-2004 Nate Lawson <njl@FreeBSD.org>

Handle _FDE results of 5 bytes (vs. 5 uint32_t's). BIOS vendors find yet
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


# f6ddde7c 16-Sep-2004 Warner Losh <imp@FreeBSD.org>

default: case shouldn't set an error yet either.


# ee9e2737 15-Sep-2004 Warner Losh <imp@FreeBSD.org>

For the moment, treat failures to attach floppy drives as non-fatal
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.


# 885128ef 30-Aug-2004 Nate Lawson <njl@FreeBSD.org>

Fix _FDI drive type probing. The new fd child is not an ACPI device while
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.


# f40c77a2 30-Aug-2004 Nate Lawson <njl@FreeBSD.org>

Fix _FDE probing by using the buffer contents instead of the buffer
object itself. ACPI-CA returns an ACPI_OBJECT of type Buffer rather than
the buffer contents itself.


# 1b67be7b 20-Aug-2004 Poul-Henning Kamp <phk@FreeBSD.org>

Rewrite of the floppy driver to make it MPsafe & GEOM friendly:

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).


# 20819082 28-Jul-2004 Nate Lawson <njl@FreeBSD.org>

Fix ACPI floppy enumeration for three types of divergent behavior.
* 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


# a54c9cb1 15-Jul-2004 Nate Lawson <njl@FreeBSD.org>

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