Commit Graph

49522 Commits

Author SHA1 Message Date
Poul-Henning Kamp
a0e78d2eb0 Do not refcount the cdevsw, but rather maintain a cdev->si_threadcount
of the number of threads which are inside whatever is behind the
cdevsw for this particular cdev.

Make the device mutex visible through dev_lock() and dev_unlock().
We may want finer granularity later.

Replace spechash_mtx use with dev_lock()/dev_unlock().
2004-09-23 07:17:41 +00:00
Matt Jacob
1db03259c9 PAE seems to work for isp- at least under mimimal testing. 2004-09-23 05:26:19 +00:00
Matt Jacob
6976709916 PAE support changes that included at least some minimal actual testing
with a kernel that booted.
2004-09-23 05:25:22 +00:00
Marcel Moolenaar
0c32530bb7 Redefine a PTE as a 64-bit integral type instead of a struct of
bit-fields. Unify the PTE defines accordingly and update all
uses.
2004-09-23 00:05:20 +00:00
Marcel Moolenaar
0675c65d6b s/u_int#_t/uint#_t/g 2004-09-22 23:12:46 +00:00
Max Laier
fa97ea3131 Switch order for mtx_unlock and cv_signal as (condvar(9)) sez:
A thread must hold mp while calling cv_signal(), cv_broadcast(), or
     cv_broadcastpri() even though it isn't passed as an argument.

and is right with this claim.

While here remove a "\" from the macro -> __inline conversion.

Found by:	csjp
MFC after:	4 days
2004-09-22 20:55:56 +00:00
Marcel Moolenaar
08d3edb315 For the atomic_{add|clear|set|subtract} family of inlines, return the
old or previous value instead of void. This is not as is documented
in atomic(9), but is API (and ABI) compatible and simply makes sense.
This feature will primarily be used for atomic PTE updates in PMAP/ng.
2004-09-22 19:58:43 +00:00
Marcel Moolenaar
5c48823c36 MFp4: various style fixes, including
o  s/u_int/uint/g
o  s/#define<sp>/#define<tab>/g
o  indent macro definitions
o  Improve vertical spacing
o  Globally align line continuation character
2004-09-22 19:47:42 +00:00
Poul-Henning Kamp
bc710003ac Pointy hat please!
Refuse VCHR not VREG.
2004-09-22 18:18:26 +00:00
Stefan Farfeleder
e7b80a8e24 Prefer C99's __func__ over GCC's __FUNCTION__. 2004-09-22 17:16:04 +00:00
John Baldwin
e0a9358679 Add a couple of macros to extract the PCI slot (device) and function from
an ACPI _ADR value and use that rather than inlining the same shifts and
masks everywhere.
2004-09-22 15:46:16 +00:00
John Baldwin
7eaec467d8 Various small style fixes. 2004-09-22 15:24:33 +00:00
Brian Feldman
5ed8cedc83 Call sbuf_finish() before sbuf_data() so as to not panic the system. 2004-09-22 12:53:27 +00:00
Brooks Davis
4dcf2bbbff Fix a LOR where ifconf() used copyout while holding a mutex. This LOR
was seen when configuring addresses on interfaces using ifconfig.  This
patch has been verified to work with over eight thousand addresses
assigned to an interface.

LOR id:		031
2004-09-22 08:59:41 +00:00
Warner Losh
9c3ae2ef4b Add a temporary workaround to the panic on boot with hub attached and
panic on hub detach bugs that have been reported.  This work around
detaches the device before deleting it.  This changes the detach order
from in-order to pre-order.  This avoids uhub's deleting the children
after its subdevs has been deleted.

This is only a workaround.  This leads to a strange condition in the
device tree where attached devices are children of detached ones.  I
really don't know what that's supposed to mean, but does violate my
sense of POLA.  Fortunately, the violation is short lived, which is
why I'm going ahead and committing the work around.

# We really need to consider life w/o the multiple nested layers of
# compatibility macros.  They make finding bugs like this *MUCH*
# harder.

Patch by: iadowse

