Commit Graph

56122 Commits

Author SHA1 Message Date
Ruslan Ermilov
c9003bc7fa Catch up with new interrupt handling code. 2005-10-26 06:44:59 +00:00
Ruslan Ermilov
e110f39bf3 Catch up with new interrupt handling code. 2005-10-26 06:17:27 +00:00
Yaroslav Tykhiy
9f4abef9a3 Since carp(4) interfaces presently are kinda fake yet possess
IP addresses, mark them with LOOPBACK so that routing daemons
take them easy for link-state routing protocols.

Reviewed by:	glebius
2005-10-26 05:57:35 +00:00
Takanori Watanabe
f83da457dc Add checking for File record magic. 2005-10-26 03:24:28 +00:00
Marcel Moolenaar
f3b996b6b8 Remove PCI IDs for multiport cards:
o Oxford Semiconductor PCI Dual Port Serial
o Netmos Nm9845 PCI Bridge with Dual UART

Add PCI IDs for single-port cards:
o Various SIIG Cyber Serial
o Oxford Semiconductor OXCB950 UART

Update description as per puc(4).
2005-10-26 01:49:11 +00:00
Peter Grehan
f94061b759 Catch up with interrupt-thread changes. 2005-10-25 21:31:22 +00:00
Nate Lawson
80f006a1e3 If we're trying to use C2/3 and reads from the register are returning
immediately, back off to the next higher Cx sleep state.  Some machines
with a Via chipset report a valid C3 but a register read doesn't actually
halt the CPU.  This would cause the machine to appear unresponsive as it
repeatedly called cpu_idle() which immediately returned.  Causing interrupts
(i.e. by pressing the power button) would cause the system to make forward
progress, showing that it wasn't actually hung.

Also, enable interrupts a little earlier.  We don't need them disabled
to calculate the delta time for the read.

Reported by:	silby
MFC after:	2 weeks
2005-10-25 21:15:47 +00:00
Ruslan Ermilov
27b67627c4 Make the cookie constant name canonical. 2005-10-25 20:56:12 +00:00
Garrett Wollman
74f38f3b9d We've supported the _POSIX_MONOTONIC_CLOCK option for a long time.
Advertise it.

MFC after:	1 week
2005-10-25 19:54:25 +00:00
John Baldwin
e0f66ef861 Reorganize the interrupt handling code a bit to make a few things cleaner
and increase flexibility to allow various different approaches to be tried
in the future.
- Split struct ithd up into two pieces.  struct intr_event holds the list
  of interrupt handlers associated with interrupt sources.
  struct intr_thread contains the data relative to an interrupt thread.
  Currently we still provide a 1:1 relationship of events to threads
  with the exception that events only have an associated thread if there
  is at least one threaded interrupt handler attached to the event.  This
  means that on x86 we no longer have 4 bazillion interrupt threads with
  no handlers.  It also means that interrupt events with only INTR_FAST
  handlers no longer have an associated thread either.
- Renamed struct intrhand to struct intr_handler to follow the struct
  intr_foo naming convention.  This did require renaming the powerpc
  MD struct intr_handler to struct ppc_intr_handler.
- INTR_FAST no longer implies INTR_EXCL on all architectures except for
  powerpc.  This means that multiple INTR_FAST handlers can attach to the
  same interrupt and that INTR_FAST and non-INTR_FAST handlers can attach
  to the same interrupt.  Sharing INTR_FAST handlers may not always be
  desirable, but having sio(4) and uhci(4) fight over an IRQ isn't fun
  either.  Drivers can always still use INTR_EXCL to ask for an interrupt
  exclusively.  The way this sharing works is that when an interrupt
  comes in, all the INTR_FAST handlers are executed first, and if any
  threaded handlers exist, the interrupt thread is scheduled afterwards.
  This type of layout also makes it possible to investigate using interrupt
  filters ala OS X where the filter determines whether or not its companion
  threaded handler should run.
- Aside from the INTR_FAST changes above, the impact on MD interrupt code
  is mostly just 's/ithread/intr_event/'.
- A new MI ddb command 'show intrs' walks the list of interrupt events
  dumping their state.  It also has a '/v' verbose switch which dumps
  info about all of the handlers attached to each event.
- We currently don't destroy an interrupt thread when the last threaded
  handler is removed because it would suck for things like ppbus(8)'s
  braindead behavior.  The code is present, though, it is just under
  #if 0 for now.
- Move the code to actually execute the threaded handlers for an interrrupt
  event into a separate function so that ithread_loop() becomes more
  readable.  Previously this code was all in the middle of ithread_loop()
  and indented halfway across the screen.
