Commit Graph

401 Commits

Author SHA1 Message Date
Warner Losh
685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh
95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Warner Losh
4d846d260e 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
2023-05-12 10:44:03 -06:00
John Baldwin
7c146c0cbc fd/fdc: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-06 15:46:58 -07:00
Warner Losh
05d3c5fd18 fd_probe: only define unit on x86, other platforms don't use this code
Sponsored by:		Netflix
2022-04-04 22:29:28 -06:00
Mateusz Guzik
b6f387fdb7 fdc: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-25 11:25:11 +00:00
Warner Losh
e2c1243f42 fd: Move from using device_busy to a refcount
Use refcounting to delay the detach rather than device_busy and/or
device_unbusy. fd/fdc is one of the few consumers of device_busy in the
tree for that, and it's not a good fit. Also, nothing is waking 'fd' and
other drivers don't loop like this. Return EBUSY if we still have active
users.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D31830
2021-09-29 20:18:28 -06:00
Warner Losh
163b959a73 pccard: Remove fdc(4) PC Card attachment point
Remove PC Card attachemnt point for fdc.

Relnotes: Yes
2021-01-07 20:22:56 -07:00
Mark Johnston
b3cb04b930 fdc(4): Handle errors from fdc_in() properly.
fdc_in() returns only 0 and 1, some callers were checking incorrectly
for failure.

PR:		248940
Submitted by:	Tong Zhang <ztong0001@gmail.com>
MFC after:	1 week
2020-08-27 16:34:33 +00:00
Warner Losh
e0d14216c1 Tag pccard drivers with gone in 13.
MFC After: 3 days
Reviewed by: emaste, brooks, adrian (on twitter)
Differential Revision: https://reviews.freebsd.org/D26095
2020-08-20 17:19:40 +00:00
Pawel Biernacki
7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
Warner Losh
f86e60008b Regularize my copyright notice
o Remove All Rights Reserved from my notices
o imp@FreeBSD.org everywhere
o regularize punctiation, eliminate date ranges
o Make sure that it's clear that I don't claim All Rights reserved by listing
  All Rights Reserved on same line as other copyright holders (but not
  me). Other such holders are also listed last where it's clear.
2019-12-04 16:56:11 +00:00
Conrad Meyer
ac03832ef3 GEOM: Reduce unnecessary log interleaving with sbufs
Similar to what was done for device_printfs in r347229.

Convert g_print_bio() to a thin shim around g_format_bio(), which acts on an
sbuf; documented in g_bio.9.

Reviewed by:	markj
Discussed with:	rlibby
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D21165
2019-08-07 19:28:35 +00:00
Takanori Watanabe
5efca36fbd 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
2018-10-26 00:05:46 +00:00
Warner Losh
5fe4723c70 Create a new ISA_PNP_INFO macro. Use this macro every where we have
ISA PNP card support (replace by hand version in if_ed). Move module
declarations to the end of some files. Fix PCCARD_PNP_INFO to use
nitems(). Remove some stale comments about pc98, turns out the comment
was simply wrong.
2017-12-23 06:49:27 +00:00
Warner Losh
a5ec991c27 Need to NULL terminate this list. It worked before by accidental data
in the module following it that terminated the search.
2017-12-22 17:13:54 +00:00
Pedro F. Giffuni
718cf2ccb9 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.
2017-11-27 14:52:40 +00:00
Pedro F. Giffuni
7282444b10 sys/dev: further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

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.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:36:21 +00:00
Warner Losh
fbbd9655e5 Renumber copyright clause 4
Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by:	Jan Schaumann <jschauma@stevens.edu>
Pull Request:	https://github.com/freebsd/freebsd/pull/96
2017-02-28 23:42:47 +00:00
Yoshihiro Takahashi
2b375b4edd Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes:	yes
2017-01-28 02:22:15 +00:00
John Baldwin
e45163b216 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
2016-05-04 23:00:57 +00:00
Adrian Chadd
cde57cac55 s/struct device */device_t/g
Submitted by:	kmacy
2016-05-04 06:25:12 +00:00
Pedro F. Giffuni
453130d9bf sys/dev: minor spelling fixes.
Most affect comments, very few have user-visible effects.
2016-05-03 03:41:25 +00:00
John Baldwin
fed2c48af4 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
2016-04-21 18:37:36 +00:00
John Baldwin
25f9805707 Don't wakeup the fdc worker thread once a second when idle.
The fdc worker thread was using a one second timeout while waiting for
a new bio to arrive or for the device to detach.  However, the driver
already does a wakeup when queueing a new bio or asking the thread to
detach, so the timeout only served to waste CPU time waking up the
thread once a second just so it could go right back to sleep.  Use an
infinite timeout instead.