MT5 before: next_release(5.3-BETA5) (unless someting better comes along)
2004-09-22 06:02:10 +00:00
Alan Cox
a971139680 Correct a long-standing error in _pmap_unwire_pte_hold() affecting
multiprocessors.  Specifically, the error is conditioning the call to
pmap_invalidate_page() on whether the pmap is active on the current CPU.
This call must be unconditional.  Regardless of whether the pmap is active
on the CPU performing _pmap_unwire_pte_hold(), it could be active on another
CPU.  For example, a call to pmap_remove_all() by the page daemon could
result in a call to _pmap_unwire_pte_hold() with the pmap inactive on the
current CPU and active on another CPU.  In such circumstances, failing to
call pmap_invalidate_page() results in a stale TLB entry on the other CPU
that still maps the now deallocated page table page.  What happens next is
typically a mysterious panic in pmap_enter() by the other CPU, either
"pmap_enter: attempted pmap_enter on 4MB page" or "pmap_enter: pte vanished,
va: 0x%lx".  Both occur because the former page table page has been recycled
and allocated to a new purpose.  Consequently, it no longer contains zeroes.

See also Peter's i386/i386/pmap.c revision 1.448 and the related e-mail
thread last year.

Many thanks to the engineers at Sandvine for providing clear and concise
information until all of the pieces of the puzzle fell into place and
for testing an earlier patch.

MT5 Candidate
2004-09-22 05:01:48 +00:00
Julian Elischer
2e2e32b201 Revert the last change..
Better to kill all other threads than to panic the system if 2 threads call
execve() at the same time. A better fix will be committed later.

Note that this only affects the case where the execve fails.
2004-09-22 01:30:23 +00:00
Peter Wemm
7789933b6a MFi386: adapt rev 1.19 (debugger fixes) 2004-09-22 01:27:06 +00:00
Peter Wemm
b05ba1f73d Minor sync-up with i386. Catch up on de-quoting and de-counting after
config changes.
2004-09-22 01:04:54 +00:00
Peter Wemm
46ec31b083 MFi386: add ispfw (except using correct device<tab><tab>ispfw format,
<space><tab> is for the options line)
2004-09-22 00:44:13 +00:00
Julian Elischer
297800599a In a threaded process, don't kill off all the other threads until we have a
reasonable chance that the eceve() is going to succeeed. I.e.
wait until we've done the permission checks etc.

MFC after:	1 week
2004-09-21 21:05:13 +00:00
Nate Lawson
95c973ff52 Initialize the flags value properly. We used to do this in acpi_tz_all_off()
but that function has been removed.  This avoids a potential unnecessary
fan switch on boot.  Also remove some commented out code.

MFC after:	3 days
2004-09-21 18:39:10 +00:00
Nate Lawson
ba36768b22 Don't disable acpi in shutdown if we're panicing (panicstr != NULL). This
may help with double panics.
2004-09-21 17:19:38 +00:00
Dag-Erling Smørgrav
c70315d4a8 Correct the capitalization of "nVidia". 2004-09-21 13:17:55 +00:00
Poul-Henning Kamp
a367987828 De support opening device nodes on CD9660 filesystems. They are
still visible, they can still be seen, but they cannot be opened.
Use DEVFS for that.
2004-09-21 08:42:37 +00:00
Poul-Henning Kamp
90a660e199 If a vnode has no v_rdev we cannot hope to answer FIODTYPE ioctl. 2004-09-21 08:33:05 +00:00
Wes Peters
ecaf63f715 Trap invalid sector size 0 in disk probe, refusing to add such a
device to the list.  This prevents crashes on /0 errors in 'lsdev'
et al.

Reviewed-by:	jhb@
MT5 after:	RE approval
2004-09-21 06:46:44 +00:00
John Baldwin
76764432e4 - Add support for "paging" in stack trace output. That is, when you do
a stack trace from ddb, the output will pause with a '--More--' prompt
  every 18 lines.  If you hit Enter, it will print another line and prompt
  again.  If you hit space it will output another page and then prompt.
  If you hit 'q' or 'x' it will abort the rest of the stack trace.
- Fix the sparc64 userland stack trace to honor the total count of lines
  to print.  This is useful if your trace happens to walk back onto
  0xdeadc0de and gets stuck in an endless loop.

MFC after:	1 month
Tested on:	i386, alpha, sparc64
2004-09-20 19:05:32 +00:00
John Baldwin
b89daf89a8 Remove unused macro. 2004-09-20 19:01:44 +00:00
Pawel Jakub Dawidek
201dfcf143 This is not needed anymore, it is forced in GEOM now.
Actually, it can even cause some problems, because GEOM requires sectorsize
to be more than 0 on first access, not on provider creation, so we can skip
valid providers by doing this check here.

Reported by:	Divacky Roman <xdivac02@stud.fit.vutbr.cz>
		Sven Willenberger <sven@dmv.com>