- Made struct intr_thread private to kern_intr.c and replaced td_ithd
  with a thread private flag TDP_ITHREAD.
- In statclock, check curthread against idlethread directly rather than
  curthread's proc against idlethread's proc. (Not really related to intr
  changes)

Tested on:	alpha, amd64, i386, sparc64
Tested on:	arm, ia64 (older version of patch by cognet and marcel)
2005-10-25 19:48:48 +00:00
Xin LI
eb2893ec18 Remove an unneeded "a" from comment. 2005-10-25 19:46:15 +00:00
John Baldwin
6caf758e7c Use shorter names for the Giant and fast taskqueues so that their names
actually fit.
2005-10-25 19:29:02 +00:00
Bill Paul
ef74f2c9c5 Correct some __FreeBSD_version conditionals to use version bumps closer
to the actual dates when code actually changed. Also add special case
link state change handling for RELENG_5, which doesn't have
if_link_state_change(). No actual operational changes are done.
2005-10-25 16:14:34 +00:00
Marius Strobl
3727af6a8b - Add a workaround for the fact that OFW doesn't guarantee that
devices can be opened multiple times simultaneously but we're
  expected to be able to do so by the rest of the loader.
  This fixes booting from disks attached to the on-board SCSI
  controller of Sun Ultra 1 (previously this triggered a trap)
  and probably also of AX1115 boards.
- While here, remove unused variables and add empty lines where
  style(9) requires such.

Tested on:	powerpc (grehan), sparc64
MFC after:	1 month
2005-10-25 12:51:49 +00:00
Marius Strobl
79aae78c89 In ofw_parsedev() check the return value of malloc() and protect
against a NULL pointer dereference when ofw_parsedev() is called
with a NULL path argument.

Tested on:	powerpc (grehan), sparc64
2005-10-25 12:49:56 +00:00
Ruslan Ermilov
d24864f785 Refactor (some more) installation of kernel and module objects.
Try to make everyone happy: David (to have debug kernels installed
by default), Warner (to be able to override that), and myself (for
actually making it all work and to be consistent).

Now, if kernel was configured for debugging (through DEBUG=-g in
the kernel config file or "config -g"), doing "make install" will
install debug versions of kernel and module objects with their
canonical names,

	kernel.debug -> /boot/kernel/kernel
	if_fxp.ko.debug -> /boot/kernel/if_fxp.ko

Installing a kernel not configured for debugging, or debug kernel
with INSTALL_NODEBUG variable defined, will install non-debug
kernel and module objects.

Also, restore the install.debug and reinstall.debug targets that
are part of the existing API (they cause some additional gdb(1)
scripts to be installed).
2005-10-25 09:05:07 +00:00
Bill Paul
85155d23de Add a 1 microsecond delay in pci_add_children(), right before the read
of the PCIR_HDRTYPE register. It's the value returned from this
read access that determines whether or not we decide a device is
present at the current slot index. For some reason that I can't
adequately explain, this read fails on my machine when probing the
USB controller on my machine (which happens a multifunction device
at slot index 3 hung off the PCI-PCI bridge on the AMD8111 (bus
index 1)). The read will return 0xFF even though it should return
0x80 to indicate the presence of a multifunction device.

As near as I can tell, there's some timing issue involved with reading
the 'dead' slot indexes 0 through 2 that causes the read of the actual
device at slot 3 to fail. I tried a couple of different tricks to
correct the problem (the patch to amd64/pci/pci_cfgreg.c fixes it
for the amd64 arch), but adding this delay is the only thing that
always allows the USB controllers to be correctly probed 100% of the
time. Whatever the problem is, it's likely confined to the AMD8111
chipset. However, a simple 1us delay is fairly harmless and should
have no side effects for other hardware. I consider this to be
voodoo, but it's fairly benign voodoo and it makes my USB keyboard
and mouse work again.

Note that this is the second time that I've had to resort to a
1us delay to fix a PCI-related problem with this AMD8111/Opteron
system (the first being a fix I made a while back to the NDISulator).
It's possible the delay really belongs in the cfgreg code itself,
or that pci_cfgreg needs some custom hackery for an errata in the
8111. (I checked but couldn't find any documented errata on AMD's
site that could account for these problems.)
2005-10-25 06:53:45 +00:00
Bill Paul
8a3a26385c Undo the change to pci_cfgdisable() on i386 for now. It seems to fix
the amd64 case, but makes the i386 case fail even more often.
2005-10-25 05:32:44 +00:00
Bill Paul
ba3af76df7 Modify the pci_cfgdisable() routine to bring it more in line with
other OSes (Solaris, Linux, VxWorks). It's not necessary to write a 0
to the config address register when using config mechanism 1 to turn
off config access. In fact, it can be downright troublesome, since it
seems to confuse the PCI-PCI bridge in the AMD8111 chipset and cause
it to sporadically botch reads from some devices. This is the cause
of the missing USP ports problem I was experiencing with my Sun Opteron
system.