Discussed with:	phk
Sponsored by:	Netflix
2016-04-05 00:08:42 +00:00
Warner Losh
c1a6d28a5b Add raw RX-50 support. These are 400k single sided disks with 80
tracks and 10 sectors per track. More exotic RX-50 types not
supported, nor is there support for de-interleaving the first two
tracks where the physical sectors are 0 1 2 3 4 5 6 7 8 9, but they
should be interpreted as 0 5 1 6 2 7 3 8 4 9. This is purely to read
the media with dd. The FAT that's on these disks won't work with
msdosfs anyway.
2016-03-10 00:36:38 +00:00
Warner Losh
80139618c9 Stop assuming that bio_cmd is a bit field.
Differential Revision: https://reviews.freebsd.org/D5587
2016-03-10 00:33:06 +00:00
Justin Hibbits
c47476d7e6 Migrate many bus_alloc_resource() calls to bus_alloc_resource_anywhere().
Most calls to bus_alloc_resource() use "anywhere" as the range, with a given
count.  Migrate these to use the new bus_alloc_resource_anywhere() API.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D5370
2016-02-27 03:38:01 +00:00
Justin Hibbits
43cd61606b Replace several bus_alloc_resource() calls using default arguments with bus_alloc_resource_any()
Since these calls only use default arguments, bus_alloc_resource_any() is the
right call.

Differential Revision: https://reviews.freebsd.org/D5306
2016-02-19 03:37:56 +00:00
Warner Losh
f6cea53f9d Create a generic PCCARD_PNP_INFO from the MODULE_PNP_INFO building
block. Use it in all the PNP drivers to export either the current PNP
table. For uart, create a custom table and export it using
MODULE_PNP_INFO since it's the only one that matches on function
number.

Differential Review: https://reviews.freebsd.org/D3461
2015-12-11 05:27:56 +00:00
John Baldwin
83e78a7f6e Merge the PC98 fdc(4) driver into the MI driver. While here, replace
the magic numbers used with NE7CMD_SPECIFY with invocations of the
NE7_SPEC_x() macros.

Approved by:	nyan
2014-09-25 20:40:24 +00:00
Joerg Wunsch
acb3b5d2fe Reimplement the FDOPT_NOERROR feature that was kicked out in r134081.
It is needed for fdread(1) in order to be able to recover from CRC
errors in the data field of a floppy sector (by returning the sector
data that failed CRC, rather than inventing dummy data).

When closing the device, clear all transient device options.

MFC after:	1 week
2013-08-26 21:15:50 +00:00
Joerg Wunsch
1f97b64cbb Do not use "Enable Implied Seek" on enhanced floppy controllers. This
breaks the "2step" feature of the driver, e.g. in order to read 360
KiB media on a 1200 KiB drive.

As the only potential advantage of implied (vs. explicit) seeks is to
minimize the software effort, yet our driver always contained the
logic needed for explicit seeks, simply dropping implied seeks is the
best solution without introducing risks for new bugs.  There is no
performance penalty, reading a 1440 KiB medium takes exactly the same
time with both, implied or explicit seeks.

MFC after:	1 week
2013-08-24 21:04:54 +00:00
Sofian Brabez
61bfd86762 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
2013-01-30 18:01:20 +00:00
Jaakko Heinonen
02c62349c9 - Don't pass geom and provider names as format strings.
- Add __printflike() attributes.
- Remove an extra argument for the g_new_geomf() call in swapongeom_ev().

