Commit Graph

366 Commits

Author SHA1 Message Date
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
Konstantin Belousov
fc9f8bcf4f Fix unload of the fdc.ko:
Wakeup the thread doing the fdc_detach() when the fdc worker thread exits [1].
Write access to the write-protected floppy shall call device_unbusy() to
pair the device_busy() in the fd_access() [2].

PR:	116537 [1], 116539 [2]
MFC after:	1 week
2008-01-11 11:53:04 +00:00
Julian Elischer
3745c395ec Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0  so that we can eventually MFC the
new kthread_xxx() calls.
2007-10-20 23:23:23 +00:00
John Baldwin
5f6fcd82a2 Always protect the kthread flags with the lock and close a race with
module unload and kthread_exit().

MFC after:	3 days
2007-02-27 17:16:52 +00:00
John Baldwin
6e50e38fcc Use tsleep() rather than msleep() with a NULL mtx parameter. 2007-02-23 23:06:10 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Robert Watson
acd3428b7d Sweep kernel replacing suser(9) calls with priv(9) calls, assigning
specific privilege names to a broad range of privileges.  These may
require some future tweaking.

Sponsored by:           nCircle Network Security, Inc.
Obtained from:          TrustedBSD Project
Discussed on:           arch@
Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri,
                        Alex Lyashkov <umka at sevcity dot net>,
                        Skip Ford <skip dot ford at verizon dot net>,
                        Antoine Brodin <antoine dot brodin at laposte dot net>
2006-11-06 13:42:10 +00:00
Jung-uk Kim
0da90eb878 Fix style nits. No md5 changes in .o's. ;-) 2006-09-08 21:46:01 +00:00
Jung-uk Kim
19a388e651 Restore Digital Outpur Register (DOR) for enhanced controller after reset. 2006-08-29 18:19:39 +00:00
Jung-uk Kim
b31da03fd8 Assume floppy disk is not inserted when we have exhausted retries. This
significantly reduces booting time when there is broken floppy disk drive,
controller, cable, BIOS, etc.
When the floppy controller interface is correctly implemented, disk change
signal (DSKCHG) is reflected in the Digital Input Register (DIR) at 0x3f7.
However, there are many cases that the signal is unusable.  Moreover, some
BIOS does not reserve the port at all.  In those cases, the register may not
function.
2006-07-12 00:49:46 +00:00
Jung-uk Kim
50d99d1a52 Enhanced floppy controllers have Data Rate Select Register (DSR) at 0x3f4.
Use it to reset controller and to select data rate.  According to Intel
80277AA datasheet, software reset behaves the same as DOR reset except
that it is self clearing.  National Semiconductor PC8477B datasheet says
the same.  As a side effect, we no longer use Configuration Control
Register (CCR) at 0x3f7 for these controllers, which is often missing
in modern hardware.
2006-07-06 21:12:18 +00:00
John Baldwin
9fc9d84b9b - Use callout_init_mtx() to initialize toffhandle callout using the fdc's
mutex.
- Don't use callout_drain() to stop the toffhandle callout while holding the
  fdc mutex (this could deadlock) in functions called from softclock
  (callouts aren't allowed to do voluntary sleeps).  Instead, use
  callout_stop().  Note that since we hold the associated mutex and are now
  using callout_init_mtx(), callout_stop() is just as effective as
  callout_drain().  (Though callout_drain() is still needed in detach to
  make sure softclock isn't contesting on our mutex before we destroy the
  mutex.)
- Remove unused callout 'tohandle' from softc.

MFC after:	1 week
2006-02-23 19:11:16 +00:00
Nate Lawson
ce1a23d397 Remove unused variable.
Coverity ID:	558
Found by:	Coverity Prevent
2006-02-21 03:19:24 +00:00
David E. O'Brien
2a191126de Canonize the include of acpi.h. 2005-09-11 18:39:03 +00:00
Craig Rodrigues
1217bf6a9b 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>
MFC after:	1 day
2005-08-30 23:12:18 +00:00
Warner Losh
ab581af779 Eliminate unused argument in PCMCIA_CARD macro.
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)
2005-06-24 14:36:54 +00:00
Warner Losh
356eadcdd6 If we fail a sanity check for the resources just allocated, make sure
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.
2005-03-15 08:02:47 +00:00
Warner Losh
d90aafb50d Only allocate 1 port for non-zero rids. Either we'll get the proper
length form the enumeration mechanism, or we're dealing with the FDCTL
register, which is only 1 port long.
2005-03-14 19:09:29 +00:00
Warner Losh
530a692468 Fix a couple of problems with the probe code when used with pnpbios
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).
2005-03-10 18:09:25 +00:00
Poul-Henning Kamp
62da7a2d68 Add missing () 2005-02-28 13:49:06 +00:00
Pyun YongHyeon
a7e943a456 Add missing va_end() in fdc_cmd.
0 -> NULL in arguments of fdc_sense_int().

Reminded by:	joerg
2005-02-28 05:14:45 +00:00
Warner Losh
787a196bb7 Mask off the upper bits of the resource before using it as an index
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
2005-01-20 17:27:37 +00:00
Warner Losh
973bfe6c4a MFp4: overhaul of resource allocation
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)
2005-01-19 07:46:38 +00:00
Warner Losh
ac673f9a82 Use the standard FreeBSD license 2005-01-11 06:24:40 +00:00
Poul-Henning Kamp
2221dbebce Pass the file->flags down to geom ioctl handlers.
Reject certain ioctls if write permission is not indicated.

Bump geom API version.

Reported by:	Ruben de Groot <mail25@bzerk.org>
2004-12-12 10:09:05 +00:00
Warner Losh
4b87c653f9 Properly wither the geom container on detach. This will allow one to
then later reload fdc and not have duplicate fd devices in dev.

# Maybe this should be moved to a convenience function.

Reviewed by: phk
2004-11-21 16:25:21 +00:00
Poul-Henning Kamp
f8353ede58 Add the last missing bits to make this unloadable: Two wakeups and
calling of the GEOM modevent from the drivers modevent so we know the
order things happen.
2004-11-08 18:53:52 +00:00
Yoshihiro Takahashi
56f0c46a3b Remove a duplicate code. 2004-10-30 12:34:25 +00:00
Poul-Henning Kamp
268315b628 Now that filesystems respect and understand GEOM access counts, refuse
a write open of a read-only floppydisk.
2004-10-29 11:05:45 +00:00
Poul-Henning Kamp
1ef0fd8224 Properly handle failure to allocate isadma bounce buffer 2004-10-22 19:01:10 +00:00
Nate Lawson
926660271c Remove unused variable. Pointy hat candidate. 2004-10-15 04:54:16 +00:00
Nate Lawson
e5979322ba Remove local hacks to set flags now that the device probe does this for us.
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
2004-10-14 22:21:59 +00:00
Peter Edwards
8fe457d687 Fix off-by-one error in fd_native_types that results in a panic on boot
for machines with 2.88M floppies.

Reviewed By: phk
2004-10-10 23:39:59 +00:00
Warner Losh
534e7194f8 Yet another case of resources:
+        * 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...
2004-10-05 07:18:11 +00:00
John Baldwin
30b490009b 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
2004-09-29 19:08:34 +00:00
Poul-Henning Kamp
3ba0c6b127 Use the floppy drive unit number to name the /dev entry, not the
controller unit number.

Submitted by:	Rostislav Krasny <rosti_bsd@yahoo.com>
2004-09-25 08:56:57 +00:00