Also correct the case for mechanism 2: it's only necessary to write
a 0 to the ENABLE port.
2005-10-25 04:53:29 +00:00
Pyun YongHyeon
4ba2acb3c4 Remove "nodevice snd_es137x" as it is supported now. 2005-10-25 04:05:48 +00:00
Pyun YongHyeon
95ced7a97d Connect es137x build on sparc64. 2005-10-25 04:01:41 +00:00
Pyun YongHyeon
38eae97c07 - Convert hme(4) to use TX side bus_dmamap_load_mbuf_sg(9).
- Move hardware counter reading/zeroing to hme_tick(). This saves
   8 register access per interrupt. [1]
- Use imax macro for getting max. argument between two integers.
- Invoke bus_dmamap_sync(9) first before freeing mbuf.
- Check driver queue first to reduce locking operation in hme_start_locked()
  and interrupt handler.
- Simplyfy watchdog timer setup in interrupt handler.
- Don't log normal errors such as RX overrun. If we have DMA stuck
  condition, reinitialize the driver and log it.

Reviewed by:	marius
Obtained from:	OpenBSD [1]
2005-10-25 03:56:21 +00:00
Warner Losh
2a0146bdf1 Preliminary support for Xircom Credit Card Adapter. Not to be
confused with the Credit Card Adapter II and its spawn (which the xe
driver supports).  These changes get my card probing and attaching.  I
recently won one of these (and a NEC rebadged version) in an lot
auction.  The NEC didn't work, so I took it apart and found the
MB86960A chip and then modified if_fe_pccard.c to attach.  I can't
test this card further since I have no dongle for this card.
2005-10-25 03:49:24 +00:00
Warner Losh
697ca17bb0 Back out most of 1.84. It was unwise to force debug kernels to always
be installed.  It should have been optional to install a non-debug
one, just like it was formerly optional to install a debug one.  In
order to do that, most of 1.84 had to go.

Instead, make installing the debug kernel the default, but create a
new option INSTALL_NODEBUG for those people that have small /
partitions and good source control habits.

This preserves the behavior of 1.84 while allowing it to be overriden
for people (like me) that do not have the time to upgrade to get a
bigger / and also don't have time for stupid makefile tricks when
upgrading their older system, but still want a kernel.debug around if
things go south.
2005-10-24 23:54:39 +00:00
John Baldwin
58553b9925 Rename the KDB_STOP_NMI kernel option to STOP_NMI and make it apply to all
IPI_STOP IPIs.
- Change the i386 and amd64 MD IPI code to send an NMI if STOP_NMI is
  enabled if an attempt is made to send an IPI_STOP IPI.  If the kernel
  option is enabled, there is also a sysctl to change the behavior at
  runtime (debug.stop_cpus_with_nmi which defaults to enabled).  This
  includes removing stop_cpus_nmi() and making ipi_nmi_selected() a
  private function for i386 and amd64.
- Fix ipi_all(), ipi_all_but_self(), and ipi_self() on i386 and amd64 to
  properly handle bitmapped IPIs as well as IPI_STOP IPIs when STOP_NMI is
  enabled.
- Fix ipi_nmi_handler() to execute the restart function on the first CPU
  that is restarted making use of atomic_readandclear() rather than
  assuming that the BSP is always included in the set of restarted CPUs.
  Also, the NMI handler didn't clear the function pointer meaning that
  subsequent stop and restarts could execute the function again.
- Define a new macro HAVE_STOPPEDPCBS on i386 and amd64 to control the use
  of stoppedpcbs[] and always enable it for i386 and amd64 instead of
  being dependent on KDB_STOP_NMI.  It works fine in both the NMI and
  non-NMI cases.
2005-10-24 21:04:19 +00:00
John Baldwin
301268b8ca When restarting the BSP during cpu_reset() use a membar to ensure that
the updated cpustop_restartfunc is seen when the BSP resumes execution.
This matches the membar already present in restart_cpus().
2005-10-24 20:53:52 +00:00
John Baldwin
95d84e5461 Use xchg in Xcpustop to close a race and make cpustop_restartfunc truly
one-shot in the SMP case (before using the simple mov / cmp / mov sequence
could allow multiple CPUs to execute the restart function on resume).
2005-10-24 20:52:26 +00:00
John Baldwin
6b1e0d75b0 - Various small whitespace and style nits.
- Use PCPU_GET(cpumask) in preference to 1 << PCPU_GET(cpuid) in a few
  places.