2004-09-20 17:26:25 +00:00
Yoshihiro Takahashi
e48b233cd8 Merged from sys/dev/sio/sio.c: more tty related changes. 2004-09-20 14:01:38 +00:00
Yoshihiro Takahashi
31eac965cd MFpc98: Check a pointer is NULL, remove unused variable. 2004-09-20 13:55:26 +00:00
Brian Somers
a04946cf6e CTASSERT that MSZIE is a power of 2 (otherwise dtom() breaks)
Ask uma_zcreate() to align mbufs to MSIZE bytes (otherwise dtom() breaks)

As it happens, uma_zalloc_arg() always returned mbufs aligned to MSIZE
anyway, but that was an implementation side-effect....

KASSERT -> CTASSERT suggested by: dd@
Approved by:	silence on -net
2004-09-20 08:52:04 +00:00
MIHIRA Sanpei Yoshiro
82ad8eff9e Add support Nvidia nForce2(audio)
PR:		kern/71317
Submitted by:	Mezz <mezz@freebsd.org>
MFC after:	1 week
2004-09-20 07:19:49 +00:00
John-Mark Gurney
aedd16d964 trim trailing white space..
call the re mutex by it's name..

MFC after:	3 days
2004-09-20 06:33:37 +00:00
Warner Losh
083ba097fd das@ has a ACPI bios that lists 0x3f0-0x3f1, 0x3f2-0x3f3, 0x3f4-0x3f5
and 0x3f7.  fdc_isa_alloc_resource() didn't work right in this case
(it accessed FDOUT correctly due to an overflow of the first resource.
It accesed FDSTS and FDDATA incorrectly via the second resource (which
wound up accessing FDOUT and the tape register at 0x3f3) and badly for
the CTL register (at location 0x3f4).  This is a minimal fix that just
'eats' the first one if it covers two locations and has an offset of
0.  This confusion lead the floppy driver to think there'd been a disk
change, which uncovered a deadlock in the floppy/geom code which lead
to a panic.  These changes fix that by fixing the underlying resource
problem, but doesn't address the potential deadlock issue that might
still be there.

This is a minimal fix so it can more safely be merged into 5 w/o risk
for known working configurations (hence the use of the ugly goto,
which reduces case 8 to case 6 w/o affecting cases 1-7).  A more
invasive fix that will handle more ACPI resource list diversity is in
the pipeline that should kill these issues once and for all, while
staying within the resources that we allocate.

Tested/Reported by: das
Reviewed by: njl
MFC before: re->next_release_name(5.3-BETA5);
2004-09-20 06:12:19 +00:00
MIHIRA Sanpei Yoshiro
e99e85532a Add support nForce3 250 audio
PR:		kern/71726
Submitted by:	FUJIMOTO Kou <fujimoto@j.dendai.ac.jp>
MFC after:	1 week
2004-09-20 05:59:17 +00:00
Nate Lawson
520467d3ba Record a problem we can't workaround for now regarding duplicate interrupts
because of links left enabled while in APIC mode.  A large scale rework of
irq links is underway by jhb@ which should fix this eventually.
2004-09-20 05:56:01 +00:00
MIHIRA Sanpei Yoshiro
4e526aae71 add '/* Panasonic products */' line(I removed it) 2004-09-20 04:56:13 +00:00
Marius Strobl
9aee2491ec Fix compilation of vinum(4) when VINUMDEBUG is not defined.
PR:		71341
Submitted by:	Phil Budne <phil@tripadvisor.com>
MT5 candidate.
2004-09-20 00:13:10 +00:00
Marius Strobl
46b3f0f811 Correct value and description of the unused MK48TXX_WDAY_FT macro. 2004-09-20 00:09:32 +00:00
Poul-Henning Kamp
e8f89940e2 Commit the new version of the adlink driver which can do non-cyclic
capture.  Now we just need somebody to write a gnu-radio frontend :-)
2004-09-19 21:52:15 +00:00
Marius Strobl
6b1c98e2be - Some of the upper bits of the time related (seconds, minutes, etc.)
registers are control bits or depending on the model contain additional
  time bits with a different meaning than the lower ones. In order to
  only read the desired time bits and not change the upper bits on write
  use appropriate masks in the gettime and settime function respectively.
  Due to the polarity of the stop oscillator bit and the fact that the
  century bits aren't used on sparc64 not masking them didn't cause
  problems so far.