Reviewed by:	pjd
2012-11-20 12:32:18 +00:00
Ed Schouten
75da3c1a9b Replace inline static' by static inline'.
If I interpret the C standard correctly, the storage specifier should be
placed before the inline keyword. While at it, replace __inline by
inline in the files affected.
2011-12-13 14:06:01 +00:00
Ed Schouten
6472ac3d8a Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.
The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.
2011-11-07 15:43:11 +00:00
Kevin Lo
ee6eac62f7 Remove duplicate header includes 2011-06-28 08:36:48 +00:00
Rebecca Cran
6bccea7c2b Fix typos - remove duplicate "the".
PR:	bin/154928
Submitted by:	Eitan Adler <lists at eitanadler.com>
MFC after: 	3 days
2011-02-21 09:01:34 +00:00
Jung-uk Kim
4affd62610 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
2010-05-30 03:45:41 +00:00
Jung-uk Kim
871d21ce2d Remove _FDE quirk handling as these quirks are automatically repaired
by ACPICA layer since ACPICA 20091214.
2009-12-14 22:28:32 +00:00
Roman Divacky
68c4dfdf0c Make isa_dma functions MPSAFE by introducing its own private lock. These
functions are selfcontained (ie. they touch only isa_dma.c static variables
and hardware) so a private lock is sufficient to prevent races. This changes
only i386/amd64 while there are also isa_dma functions for ia64/sparc64.
Sparc64 are ones empty stubs and ia64 ones are unused as ia64 does not
have isa (says marcel).

This patch removes explicit locking of Giant from a few drivers (there
are some that requires this but lack ones - this patch fixes this) and
also removes the need for implicit locking of Giant from attach routines
where it's provided by newbus.

Approved by:	ed (mentor, implicit)
Reviewed by:	jhb, attilio (glanced by)
Tested by:	Giovanni Trematerra <giovanni.trematerra gmail com>
IA64 clue:	marcel
2009-11-09 20:29:10 +00:00
Jaakko Heinonen
4586315a76 fdc(4) module unload fixes:
- Tear down the interrupt handler before killing the worker thread.
- Do geom withering as GEOM event to avoid acquiring the GEOM topology
  lock under Giant.

PR:		kern/104079
Reviewed by:	joerg
Approved by:	trasz (mentor)
2009-11-03 19:05:05 +00:00
Jaakko Heinonen
0c73f68bb6 Don't ignore the return value of g_modevent() in fdc_modevent().
Approved by:	trasz (mentor)
2009-10-27 17:14:22 +00:00
Edward Tomasz Napierala
7c3a3fbe95 Orphaning provider with EXDEV seems weird; perhaps the author meant
ENXIO here?
2009-10-10 21:49:04 +00:00
Joerg Wunsch
3fdc1d5c48 With the fdc control device disappearing some 5 years ago, it is no
longer useful for the FD_STYPE and FD_SOPTS ioctls to insist on being
issued on a writable file descriptor.  Otherwise, there's no longer a
chance to set the drive type or options when a read-only medium is
present in the drive, as there is no way to obtain a writable fd then.
2009-06-24 19:30:31 +00:00
Jung-uk Kim
129d3046ef Import ACPICA 20090521. 2009-06-05 18:44:36 +00:00
Warner Losh
eed55f0644 Eliminate an unused variable reported by coverity
Submitted by:	Ganbold
2008-11-23 23:04:28 +00:00
Jung-uk Kim
c884498f0b - Revive fdc(4) per-device flag 0x10, which was removed in r1.284[1].
- If the flag is set and auto-select fails, assume disk is not present.
- Set disk empty flag only when the floppy controller reset is needed.
It fixes regression introduced in r1.311, which prevented it from ignoring
errors.  Now fdformat(1) and dd(1) with conv=noerror option can continue
when read/write errors occur as they should.
- Do not retry disk probing as it is extremely slow and pointless.
- Move the disk probing code into a separate function.
- Do not reset disk empty flag if write-protect check fails somehow.

PR:		kern/116538[1]
2008-11-15 01:43:34 +00:00
Konstantin Belousov
89a828fde9 The wakeup() line from the rev. 1.319 is wrong and reintroduces
a panic race on module unload. The wakeup() is internal to
kproc_exit/kthread_exit. The correct fix is to fix the msleep() in
detach to sleep on fdc->fdc_thread instead of &fdc->fdc_thread.

Noted and reviewed by:	jhb
Pointy hat to:	kib
MFC after:	1 week
2008-01-11 16:50:52 +00:00