2005-10-24 20:31:04 +00:00
John Baldwin
f55ab99409 Document in #ifdef notnow code the actions that proc_fini would need to
take if struct procs were actually freed.
2005-10-24 20:15:23 +00:00
John Baldwin
cf23efc12a Don't panic if a spin lock is initialized that isn't in our static order
list.  Just warn about it instead.

Requested by:	scottl
MFC after:	1 day
2005-10-24 20:14:24 +00:00
Nate Lawson
c395e805cd Invert the check logic. No functional change, but I prefer this version. 2005-10-24 18:30:57 +00:00
Bill Paul
ac350b125a Do not allow ndis_ticktask() to run after ndis_halt_nic() has been called.
(It may have been queued up in one of the workitem threads, and letting
it fire after the NIC has been halted will cause a crash in some cases.)
2005-10-24 17:47:47 +00:00
John Baldwin
8d2a5b8c34 Revert previous change to this file. I accidentally committed while
fixing spelling in a comment.
2005-10-24 15:58:21 +00:00
John Baldwin
971d0ad835 Spell hierarchy correctly in comments.
Submitted by:	Wojciech A. Koszek dunstan at freebsd dot czest dot pl
2005-10-24 15:57:27 +00:00
John Baldwin
3924da21a3 - Rename 'traceall' to 'alltrace' so that the 'tr' shortcut for 'trace'
still works.  Also, this is consistent with 'show pcpu' vs
  'show allpcpu'.  (And 'show allstacks' on OS X for that matter.)
- Add 'bt' as an alias for 'trace'.  We already have a 'where' alias as
  well, so this makes it easier for gdb-wired hands to work in ddb.

Ok'd by:	rwatson (1)
Requested by:	scottl (2)
MFC after:	1 day
2005-10-24 15:21:36 +00:00
Stephan Uphoff
198b0a3b71 Only set B_RAM (Read ahead mark) on an incore buffers if we can lock it.
This fixes a race condition caused by the unlocked write access to the
b_flags field.

MFC after:	3 days
2005-10-24 14:23:04 +00:00
Nate Lawson
895e60b801 If no AC line devices are found, go ahead and notify devd that the system
is on AC power (i.e. not a laptop).  This allows power_profile to run once
for desktop systems as well, for instance, to set C3 or CPU frequency.

MFC after:	2 weeks
2005-10-24 05:34:21 +00:00
Bill Paul
4ba4b2c45c Fix handling of message table messages that got broken when I
converted NdisWriteErrorLogEntry() to use the RtlXXX unicode/ansi
conversion routines.
2005-10-24 05:05:09 +00:00
David E. O'Brien
f769d59f8c We no longer need INCLUDES+= -I$S/contrib/dev/acpica. 2005-10-24 04:40:37 +00:00
David E. O'Brien
c33a1f33c8 Add a commented out version of what was done for the r20041119sysinc import. 2005-10-24 04:36:14 +00:00
David E. O'Brien
3e50df5a3e Fix conflicts of import of Intel ACPI-CA 20041119 with system includes fixups. 2005-10-24 04:35:20 +00:00
David E. O'Brien
763384f7cd This commit was generated by cvs2svn to compensate for changes in r151600,
which included commits to RCS files with non-trunk default branches.
2005-10-24 04:31:06 +00:00
David E. O'Brien
27f081c52f Vendor import of Intel ACPI-CA 20041119 with system includes fixups. 2005-10-24 04:31:06 +00:00
Paul Saab
bbf719c8ba include opt_compat.h to unbreak the build 2005-10-24 00:00:00 +00:00
David E. O'Brien
2f3e5b2f15 Add a 'clean' target. 2005-10-23 23:58:23 +00:00
Olivier Houchard
4bc6c6dc6c Unbreak for !__XSCALE__. 2005-10-23 23:09:14 +00:00
David Xu
fe80a39034 Don't touch last overrun if signal was already on queue. 2005-10-23 22:59:33 +00:00
Andrew Thompson
1a2661371b If we have been called from ether_ifdetach() then do not try and clear the
promisc flag from the member interface, this is a no-op anyway since the
interface is disappearing. The driver may have already released
its resources such as miibus and this is likely to panic the kernel.

Submitted and tested by:	Wojciech A. Koszek
MFC after:			2 weeks
2005-10-23 22:30:07 +00:00
Nate Lawson
b77b750ee9 Like acpi_throttle, set frequency to 100% in attach. Some BIOSen may set
this value lower, making the system quite slow after booting.
2005-10-23 19:38:06 +00:00
Nate Lawson
49ab824149 Add prototype to be consistent. 2005-10-23 19:31:18 +00:00