- Fix two off-by-one errors in the handling of the day of week. The
  genclock code represents the dow as 0 - 6 with 0 being Sunday but the
  mk48txx use 1 - 7 with 1 being Sunday. In the settime function when
  writing the dow to the clock the range wasn't adjusted accordingly but
  the clock apparently played along nicely otherwise the second bug in
  the gettime function which mapped 1 - 7 to 0 - 6 but with 0 meaning
  Saturday would have been triggered. Fixing these makes the date being
  stored in the same format Sun/Solaris uses and cures the "Invalid time
  in real time clock. Check and reset the date immediately!" when the
  date was set under Solaris prior to booting FreeBSD/sparc64. [1]
  Looking at other clock drivers/code e.g. FreeBSD/alpha the former "bug",
  i.e. storing the dow as 0 - 6 even when the clock uses 1 - 7, seems to
  be common but might be on purpose for compatibility when multi-booting
  with other OS which do the same. So it might make sense to add a flag
  to handle the dow off-by-one for use of this driver on platforms other
  than sparc64.
- Check the state of the battery on mk48txx that support this in the
  attach function.
- Add a note that use of the century bit should be implemented but isn't
  required at the moment because it isn't used on sparc64.

Problem noted by:	joerg [1]
MT5 candidate.
2004-09-19 21:38:11 +00:00
Alan Cox
de6c3db01f Simplify the reference counting of page table pages. Specifically, use
the page table page's wired count rather than its hold count to contain
the reference count.  My rationale for this change is based on several
factors:

1. The machine-independent and pmap layers used the same hold count field
   in subtly different ways.  The machine-independent layer uses the hold
   count to implement a form of ephemeral wiring that is used by pipes,
   physio, etc.  In other words, subsystems where we wish to temporarily
   block a page from being swapped out while it is mapped into the kernel's
   address space.  Such pages are never removed from the page queues.
   Instead, the page daemon recognizes a non-zero hold count to mean "hands
   off this page."  In contrast, page table pages are never in the page
   queues; they are wired from birth to death.  The hold count was being
   used as a kind of reference count, specifically, the number of valid
   page table entries within the page.  Not surprisingly, these two
   different uses imply different synchronization rules: in the machine-
   independent layer access to the hold count requires the page queues
   lock; whereas in the pmap layer the pmap lock is required.  Thus,
   continued use by the pmap layer of vm_page_unhold(), which asserts that
   the page queues lock is held, made no sense.

2. _pmap_unwire_pte_hold() was too forgiving in its handling of the wired
   count.  An unexpected wired count on a page table page was ignored and
   the underlying page leaked.

3. In a word, microoptimization.  Using the wired count exclusively, rather
   than a combination of the wired and hold counts, makes the code slightly
   smaller and faster.

Reviewed by: tegge@
2004-09-19 21:20:01 +00:00
David Schultz
8daa8c602a The zone from which proc structures are allocated is marked
UMA_ZONE_NOFREE to guarantee type stability, so proc_fini() should
never be called.  Move an assertion from proc_fini() to proc_dtor()
and garbage-collect the rest of the unreachable code.  I have retained
vm_proc_dispose(), since I consider its disuse a bug.
2004-09-19 18:34:17 +00:00
John-Mark Gurney
81d4eca1ef fix misspelling of TX...
Submitted by:	Johan Karlsson
MFC after:	3 days
2004-09-19 18:16:28 +00:00
John-Mark Gurney
6102153685 spell RX correctly
don't call re_rxeof a second time when we've already done the work
pull common code out from if and else clauses

MFC after:	3 days
2004-09-19 17:51:41 +00:00
John-Mark Gurney
efefe913d2 comment requirement that rx/tx descriptor counts must be equal due to
shared code...
define rx descriptor count in terms of tx
align defines

MFC after:	3 days
2004-09-19 17:45:56 +00:00
Max Khon
9cf3607da2 Use correct malloc type when freeing memory allocated by g_read_data.
PR:		71431
Submitted by:	daichi
2004-09-19 10:27:46 +00:00
Poul-Henning Kamp
d705e025d0 The getpages VOP was a good stab at getting scatter/gather I/O without
too much kernel copying, but it is not the right way to do it, and it is
in the way for straightening out the buffer cache.

The right way is to pass the VM page array down through the struct
bio to the disk device driver and DMA directly in to/out off the
physical memory.  Once the VM/buf thing is sorted out it is next on
the list.

Retire most of vnode method. ffs_getpages().  It is not clear if what is
left shouldn't be in the default implementation which we now fall back to.

Retire specfs_getpages() as well, as it has no users now.
2004-09-19 08:14:55 +00:00