Commit Graph

10120 Commits

Author SHA1 Message Date
Poul-Henning Kamp
0658bb8ef8 Move a relic to its correct location(s): Put nfs diskless initialization
calls with the code they call.  (Yet another example of mindless copy&paste).
2004-07-28 21:54:57 +00:00
Alexander Kabaev
24a06d1874 Avoid casts as lvalues. While here, avoid storing 32bit quantities in
16bit locations.
2004-07-28 06:32:28 +00:00
Robert Watson
1a8cfbc450 Pass a thread argument into cpu_critical_{enter,exit}() rather than
dereference curthread.  It is called only from critical_{enter,exit}(),
which already dereferences curthread.  This doesn't seem to affect SMP
performance in my benchmarks, but improves MySQL transaction throughput
by about 1% on UP on my Xeon.

Head nodding:	jhb, bmilekic
2004-07-27 16:41:01 +00:00
Tim J. Robbins
7ee771aa57 Use file2c instead of a combination of hexdump, sed and shell script to
generate the wakecode[] array from acpi_wakecode.bin. The old method was
not safe in multibyte locales.
2004-07-27 01:33:27 +00:00
Nate Lawson
6edc660c09 Get the acpi softc via the devclass, not by caching the device. Replace
apm_softc with a single integer since the whole softc is not used.
2004-07-24 22:41:30 +00:00
Nate Lawson
be22348065 Whitespace cleanup and move static variables together. 2004-07-24 20:40:02 +00:00
Nate Lawson
b4cb140233 Remove unneeded parens and fix whitespace. 2004-07-24 20:39:25 +00:00
Scott Long
17ee0667eb Arg! Revert local changes that were accidentlly included in the previous
version.
2004-07-22 15:55:03 +00:00
Scott Long
7c06f85c31 Don't count needed bounce pages if loading a buffer that was created with
bus_dmamem_alloc()

Submitted by: harti
2004-07-22 15:46:51 +00:00
Olivier Houchard
e1021dde8b Using NULL as a malloc type when calling contigmalloc() is wrong, so introduce
a new malloc type, and use it.
2004-07-21 15:52:34 +00:00
Yoshihiro Takahashi
ee6020c993 Add the ACPI Panasonic extras driver.
Submitted by:	OGAWA Takaya <t-ogawa@triaez.kaisei.org> and nyan
2004-07-21 14:47:54 +00:00
Marcel Moolenaar
fd32d93b97 Unify db_stack_trace_cmd(). All it did was look up the thread given
the thread ID and call db_trace_thread().
Since arm has all the logic in db_stack_trace_cmd(), rename the
new DB_COMMAND function to db_stack_trace to avoid conflicts on
arm.
While here, have db_stack_trace parse its own arguments so that
we can use a more natural radix for IDs. If the ID is not a thread
ID, or more precisely when no thread exists with the ID, try if
there's a process with that ID and return the first thread in it.
This makes it easier to print stack traces from the ps output.

requested by: rwatson@
tested on: amd64, i386, ia64
2004-07-21 05:07:09 +00:00
David Xu
2396628bb4 Make end of frames for KSE thread, for system scope thread, without this
change, debugger will dump a weird stack backtrace.
2004-07-20 01:38:59 +00:00
John Baldwin
788195c186 As a temporary hack, turn off deferred preemptions that are the result of
a fast interrupt handler doing an swi_sched().  This fixed the lockups I
saw on my laptop when using xmms in KDE and on rwatson's MySQL benchmarks
on SMP.  This will eventually be removed and/or modified when I figure out
what the root cause is and fix that.
2004-07-19 16:37:47 +00:00
David Schultz
479f8d2214 Make FLT_ROUNDS correctly reflect the dynamic rounding mode. 2004-07-19 08:17:25 +00:00
Mike Silbersack
4ca037c6c8 Add a #error requiring KDB if DDB is specified. (This can probably be
relocated to a better place, if one exists.)
2004-07-19 02:46:34 +00:00
Alan Cox
aec86de47b Utilize pmap_pte_quick() rather than pmap_pte() in pmap_protect(). The
reason being that pmap_pte_quick() requires the page queues lock, which is
already held, rather than Giant.
2004-07-18 21:19:10 +00:00
Maxim Konovalov
aa355a2679 In -CURRENT pseudo devices are not statically assigned at compile time,
remove a stale comment.

PR:		kern/62285
2004-07-18 09:03:12 +00:00
Alan Cox
b73cfbb3e4 Remedy my omission of one change in the prevision revision: pmap_remove()
must pin the current thread in order to call pmap_pte_quick().
2004-07-17 23:44:59 +00:00
Alan Cox
c9829537f4 - Utilize pmap_pte_quick() rather than pmap_pte() in pmap_remove() and
pmap_remove_page().  The reason being that pmap_pte_quick() requires
   the page queues lock, which is already held, rather than Giant.
 - Assert that the page queues lock is held in pmap_remove_page() and
   pmap_remove_pte().
2004-07-17 22:20:53 +00:00
Poul-Henning Kamp
672c05d49c Preparation commit for the tty cleanups that will follow in the near
future:

rename ttyopen() -> tty_open() and ttyclose() -> tty_close().

We need the ttyopen() and ttyclose() for the new generic cdevsw
functions for tty devices in order to have consistent naming.
2004-07-15 20:47:41 +00:00
Alan Cox
3d2e54c317 Push down the acquisition and release of the page queues lock into
pmap_protect() and pmap_remove().  In general, they require the lock in
order to modify a page's pv list or flags.  In some cases, however,
pmap_protect() can avoid acquiring the lock.
2004-07-15 18:00:43 +00:00
John Baldwin
fe96955252 Fix a typo in a comment. 2004-07-15 16:37:48 +00:00
Poul-Henning Kamp
3e019deaed Do a pass over all modules in the kernel and make them return EOPNOTSUPP
for unknown events.

A number of modules return EINVAL in this instance, and I have left
those alone for now and instead taught MOD_QUIESCE to accept this
as "didn't do anything".
2004-07-15 08:26:07 +00:00
John Baldwin
0c9cb34441 Correct bounds check in lapic_create().
Submitted by:	"Ted Unangst" tedu at coverity.com
2004-07-14 18:12:15 +00:00
Poul-Henning Kamp
ec712659ef Desupport M-Systems DiskOnChip driver "fla" 2004-07-13 17:43:03 +00:00
Warner Losh
4b5239229c oldcard's card device no longer requires a count 2004-07-13 16:11:34 +00:00
David Xu
53dbf30349 Add ptrace_clear_single_step(), alpha already has it for years, the function
will be used by ptrace to clear a thread's single step state.
2004-07-13 07:22:56 +00:00
Alan Cox
ce8da3091f Push down the acquisition and release of the page queues lock into
pmap_remove_pages().  (The implementation of pmap_remove_pages() is
optional.  If pmap_remove_pages() is unimplemented, the acquisition and
release of the page queues lock is unnecessary.)

Remove spl calls from the alpha, arm, and ia64 pmap_remove_pages().
2004-07-13 02:49:22 +00:00
Marcel Moolenaar
45cfc0a914 Partially revert previous commit. Calling getit() unconditionally fixed
a problem that could also be fixed differently without reverting previous
attempts to fix DELAY while the debugger is active (rev 1.204). The bug
was that the i8254 implements a countdown timer, while for (k)db_active
a countup timer was implemented. This resulted in premature termination
and consequently the breakage of DELAY. The fix (relative to rev 1.211)
is to implement a countdown timer for the kdb_active case. As such the
ability to step clock initialization is preserved and DELAY does what is
expected of it.

Blushed: bde :-)
Submitted by: bde
2004-07-11 17:50:59 +00:00
Marcel Moolenaar
8bcb1e9e84 Add options KDB and GDB. KDB takes on the function of what DDB used
to be. Both DDB and GDB specify which KDB backends to include.
2004-07-11 03:20:09 +00:00
Marcel Moolenaar
1ca618fcaa Remove the now unused GDB stubs. See src/sys/gdb/* for the new KDB
backend.
2004-07-11 01:47:26 +00:00
Marcel Moolenaar
37224cd3fc Mega update for the KDB framework: turn DDB into a KDB backend.
Most of the changes are a direct result of adding thread awareness.
Typically, DDB_REGS is gone. All registers are taken from the
trapframe and backtraces use the PCB based contexts. DDB_REGS was
defined to be a trapframe on all platforms anyway.
Thread awareness introduces the following new commands:
	thread X	switch to thread X (where X is the TID),
	show threads	list all threads.

The backtrace code has been made more flexible so that one can
create backtraces for any thread by giving the thread ID as an
argument to trace.

With this change, ia64 has support for breakpoints.
2004-07-10 23:47:20 +00:00
Marcel Moolenaar
3875c9304a Update for the KDB framework:
o  Make debugging code conditional upon KDB instead of DDB.
o  Declare ksym_start and ksym_end as extern and initialize them.
   This was previously and bogusly handled by DDB itself.
o  Call kdb_enter() instead of Debugger().
o  Remove implementation of Debugger().
2004-07-10 22:47:06 +00:00
Marcel Moolenaar
7f46949fdf Call getit() unconditionally and only grab clock_lock when the
debugger is not active. The fixes breakages of DELAY() when
running in the debugger, because not calling getit() when the
debugger is active yields a DELAY that doesn't.
2004-07-10 22:16:18 +00:00
Marcel Moolenaar
6c29a22f1f Update for the KDB framework:
o  s/ddb_on_nmi/kdb_on_nmi/g
o  Rename sysctl machdep.ddb_on_nmi to machdep.kdb_on_nmi
o  Make debugging support conditional upon KDB instead of DDB.
o  Call kdb_reenter() when kdb_active is non-zero.
o  Call kdb_trap() to enter the debugger when not already active.
o  Update comments accordingly.
o  Remove misplaced prototype of kdb_trap().
2004-07-10 22:11:14 +00:00
Marcel Moolenaar
89cf7c254d Update for the KDB framework:
o  Make debugging code conditional upon KDB instead of DDB.
o  Call kdb_enter() instead of Debugger().
o  Remove local (static) variable in_debugger. Use kdb_active instead.
2004-07-10 21:24:36 +00:00
Marcel Moolenaar
5a39cbaf69 Implement makectx(). The makectx() function is used by KDB to create
a PCB from a trapframe for purposes of unwinding the stack. The PCB
is used as the thread context and all but the thread that entered the
debugger has a valid PCB.
This function can also be used to create a context for the threads
running on the CPUs that have been stopped when the debugger got
entered. This however is not done at the time of this commit.
2004-07-10 19:56:00 +00:00
Marcel Moolenaar
cbc174356c Introduce the KDB debugger frontend. The frontend provides a framework
in which multiple (presumably different) debugger backends can be
configured and which provides basic services to those backends.
Besides providing services to backends, it also serves as the single
point of contact for any and all code that wants to make use of the
debugger functions, such as entering the debugger or handling of the
alternate break sequence. For this purpose, the frontend has been
made non-optional.
All debugger requests are forwarded or handed over to the current
backend, if applicable. Selection of the current backend is done by
the debug.kdb.current sysctl. A list of configured backends can be
obtained with the debug.kdb.available sysctl. One can enter the
debugger by writing to the debug.kdb.enter sysctl.
2004-07-10 18:40:12 +00:00
Marcel Moolenaar
72d44f31a6 Introduce the GDB debugger backend for the new KDB framework. The
backend improves over the old GDB support in the following ways:
o  Unified implementation with minimal MD code.
o  A simple interface for devices to register themselves as debug
   ports, ala consoles.
o  Compression by using run-length encoding.
o  Implements GDB threading support.
2004-07-10 17:47:22 +00:00
Brian Somers
0ac4013324 Change the following environment variables to kernel options:
bootp -> BOOTP
    bootp.nfsroot -> BOOTP_NFSROOT
    bootp.nfsv3 -> BOOTP_NFSV3
    bootp.compat -> BOOTP_COMPAT
    bootp.wired_to -> BOOTP_WIRED_TO

- i.e. back out the previous commit.  It's already possible to
pxeboot(8) with a GENERIC kernel.

Pointed out by: dwmalone
2004-07-08 22:35:36 +00:00
Brian Somers
59e1ebc9b5 Change the following kernel options to environment variables:
BOOTP -> bootp
    BOOTP_NFSROOT -> bootp.nfsroot
    BOOTP_NFSV3 -> bootp.nfsv3
    BOOTP_COMPAT -> bootp.compat
    BOOTP_WIRED_TO -> bootp.wired_to

This lets you PXE boot with a GENERIC kernel by putting this sort of thing
in loader.conf:

    bootp="YES"
    bootp.nfsroot="YES"
    bootp.nfsv3="YES"
    bootp.wired_to="bge1"

or even setting the variables manually from the OK prompt.
2004-07-08 13:40:33 +00:00
Poul-Henning Kamp
ddb81ab1c6 Fix an oversight in r1.26: remove #ifdef around necessary variable.
Spotted by:	philip
2004-07-07 20:02:30 +00:00
Alan Cox
26a965568d Simplify the control flow in pmap_extract(), enabling the elimination of a
PMAP_UNLOCK() call.
2004-07-07 16:47:58 +00:00
Alan Cox
03c0ca74ee White space and style changes only. 2004-07-07 02:23:46 +00:00
Nate Lawson
52702e98d2 Use the proper type and then cast on assignment. This fixes warning when
building with -O2.
2004-07-06 04:56:31 +00:00
Alan Cox
c9a217d2ed Style changes to pmap_extract(). 2004-07-06 02:33:11 +00:00
Poul-Henning Kamp
91ea86d7e8 Something funny happened on the way to the floppy driver today...
When two drivers share an ISA DMA channel, they both call isa_dmainit()
and the second call fails if DIAGNOSTIC is on.

If isa_dmainit() was already called successfully, just return silently.

This only works if both drivers agree on the bounce buffer size,
but since sharing DMA is usually only possible on very special
hardware and then typically only for devices of the same type (which
would have multiple instances of the same device driver), this is
not a problem in practice.
2004-07-05 20:37:42 +00:00
Warner Losh
c928d0b956 Remove now obsolete port assignments and sizes. These more properly
belong in the respective drivers.  I've not removed ALL of them, as a
few still haven't moved.  I've just removed the ones that aren't used.

# these can be removed from amd64, but I'm having issues getting to
# sledge at the moment for a build.
2004-07-05 18:39:30 +00:00
Stefan Farfeleder
5908d366fb Consistently use __inline instead of __inline__ as the former is an empty macro
in <sys/cdefs.h> for compilers without support for inline.
2004-07-04 16:11:03 +00:00
Warner Losh
8b68b82381 Don't define __RMAN_RESOURCE_VISISBLE. They aren't needed here after
I've converted the direct accessing of struct resource members to the
preferred interface.
2004-07-03 20:11:49 +00:00
Scott Long
b524342941 Commit the first of half of changes that allow busdma to transparently
honor the alignment and boundary constraints in the dma tag when loading
buffers.  Previously, these constraints were only honored when allocating
memory via bus_dmamem_alloc().  Now, bus_dmamap_load() will automatically
use bounce buffers when needed.

Also add a set of sysctls to monitor the global busdma stats.  These are:

hw.busdma.free_bpages
hw.busdma.reserved_bpages
hw.busdma.active_bpages
hw.busdma.total_bpages
hw.busdma.total_bounced
hw.busdma.total_deferred
2004-07-03 18:18:36 +00:00
John Baldwin
0c0b25ae91 Implement preemption of kernel threads natively in the scheduler rather
than as one-off hacks in various other parts of the kernel:
- Add a function maybe_preempt() that is called from sched_add() to
  determine if a thread about to be added to a run queue should be
  preempted to directly.  If it is not safe to preempt or if the new
  thread does not have a high enough priority, then the function returns
  false and sched_add() adds the thread to the run queue.  If the thread
  should be preempted to but the current thread is in a nested critical
  section, then the flag TDF_OWEPREEMPT is set and the thread is added
  to the run queue.  Otherwise, mi_switch() is called immediately and the
  thread is never added to the run queue since it is switch to directly.
  When exiting an outermost critical section, if TDF_OWEPREEMPT is set,
  then clear it and call mi_switch() to perform the deferred preemption.
- Remove explicit preemption from ithread_schedule() as calling
  setrunqueue() now does all the correct work.  This also removes the
  do_switch argument from ithread_schedule().
- Do not use the manual preemption code in mtx_unlock if the architecture
  supports native preemption.
- Don't call mi_switch() in a loop during shutdown to give ithreads a
  chance to run if the architecture supports native preemption since
  the ithreads will just preempt DELAY().
- Don't call mi_switch() from the page zeroing idle thread for
  architectures that support native preemption as it is unnecessary.
- Native preemption is enabled on the same archs that supported ithread
  preemption, namely alpha, i386, and amd64.

This change should largely be a NOP for the default case as committed
except that we will do fewer context switches in a few cases and will
avoid the run queues completely when preempting.

Approved by:	scottl (with his re@ hat)
2004-07-02 20:21:44 +00:00
Scott Long
c0daeb2592 Remove stray i386 math emulator references. 2004-07-01 22:18:06 +00:00
Yoshihiro Takahashi
7f1fb91a0a This needs __RMAN_RESOURCE_VISIBLE if PC98 is defined. 2004-07-01 09:36:31 +00:00
John Baldwin
39981fed82 Trim a few things from the dmesg output and stick them under bootverbose to
cut down on the clutter including PCI interrupt routing, MTRR, pcibios,
etc.

Discussed with:	USENIX Cabal
2004-07-01 07:46:29 +00:00
John Baldwin
0d7f466944 As per discussion at today's developer summit, add a comment to NOTES
indicating that 80386 support is deprecated and will be removed in
6.0-RELEASE.

Ok'd by:	rwatson, scottl
2004-07-01 06:02:32 +00:00
Warner Losh
0363a12688 Hide struct resource and struct rman. You must define
__RMAN_RESOURCE_VISIBLE to see inside these now.

Reviewed by: dfr, njl (not njr)
2004-06-30 16:54:10 +00:00
Nate Lawson
1a26ea7f2c Add machdep quirks functions. On i386, this disables acpi on systems with
BIOS dates earlier than Jan 1, 1999.  Add prototypes and quirks flags.
2004-06-30 04:42:29 +00:00
Peter Wemm
1b74731b83 Fix leftover argument to pmap_unuse_pt(). I committed the wrong diff.
Submmitted by:  Jon Noack <noackjr@alumni.rice.edu>
2004-06-30 01:43:23 +00:00
Nate Lawson
3ed1dfa11d Update for acpi_id_probe() 2004-06-29 19:05:20 +00:00
Peter Wemm
654bd0e802 Reduce the size of pv entries by 15%. This saves 1MB of KVA for mapping
pv entries per 1GB of user virtual memory.  (eg: if we had 1GB file was
mmaped into 30 processes, that would theoretically reduce the KVA demand by
30MB for pv entries.  In reality though, we limit pv entries so we don't
have that many at once.)

We used to store the vm_page_t for the page table page.  But we recently
had the pa of the ptp, or can calculate it fairly quickly.  If we wanted
to avoid the shift/mask operation in pmap_pde(), we could recover the
pa but that means we have to store it for a while.

This does not measurably change performance.

Suggested by:  alc
Tested by:  alc
2004-06-29 15:57:05 +00:00
Warner Losh
dc7949f45f bde points out that this can't do anything useful. The full patch has
other parts that I can't locat at the moment, so back it out until I can.
2004-06-28 05:37:22 +00:00
Warner Losh
f465e257e2 When opening /dev/io, preserve iopl properly. Otherwise, if you open
/dev/io multiple times, the first close remove the privs.
2004-06-28 03:16:32 +00:00
Warner Losh
cb490814b9 remove needless blankline 2004-06-28 03:08:17 +00:00
Warner Losh
15442f461b Use APM_UNKNOWN instead of 0xff. Use ~0U instead 0 for the number of
batteries.  This should be -1 to match other code, but since the api
is unsigned ~0U is the same thing.
2004-06-28 02:38:20 +00:00
Alan Cox
df68e345c5 In case pmap_extract_and_hold() is ever performed on a different pmap than
the current one, we need to pin the current thread to its CPU.

Submitted by:	tegge@
2004-06-26 19:10:12 +00:00
David E. O'Brien
13a0a973c6 Add casts so all these quantities are a constant type. 2004-06-24 02:24:39 +00:00
John Baldwin
2fc3727323 Finally implement bus_config_intr() support for I/O APIC interrupt sources.
This should fix problems with older SMP systems that only have ISA/EISA
IRQs when routing virgin PCI interrupts as well as on other boxes whose
MADT does not have any interrupt override entries for ISA IRQs that are
used to route PCI interrupts even in APIC mode.
2004-06-23 18:11:33 +00:00
John Baldwin
a7cd01df0e Fetch the actual acpi0 device_t and use device_is_attached() to see if
it's alive rather than trying to fetch its softc pointer via its devclass.

Glanced at by:	imp, njl
2004-06-23 17:59:01 +00:00
Brooks Davis
14b3b2933d el(4) stopped needing to me a count device in December 2000. 2004-06-23 17:33:25 +00:00
John Baldwin
96d3b93753 Various cleanups in support of a future ioapic_config_intr() function:
- Allow ioapic_set_{nmi,smi,extint}() to be called multiple times on the
  same pin so long as the pin's mode is the same as the mode being
  requested.
- Add a notion of bus type for the interrupt associated with interrupt pin.
  This is needed so that we can force all EISA interrupts to be active high
  in the forthcoming ioapic_config_intr().
- Fix a bug for EISA systems that didn't remap IRQs.  This would have broken
  EISA systems that tried to disable mixed mode for IRQ 0.
2004-06-23 15:29:20 +00:00
Bruce M Simpson
8a32d6f08e MFamd64: Document the machdep.hlt_cpus sysctl MIB variable.
PR:		i386/65729
Submitted by:	Craig Rodrigues
2004-06-23 07:12:34 +00:00
Alan Cox
9eb31321cf Implement the protection check required by the pmap_extract_and_hold()
specification.  This enables the elimination of Giant from that function.

Reviewed by:	tegge@
2004-06-22 19:35:43 +00:00
Poul-Henning Kamp
ec66f15d14 Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES. 2004-06-21 22:57:16 +00:00
Alan Cox
dc8beb5358 - Simplify pmap_remove_pages(), eliminating unnecessary indirection.
- Simplify the locking of pmap_is_modified() by converting control flow to
   data flow.
2004-06-20 20:57:06 +00:00
Alan Cox
1ec4b75936 Add pmap locking to pmap_is_prefaultable(). 2004-06-20 06:11:00 +00:00
Bruce Evans
4c5f10a672 Backed out previous commit. Blind substitution of dev_t by `struct cdev *'
was just wrong here because the dev_t's are user dev_t's.
2004-06-20 03:52:50 +00:00
Bruce Evans
4df7435a78 Include <sys/_lock.h>'s prerequisite <sys/queue.h> before including the
former, not after.
2004-06-20 00:33:14 +00:00
Bruce Evans
6ed979574f Clear any pending exceptions before using frstor (in the non-FXSR case)
in npxsetregs() too.  npxsetregs() must overwrite the previous state, and
it is never paired with an npxgetregs() that would defuse the previous
state (since npxgetregs() would have fninit'ed the state, leaving nothing
to do).

PR:		68058 (this should complete the fix)
Tested by:	Simon Barner <barner@in.tum.de>
2004-06-19 22:24:16 +00:00
Alan Cox
785f2cdf57 Remove unused pt_entry_ts. Remove an unneeded semicolon. 2004-06-19 19:09:08 +00:00
Bruce Evans
83cca9682f Removed foot-shooting setting of CR0_TS in exec_setregs(). It is
unnecessary because cpu_setregs() and/or npxinit() always sets CR0_TS
during system initialization, and CR0_TS is set in the next statement
(fpstate_drop()) if necessary after system initialization.  Setting
it unnecessarily was less than a pessimization since it broke the
invariant that the npx can be used without an npxdna() trap if
fpucurthread is non-null.  The broken invariant became harmful when I
added an fnclex to npxdrop().

Removed setting of CR0_MP in exec_setregs().  This was similarly
unnecessary but was harmless.

Updated comments (mainly by removing them).  Things are simpler now
that we have cpu_setregs() and don't support a math emulator or pretend
to support not having either a math emulator or an npx.

Removed the ifdef for avoiding setting CR0_NE in the !SMP case in
cpu_setregs().  npx_probe() should reverse the setting if it wants to
force IRQ13 exception handling for testing.
2004-06-19 12:28:48 +00:00
Bruce Evans
bd1a3f1a7e Fixed a panic caused by over-optimizing npxdrop() in the non-FXSR case.
frstor can trap despite it being a control instruction, since it bogusly
checks for pending exceptions in the state that it is overwriting.
This used to be a non-problem because frstor was always paired with a
previous fnsave, and fnsave does an implicit fninit so any pending
exceptions only remain live in the saved state.  Now frstor is sometimes
paired with npxdrop() and we must do a little more than just forget
that the npx was used in npxdrop() to avoid a trap later.  This is a
non-problem in the FXSR case because fxrstor doesn't do the bogus check.

FXSR is part of SSE, and npxdrop() is only in FreeBSD-5.x, so this bug
only affected old machines running FreeBSD-5.x.

PR:		68058
2004-06-18 02:10:55 +00:00
Nate Lawson
37c55a039a Revert last change. If acpi is loaded or compiled into the kernel, its
devclass will be present even if the driver was disabled by a hint.  Using
device_get_softc() provides the right info even if it's overkill.

Explained by:	jhb
2004-06-17 17:27:37 +00:00
Alan Cox
d45f21f31a Do not preset PG_BUSY on VM_ALLOC_NOOBJ pages. Such pages are not
accessible through an object.  Thus, PG_BUSY serves no purpose.
2004-06-17 06:16:58 +00:00
Warner Losh
e04ed822be o Return ai_batteries as 0xffffffff instead of -1. This is a nop change, but
placates gcc which seems to like to complain about -1 being assigned to
  an unsigned value.  It is well defined and intended, but since signess bugs
  are being hunted just change to 0xffffffff.
o Mask the lower 8 bits, not the lower 4 bits for the ai_capabilities word.
  All 8 bits are defined and the 0xf was almost certainly a typo.
o Define APM_UNKNOWN to 0xff for emulation layer.
2004-06-16 20:27:50 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Alan Cox
4d831945a7 MFamd64
Introduce pmap locking to many of the pmap functions.
2004-06-16 07:03:15 +00:00
Alan Cox
1e82a3d1f0 MFamd64
Remove dead or unneeded code, e.g., spl calls.
2004-06-16 05:42:44 +00:00
Julian Elischer
fa88511615 Nice, is a property of a process as a whole..
I mistakenly moved it to the ksegroup when breaking up the process
structure. Put it back in the proc structure.
2004-06-16 00:26:31 +00:00
Alan Cox
7b9d474460 Remove a stale comment. 2004-06-15 19:28:40 +00:00
Nate Lawson
591b993b83 s/device_get_handle/acpi_get_handle
Submitted by:	Hiroyuki Aizu
2004-06-15 16:49:20 +00:00
Nate Lawson
f6c8318b0f Catch one more use of acpi_MatchHid and update for new API. 2004-06-15 02:17:23 +00:00
Nate Lawson
345281bc43 We only need the devclass_find() result, not the softc. 2004-06-15 02:12:12 +00:00
John Baldwin
3b7f737e69 Fix a couple of typos.
PR:		doc/67894
Submitted by:	Chris Pepper pepper at reppep dot com
2004-06-14 18:37:23 +00:00
Nate Lawson
7a15653c9c Use the new API for acpi_MatchHid(). The difference between ACPI_HANDLE
and device_t isn't caught by the compiler.
2004-06-14 03:40:56 +00:00
Alan Cox
7881f95056 Prevent the loss of a PG_M bit through an SMP race in pmap_ts_referenced(). 2004-06-13 21:59:42 +00:00
Alan Cox
8559e0a291 - Remove an unused declaration.
- Move a definition inside the scope of a #ifdef _KERNEL.
2004-06-13 03:44:11 +00:00
Alan Cox
2d0dc0fcd6 In a multiprocessor, the PG_W bit in the pte must be changed atomically.
Otherwise, the setting of the PG_M bit by one processor could be lost if
another processor is simultaneously changing the PG_W bit.

Reviewed by:	tegge@
2004-06-12 20:01:48 +00:00
Poul-Henning Kamp
1930e303cf Deorbit COMPAT_SUNOS.
We inherited this from the sparc32 port of BSD4.4-Lite1.  We have neither
a sparc32 port nor a SunOS4.x compatibility desire these days.
2004-06-11 11:16:26 +00:00
John Baldwin
bad4ce7d91 - Use the correct devclass name ("acpi" vs "ACPI") to detect if acpi0 is
present and thus that the PnPBIOS probe should be skipped instead of
  having ACPI zero out the PnPBIOStable pointer.
- Make the PnPBIOStable pointer static to i386/i386/bios.c now that that is
  the only place it is used.
2004-06-10 20:43:04 +00:00
John Baldwin
092a5c4530 Remove atdevbase and replace it's remaining uses with direct references to
KERNBASE instead.
2004-06-10 20:31:00 +00:00
John Baldwin
a916fdf6ad Completely ignore disabled CPU entries as their APIC IDs tend to be
invalid.
2004-06-10 20:03:46 +00:00
Poul-Henning Kamp
9a6dc4b647 Remove filename+line number from panic messages. 2004-06-06 21:26:49 +00:00
Bruce Evans
bed16055e7 Fixed misclassification of npx interrupts caused by npx_probe().
Dividing by 0 in order to check for irq13/exception16 delivery apparently
always causes an irq13 even if we have configured for exception16 (by
setting CR0_NE).  This was expected, but the timing of the irq13 was
unexpected.  Without CR0_NE, the irq13 is delivered synchronously at
least on my test machine, but with CR0_NE it is delivered a little
later (about 250 nsec) in PIC mode and much later (5000-10000 nsec)
in APIC mode.  So especially in APIC mode, the irq13 may arrive after
it is supposed to be shut down.  It should then be masked, but the
shutdown is incomplete, so the irq goes to a null handler that just
reports it as stray.  The fix is to wait a bit after dividing by 0 to
give a good chance of the irq13 being handled by its proper handler.

Removed the hack that was supposed to recover from the incomplete shutdown
of irq13.  The shutdown is now even more incomplete, or perhaps just
incomplete in a different way, but the hack now has no effect because
irq13 is edge triggered and handling of edge triggered interrupts is
now optimized by skipping their masking.  The hack only worked due
to it accidentally not losing races.

The incomplete shutdown of irq13 still allows unprivileged users to
generate a stray irq13 (except on systems where irq13 is actually used)
by unmasking an npx exception and causing one.  The exception gets
handled properly by the exception 16 handler.  A spurious irq13 is
delivered asynchronously but is harmless (as in the probe) because it
is almost perfectly not handled by the null interrupt handler.
Perfectly not handling it involves mainly not resetting the npx busy
latch.  This prevents further irq13's despite them not being masked in
the [A]PIC.
2004-06-06 15:17:44 +00:00
Tim J. Robbins
f99619a0dc Change the types of vn_rdwr_inchunks()'s len and aresid arguments to
size_t and size_t *, respectively. Update callers for the new interface.
This is a better fix for overflows that occurred when dumping segments
larger than 2GB to core files.
2004-06-05 02:18:28 +00:00
Poul-Henning Kamp
fe3ec6224a Manual edits to change linesw[]-frobbing to ttyld_*() calls. 2004-06-04 20:04:52 +00:00
Poul-Henning Kamp
2140d01b27 Machine generated patch which changes linedisc calls from accessing
linesw[] directly to using the ttyld...() functions

The ttyld...() functions ar inline so there is no performance hit.
2004-06-04 16:02:56 +00:00
Poul-Henning Kamp
9130089b9d Use ttymalloc() instead of ttyregister(). 2004-06-04 07:12:45 +00:00
Poul-Henning Kamp
210ca04e81 Automatically recognize the WRAP.1C and Soekris 4801 platforms and configure
LEDS accordingly.
2004-06-03 22:37:45 +00:00
Poul-Henning Kamp
79005bbdbe Add new bios_string() which will hunt for a string inside a given range
of the BIOS.  This can be used for finding arbitrary magic in the BIOS
in order to recognize particular platforms.
2004-06-03 22:36:24 +00:00
Poul-Henning Kamp
02d12d9352 The NatSemi (now AMD) Geode SC1100 needs special treatment here and there
because it is an embedded gadget.  Give it it's own value for the "cpu"
variable and add code to reset it lacking a keyboard controller.
2004-06-03 21:14:53 +00:00
Tim J. Robbins
cc05397ffc Remove checks for curthread == NULL - it can't happen. 2004-06-03 10:22:47 +00:00
Tim J. Robbins
fa2a4d0595 Move TDF_DEADLKTREAT into td_pflags (and rename it accordingly) to avoid
having to acquire sched_lock when manipulating it in lockmgr(), uiomove(),
and uiomove_fromphys().

Reviewed by:	jhb
2004-06-03 01:47:37 +00:00
Tim J. Robbins
aa0aa7a113 Move TDF_SA from td_flags to td_pflags (and rename it accordingly)
so that it is no longer necessary to hold sched_lock while
manipulating it.

Reviewed by:	davidxu
2004-06-02 07:52:36 +00:00
John Baldwin
c9702514c0 - Add a function ioapic_program_intpin() that completely programs an I/O
APIC interrupt pin based on the settings in the corresponding interrupt
  source structure.
- Use ioapic_program_intpin() in place of manual frobbing of the intpin
  configuration in ioapic_program_destination() and ioapic_register().
- Use ioapic_program_intpin() to implement suspend/resume support for I/O
  APICs.
2004-06-01 20:28:42 +00:00
John Baldwin
4468ab0a61 Allow the pir0 device add to fail since pir0 may already exist. This should
fix the panics in device_set_ivars() that people were seeing on boxes with
multiple Host-PCI bridges but not using ACPI.
2004-06-01 19:51:29 +00:00
John Baldwin
d5c5dcf762 Fix legacy_add_child() to properly handle the case where
device_add_child_ordered() fails (due to a duplicate device add for
example) and properly cleanup and return NULL.
2004-06-01 19:50:42 +00:00
John Baldwin
405747db0b Use the local APIC ID rather than the ACPI Processor ID to index the array
of CPUs since local APIC IDs are bounded but ACPI IDs are not bounded.
2004-06-01 19:49:38 +00:00
Poul-Henning Kamp
138fbf675a Gainfully employ the new ttyioctl in the trivial cases. 2004-06-01 13:49:28 +00:00
Nate Lawson
8fb8b5fb27 Remove debugging printf that never triggered because acpi is the first
user of nexus::bus_get_resource.
2004-06-01 01:04:25 +00:00
Bosko Milekic
099a0e588c Bring in mbuma to replace mballoc.
mbuma is an Mbuf & Cluster allocator built on top of a number of
extensions to the UMA framework, all included herein.

Extensions to UMA worth noting:
  - Better layering between slab <-> zone caches; introduce
    Keg structure which splits off slab cache away from the
    zone structure and allows multiple zones to be stacked
    on top of a single Keg (single type of slab cache);
    perhaps we should look into defining a subset API on
    top of the Keg for special use by malloc(9),
    for example.
  - UMA_ZONE_REFCNT zones can now be added, and reference
    counters automagically allocated for them within the end
    of the associated slab structures.  uma_find_refcnt()
    does a kextract to fetch the slab struct reference from
    the underlying page, and lookup the corresponding refcnt.

mbuma things worth noting:
  - integrates mbuf & cluster allocations with extended UMA
    and provides caches for commonly-allocated items; defines
    several zones (two primary, one secondary) and two kegs.
  - change up certain code paths that always used to do:
    m_get() + m_clget() to instead just use m_getcl() and
    try to take advantage of the newly defined secondary
    Packet zone.
  - netstat(1) and systat(1) quickly hacked up to do basic
    stat reporting but additional stats work needs to be
    done once some other details within UMA have been taken
    care of and it becomes clearer to how stats will work
    within the modified framework.

From the user perspective, one implication is that the
NMBCLUSTERS compile-time option is no longer used.  The
maximum number of clusters is still capped off according
to maxusers, but it can be made unlimited by setting
the kern.ipc.nmbclusters boot-time tunable to zero.
Work should be done to write an appropriate sysctl
handler allowing dynamic tuning of kern.ipc.nmbclusters
at runtime.

Additional things worth noting/known issues (READ):
   - One report of 'ips' (ServeRAID) driver acting really
     slow in conjunction with mbuma.  Need more data.
     Latest report is that ips is equally sucking with
     and without mbuma.
   - Giant leak in NFS code sometimes occurs, can't
     reproduce but currently analyzing; brueffer is
     able to reproduce but THIS IS NOT an mbuma-specific
     problem and currently occurs even WITHOUT mbuma.
   - Issues in network locking: there is at least one
     code path in the rip code where one or more locks
     are acquired and we end up in m_prepend() with
     M_WAITOK, which causes WITNESS to whine from within
     UMA.  Current temporary solution: force all UMA
     allocations to be M_NOWAIT from within UMA for now
     to avoid deadlocks unless WITNESS is defined and we
     can determine with certainty that we're not holding
     any locks when we're M_WAITOK.
   - I've seen at least one weird socketbuffer empty-but-
     mbuf-still-attached panic.  I don't believe this
     to be related to mbuma but please keep your eyes
     open, turn on debugging, and capture crash dumps.

This change removes more code than it adds.

A paper is available detailing the change and considering
various performance issues, it was presented at BSDCan2004:
http://www.unixdaemons.com/~bmilekic/netbuf_bmilekic.pdf
Please read the paper for Future Work and implementation
details, as well as credits.

Testing and Debugging:
    rwatson,
    brueffer,
    Ketrien I. Saihr-Kesenchedra,
    ...
Reviewed by: Lots of people (for different parts)
2004-05-31 21:46:06 +00:00
Poul-Henning Kamp
77409fe148 Add missing #include <sys/module.h> 2004-05-30 20:34:58 +00:00
Poul-Henning Kamp
41ee9f1c69 Add some missing <sys/module.h> includes which are masked by the
one on death-row in <sys/kernel.h>
2004-05-30 17:57:46 +00:00
Poul-Henning Kamp
a041b840d2 struct cpu_nameclass is a private to identcpu.c, move it there. 2004-05-30 15:16:07 +00:00
Alan Cox
662d471da6 Remove a broken micro-optimization from pmap_enter(). The ill effect
of this micro-optimization occurs when we call pmap_enter() to wire an
already mapped page.  Because of the micro-optimization, we fail to
mark the PTE as wired.  Later, on teardown of the address space,
pmap_remove_pages() destroys the PTE before vm_fault_unwire() has
unwired the page.  (pmap_remove_pages() is not supposed to destroy
wired PTEs.  They are destroyed by a later call to pmap_remove().)
Thus, the page becomes lost.

Note: The page is not lost if the application called munlock(2), only
if it relies on teardown of the address space to unwire its pages.

For the historically inclined, this bug was introduced by a
megacommit, revision 1.182, roughly six years ago.

Leak observed by: green@ and dillon independently
Patch submitted by: dillon at backplane dot com
Reviewed by: tegge@
MFC after: 1 week
2004-05-28 19:42:02 +00:00
John Baldwin
543e27a95b Reenable ithread preemption for interrupts that occur while executing in
the kernel.  I accidentally broke this with the new interrupt code that
came in prior to 5.2.

Submitted by:	bde
2004-05-28 17:50:07 +00:00
Tony Ackerman
e03f8cdc4f First release of ixgb driver for the Intel(R) PRO/10GbE Family of Adapters. This driver has
been developed for use with FreeBSD, version 4.8 and later.

Submitted by:	Hema Joyce
Reviewed by: 	Prafulla Deuskar
Approved by: 	Prafulla Deuskar
MFC after:	1 week
2004-05-28 00:23:00 +00:00
Thomas Moestl
65e29c4822 Retire cpu_sched_exit(); it is not used any more. 2004-05-26 12:09:39 +00:00
Bruce Evans
026afdcc05 Quick fix for overflow when tsc_freq >= 2^31. "int profrate" in struct
gmon and struct gmonhdr was originally just to represent the kernel
(profiling) clock frequency and it remains poorly suited to representing
the frequencies of fast counters like the TSC.  It broke a year or two
ago.  This quick fix keeps it working for another year or month or two
until TSC frequencies can exceed 2^32, by dividing the frequency by 2.
Dividing the frequency by 4 would work for a little longer but would
lose a little too much precision.
2004-05-26 09:43:38 +00:00
Bruce Evans
30346936cf MFamd64:
Fixed profiling of trap, syscall and interrupt handlers and some
ordinary functions, essentially by backing out half of rev.1.106 of
i386/exception.s.  The handlers must be between certain labels for
the purposes of profiling, and this was broken by scattering them in
separately compiled .s files, especially for ordinary functions that
ended up between the labels.  Merge the files by #including them as
before, except with different pathnames and better comments and
organization.  Changes to the scattered files are minimal -- just
move the labels to the file that does the #includes.

This also partly fixes profiling of IPIs -- all IPI handlers are now
correctly classified as interrupt handlers, but many are still missing
mcount calls.

vm86bios.s is included as before, but it is now between the labels for
interrupt handlers again, which seems to be wrong since half of it is
for a non-interrupt handler.
2004-05-26 07:43:41 +00:00
John Baldwin
87ca48b6b8 Revert part of rev 1.230 and assume that all EISA IRQs use active high
polarity rather than assuming that level triggered IRQs use active low and
edge triggered IRQs use active high.  Both the MultiProcessor 1.4
and ACPI 2.0 Specifications state in their examples that level triggered
EISA IRQs are active low, but in practice they seem to be active high.

Reported by:	Nik Azim Azam nskyline_r35 at yahoo dot com
2004-05-24 15:51:46 +00:00
Bruce Evans
c39f62a459 MFamd64 (1.117: made the FAKE_MCOUNT() in doreti work non-accidentally,
and removed buggy unnecessary FAKE_MCOUNT() in calltrap).
2004-05-23 17:25:46 +00:00
Bruce Evans
6670fdb155 MFamd64 (put TF_EIP in assym.s and use it instead of a magic offset in
FAKE_MCOUNT()s).
2004-05-23 16:50:55 +00:00
Bruce Evans
c94dd84382 MFamd64 (1.111: fixed missing call to .mexitcount in lgdt()). 2004-05-23 15:37:21 +00:00
Bruce Evans
912f07a626 Updated and reorganized the comments for the fetch and store families of
functions.
2004-05-21 16:08:26 +00:00
Bruce Evans
2151041f22 Fixed high resoultion profiling of fuword32() and suword32(). Use the
standard macro ALTENTRY() instead of a home made incomplete version
of it.
2004-05-21 16:01:54 +00:00
Bruce Evans
e77c22bf45 Moved i386 asms to an i386 header. The asms are for calibration of
high resolution kernel profiling (options GUPROF.  "U" in GUPROF stands
for microseconds resolution, but the resolution is now smaller than 1
nanosecond on multi-GHz machines and the accuracy is heading towards
1 nanosecond too).  Arches that support GUPROF must now provide certain
macros for the calibration.  GUPROF is now only supported for i386's,
so the absence of the new macros for other arches doesn't break anything
that wasn't already broken.  amd64's have uncommitted support for
GUPROF, and sparc64's have support that seems to be complete except
here (there was an #error for non-i386 cases; now there are undefined
macros).

Changed the asms a little:
- declare them as __volatile.  They must not be moved, and exporting a
  label across asms is technically incorrect, so try harder to stop gcc
  moving them.
- don't put the non-clobbered register "bx" in the clobber list.  The
  clobber lists are still more conservative than necessary.
- drop the non-support for gcc-1.  It just gave a better error message,
  and this is not useful since compiling with gcc-1 would cause thousands
  of worse error messages.
- drop the support for aout.
2004-05-20 16:12:19 +00:00
Bruce Evans
19b5915afa Fixed some style bugs (mainly misalignment of backslashes). 2004-05-19 16:04:26 +00:00
Bruce Evans
b2321e7cdb Moved most of the "MI" definitions and declarations from <machine/profile.h>
to <sys/gmon.h>.  Cleaned them up a little by not attempting to ifdef
for incomplete and out of date support for GUPROF in userland, as in
the sparc64 version.
2004-05-19 15:41:26 +00:00
Stefan Farfeleder
b1aa0ba527 <stdint.h> should define WINT_M{AX,IN} independent from whether WCHAR_MIN is
defined.  Otherwise first including <wchar.h> and then <stdint.h> leads to no
WINT_M{AX,IN} at all.

PR:		64956
Approved by:	das (mentor)
2004-05-18 16:04:57 +00:00
Roman Kurakin
7d092c8fab Add Cronyx Tau-PCI sync WAN adapters family entry. 2004-05-17 14:42:59 +00:00
Roman Kurakin
0f71e346a1 Spell Cronyx Tau and Sigma families correctly.
MFC after:	3 days
2004-05-17 14:35:32 +00:00
Peter Wemm
e8855d4f97 Make a small revision to the api between the elf linker core and the
elf_reloc() backends for two reasons.  First, to support the possibility
of there being two elf linkers in the kernel (eg: amd64), and second, to
pass the relocbase explicitly (for relocating .o format kld files).
2004-05-16 20:00:28 +00:00
John Baldwin
a894993de1 - Move some macros from icu.h into atpic.c as that is the only place they
are used.
- Reduce duplication of a couple of macros removing the duplicates from
  ich.h.
- Remove unused macros from icu.h as well as locore protection as this
  header is no longer included in assembly sources.
2004-05-11 20:23:24 +00:00
John Baldwin
d4d4ece72d Trim unused includes. 2004-05-11 20:14:53 +00:00
John Baldwin
96025496cf - Remove a spurious blank line.
- Add a missing static keyword.
2004-05-11 20:06:55 +00:00
John Baldwin
175af5d978 Fixup a few bogons in a comment. 2004-05-11 20:06:32 +00:00
John Baldwin
eb8943b13e Rework the APIC mixed mode support a bit:
- Require the APIC enumerators to explicitly enable mixed mode by calling
  ioapic_enable_mixed_mode().  Calling this function tells the apic driver
  that the PC-AT 8259A PICs are present and routable through the first I/O
  APIC via an ExtINT pin.  The mptable enumerator always calls this
  function for now.  The MADT enumerator only enables mixed mode if the
  PC-AT compatability flag is set in the MADT header.
- Allow mixed mode to be enabled or disabled via a 'hw.apic.mixed_mode'
  tunable.  By default this tunable is set to 1 (true).  The kernel option
  NO_MIXED_MODE changes the default to 0 to preserve existing behavior, but
  adding 'hw.apic.mixed_mode=0' to loader.conf achieves the same effect.
- Only use mixed mode to route IRQ 0 if it is both enabled by the APIC
  enumerator and activated by the loader tunable.  Note that both
  conditions must be true, so if the APIC enumerator does not enable mixed
  mode, then you can't set the tunable to try to override the enumerator.
2004-05-10 18:49:58 +00:00
John Baldwin
ffe2232b31 - Simplify the sizeof expression in the CTASSERT() for NUM_ISA_IRQS.
- Fixup grammar in a comment.

Submitted by:	bde (1)
2004-05-10 18:33:52 +00:00
John Baldwin
0fd166d7da - Change madt_map_table() to verify the checksum of any table it is asked
to map.  If the checksum fails, the table is unmapped and a NULL pointer
  returned.
- For ACPI version >= 2.0, check the extended checksum of the RSDP.
  AcpiOsGetRootPointer() already checks the version 1.0 checksum.
- Remap the full MADT table at the end of madt_probe() so that we verify
  its checksum before saying it is really there.

Requested by:	njl
2004-05-10 18:33:08 +00:00
David E. O'Brien
9c4b841b67 We don't support USB devices in PAE mode, so catch up with GENERIC rev 1.402. 2004-05-10 14:23:36 +00:00
Nate Lawson
88d2c61ee8 Move the CPU newbus attachment to i386 legacy. The acpi_cpu device will
become just "cpu" and provide attachments in the !legacy case.

Tested by:	des
2004-05-06 15:54:02 +00:00
Yoshihiro Takahashi
304a8159e9 Fixed PC98 support.
- Disable an ELCR on PC98.
 - Correct IRQs.
2004-05-06 13:48:34 +00:00
Yoshihiro Takahashi
3e48fb44a8 Disable an EISA support on PC98. 2004-05-06 13:45:45 +00:00
Nate Lawson
869ec176fc Make unnecessary globals static and remove unused includes.
Pointed out by:	cscout
2004-05-06 02:18:58 +00:00
Nate Lawson
65a7c90189 Add an MI implementation of the ACPI global lock routines and retire the
individual asm versions.  The global lock is shared between the BIOS and
OS and thus cannot use our mutexes.  It is defined in section 5.2.9.1 of
the ACPI specification.

Reviewed by:	marcel, bde, jhb
2004-05-05 20:04:14 +00:00
Nate Lawson
c6c9ee90fb Style cleanups, u_intXX -> uintXX. 2004-05-05 19:51:15 +00:00
Maxime Henrion
601ae596e7 Unbreak kernel build in the !apic case. We moved to using enums for
setting the polarity and the trigger mode of interrupts.

Tested by:	Mark Santcroos, Russell Jackson, Christian Hiris
2004-05-05 12:39:02 +00:00
John Baldwin
7a64d8d74c - Create a pir0 psuedo device as a child of legacy0 if we attach a legacy
host-PCI bridge device and find a valid $PIR.
- Make pci_pir_parse() private to pci_pir.c and have pir0's attach routine
  call it instead of having legacy_pcib_attach() call it.
- Implement suspend/resume support for the $PIR by giving pir0 a resume
  method that calls the BIOS to reroute each link that was already routed
  before the machine was suspended.
- Dump the state of the routed flag in the links display code.
- If a link's IRQ is set by a tunable, then force that link to be re-routed
  the first time it is used.
- Move the 'Found $PIR' message under bootverbose as the pir0 description
  line lists the number of entries already.  The pir0 line also only shows
  up if we are actually using the $PIR which is a bonus.
- Use BUS_CONFIG_INTR() to ensure that any IRQs used by a PCI link are
  set to level/low trigger/polarity.
2004-05-04 21:17:52 +00:00
John Baldwin
635af77a22 Have ACPI use BUS_CONFIG_INTR() to force the SCI to level trigger and
active low polarity when using the PIC interrupt model.  This should fix
broken SCI interrupts on machines when not using the APIC where the BIOS
doesn't program the ELCR to level trigger for the ACPI SCI.

Requested by:	njl
2004-05-04 21:04:24 +00:00
John Baldwin
4b1df14c60 - Add a new pic method pic_config_intr() to set the trigger mode and
polarity for a specified IRQ.  The intr_config_intr() function wraps
  this pic method hiding the IRQ to interrupt source lookup.
- Add a config_intr() method to the atpic(4) driver that reconfigures
  the interrupt using the ELCR if possible and returns an error otherwise.
- Add a config_intr() method to the apic(4) driver that just logs any
  requests that would change the existing programming under bootverbose.
  Currently, the only changes the apic(4) driver receives are due to bugs
  in the acpi(4) driver and its handling of link devices, hence the reason
  for such requests currently being ignored.
- Have the nexus(4) driver on i386 implement the bus_config_intr() function
  by calling intr_config_intr().
2004-05-04 21:02:56 +00:00
John Baldwin
c2ce35977e - Change the APIC code to mostly use the recently added intr_trigger
and intr_polarity enums for passing around interrupt trigger modes and
  polarity rather than using the magic numbers 0 for level/low and 1 for
  edge/high.
- Convert the mptable parsing code to use the new ELCR wrapper code rather
  than reading the ELCR directly.  Also, use the ELCR settings to control
  both the trigger and polarity of EISA IRQs instead of just the trigger
  mode.
- Rework the MADT's handling of the ACPI SCI again:
  - If no override entry for the SCI exists at all, use level/low trigger
    instead of the default edge/high used for ISA IRQs.
  - For the ACPI SCI, use level/low values for conforming trigger and
    polarity rather than the edge/high values we use for all other ISA
    IRQs.
  - Rework the tunables available to override the MADT.  The
    hw.acpi.force_sci_lo tunable is no longer supported.  Instead, there
    are now two tunables that can independently override the trigger mode
    and/or polarity of the SCI.  The hw.acpi.sci.trigger tunable can be
    set to either "edge" or "level", and the hw.acpi.sci.polarity tunable
    can be set to either "high" or "low".  To simulate hw.acpi.force_sci_lo,
    set hw.acpi.sci.trigger to "level" and hw.acpi.sci.polarity to "low".
    If you are having problems with ACPI either causing an interrupt storm
    or not working at all (e.g., the power button doesn't turn invoke a
    shutdown -p now), you can try tweaking these two tunables to find the
    combination that works.
2004-05-04 20:39:24 +00:00
John Baldwin
7e4af296b3 - Add a member to the atpic interrupt source structures to indicate if the
IRQ is edge triggered or level triggered.  For ISA interrupts, we assume
  that edge triggered interrupts are always active high and that level
  triggered interrupts are always active low.
- Don't disable an edge triggered interrupt in the PIC.  This avoids
  outb instructions to the actual PIC for traditional ISA IRQs such as
  IRQ 1, 6, 14, and 15.  (Fast interrupts such as IRQs 0 and 8 don't mask
  their source, so this doesn't change anything for them.)
- For MCA systems we assume that all interrupts are level triggered and
  thus need masking.  Otherwise, we probe the ELCR.  If it exists we trust
  what it tells us regarding which interrupts are level triggered.  If it
  does not exist, we assume that IRQs 0, 1, 2, and 8 are edge triggered
  and that all other IRQs are level triggered and need masking.
- Instruct the ELCR mini-driver to restore its saved state during resume.
2004-05-04 20:12:52 +00:00
John Baldwin
030b156bf0 Add a simple mini-driver for the ELCR register. Originally, the ELCR
register controlled the trigger mode and polarity of EISA interrupts.
However, it appears that most (all?) PCI systems use the ELCR to manage
the trigger mode and polarity of ISA interrupts as well since ISA IRQs used
to route PCI interrupts need to be level triggered with active low
polarity.  We check to see if the ELCR exists by sanity checking the value
we get back ensuring that IRQS 0 (8254), 1 (atkbd), 2 (the link from the
slave PIC), and 8 (RTC) are all clear indicating edge trigger and active
high polarity.

This mini-driver will be used by the atpic driver to manage the trigger and
polarity of ISA IRQs.  Also, the mptable parsing code will use this mini
driver rather than examining the ELCR directly.
2004-05-04 20:07:46 +00:00
Yoshihiro Takahashi
7dca3f1761 Increase BUS_SPACE_IAT_MAXSIZE to 33 for the ed driver. 2004-05-04 06:38:13 +00:00
John Baldwin
9758c1309c - Add an IMEN_MASK macro that returns the 8-bit bitmask of an atpic
interrupt source.
- Only do an outb() to the PIC to clear a bit in imen if the bit is set.
- Add a NUM_ISA_IRQS macro to replace uglier
  'sizeof(array) / sizeof(member)' expressions along with a CTASSERT() to
  ensure that the macro is correct.
2004-05-03 14:52:41 +00:00
John Baldwin
be16306ad3 Make the legacy_pcib_attach() function static. 2004-05-03 14:49:43 +00:00
John Baldwin
4f9e7c8b00 Use a private attach method for the MP Table host-PCI bridge driver rather
than using legacy_pcib_attach().  The MP Table drivers don't use the $PIR,
and the legacy_pcib_attach() function probes and parses the $PIR in
addition to adding the pci bus child device.
2004-05-03 14:49:10 +00:00
Marcel Moolenaar
d1d9feac7c Add option GEOM_GPT. This brings the ability to have a large number of
partitions on a single disk.
2004-05-02 20:40:19 +00:00
David E. O'Brien
4e744b5e7f Spell Ethernet correctly. 2004-05-02 18:57:29 +00:00
Bruce Evans
b3f32d172b Remove old cy driver files. They have been repo-copied to sys/dev/cy and
sys/dev/ic and adjusted to work there.
2004-05-02 05:38:49 +00:00
Bruce Evans
e0871faf17 Switch to using the moved cy driver (adjust pathnames and remove "count"
parameter).

Keep using it only in the i386 NOTES for now.  It is fairly MI, but it
doesn't use bus-space and has a couple of i386 i/o instructions in pci
intitialization.
2004-05-02 05:21:29 +00:00
John Baldwin
f9acc6410e - The i8254 uses IRQ 0, not IRQ 8. Correct i8254_intsrc to reference the
correct interrupt source.
- Cache a pointer to the i8254_intsrc's pending method to avoid several
  pointer indirections in i8254_get_timecount().

Reported by:	bde
2004-04-27 20:03:26 +00:00
John Baldwin
5cf1e92001 Belatedly remove a file from the earlier apic code that is no longer used. 2004-04-27 19:37:17 +00:00
Poul-Henning Kamp
a2e4145b35 Make sure we are all set up before creating the LED instance. 2004-04-27 13:08:03 +00:00
Maxim Sobolev
e99eef3d4f Add rue(4) USB ethernet driver, which for some reason has been missed. 2004-04-26 22:52:09 +00:00
David Schultz
be3930682a Hide FLT_EVAL_METHOD and DECIMAL_DIG in pre-C99 compilation
environments.

PR:		63935
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2004-04-25 02:36:29 +00:00
Philip Paeps
647e5349ec Enable the led-toggling magic. Compiling files which are in the kernel into
modules is a very nice way to produce hard-to-find panics.  Who would look for
a bug in a Makefile anyway?

Has anyone seen the pointy hat? :-o

Approved by:	njl (mentor)
2004-04-23 17:41:05 +00:00
Philip Paeps
9a1fc77e3a Add the ACPI Asus extras driver. Provides support for cool ACPI-controled
gadgets (hotkeys, lcd, ...) on Asus laptops.  I aim to closely track the
acpi4asus project which implements these features in the Linux kernel.

If this breaks your laptop, please let me know how it does it :-)

Approved by:	njl (mentor)
2004-04-22 21:29:02 +00:00
Warner Losh
22391e1540 Remove npx(4) reference for isa. While true, it is useless (since
there are a lot of other dependencies that preclude the kernel from
working).  Instead, have a more generic note that isa should not be
removed.  This should be less confusing for users.
2004-04-22 15:17:39 +00:00
Nate Lawson
8ec94874b2 Don't check for NULL, device_get_softc() always succeeds. 2004-04-21 02:10:58 +00:00
David E. O'Brien
f29a68407b Use BSD spelling vs. SysV. 2004-04-19 18:38:04 +00:00
John Baldwin
f203f177f4 Revert part of the "BIOS brain damage" from rev 1.10. It seems that
different BIOSs use the same exact settings to mean two very different and
incompatible things for the SCI.  Thus, if the SCI is remapped to a PCI
interrupt, we now trust the trigger/polarity that the MADT provides by
default.  However, the SCI can be forced to level/lo as 1.10 did by setting
the tunable "hw.acpi.force_sci_lo" to a non-zero value from the loader.

Thus, if rev 1.10 caused an interrupt storm, it should nwo fix your
machine.  If rev 1.10 fixed an interrupt storm on your machine, you
probably need to set the aforementioned tunable in /boot/loader.conf to
prevent the interrupt storm.

The more general problem of getting the SCI's trigger/polarity programmed
"correctly" (for some value of correctly meaning several workarounds for
broken BIOSs and inconsistent "implementations" of the ACPI standard) is
going to require more work, but this band-aid should improve the current
situation somewhat.

Requested by:	njl
2004-04-16 19:46:30 +00:00
John Baldwin
79cdd799f6 Use %eax rather than %ax when loading segment registers to avoid partial
register stalls.

Reviewed by:	bde (a while ago, and I think an earlier version)
2004-04-16 19:26:37 +00:00
John Baldwin
86f4fd6f71 Don't call the BIOS to route a link that has already been routed by the
BIOS during POST as it apparently makes some machines unhappy.

Tested by:	mux
2004-04-16 18:54:05 +00:00
Eivind Eklund
4d3f164c01 Improve comment (SMB bus -> System Management Bus) 2004-04-16 09:29:45 +00:00
David E. O'Brien
a29628bc28 Move ENABLE_ALART to proper place.
Submitted by:	bde
2004-04-16 05:59:08 +00:00
Josef El-Rayes
2e30742814 Add note that npx depends on isa.
Approved by:	green
2004-04-15 15:11:04 +00:00
Nate Lawson
96d340f27d Use METHOD_VIDEO instead of the method string itself.
Pointed out by:	Andrew Thompson
2004-04-14 03:32:01 +00:00
Warner Losh
d9c060ad52 sx was randomly added to NOTES. Instead, place it in the misc
hardware in properly sorted order.  Fix a little disorder while I'm
here.

Submitted by: bde
2004-04-14 02:25:31 +00:00
Nate Lawson
0287be96bf Add support for video output switching. It appears no systems use HCI to
change the video output but use a separate device with a DSSX method
and a HID of "TOS6201" instead.  We use a pseudo-driver to get the handle
for this object and pass it to the acpi_toshiba driver.

This is untested but seems to match the Linux Toshiba driver.
2004-04-14 00:23:58 +00:00
Yoshihiro Takahashi
8b29c1a01e Enable the sx driver on i386 and pc98. 2004-04-13 14:04:25 +00:00
Dag-Erling Smørgrav
242c1bb631 Use headers from the kernel source tree rather than installed headers.
Submitted by:	ru
2004-04-13 13:43:11 +00:00
Warner Losh
a844e89f9c Move sx to i386/NOTES for the moment. I missed the
enable/disable_intr() in the code.
2004-04-12 02:36:51 +00:00
Alan Cox
2c38d78e41 - is_physical_memory()'s parameter, which is a physical address, should be
a vm_paddr_t not a vm_offset_t.
2004-04-11 04:26:58 +00:00
Alan Cox
0af0eeacb6 - pmap_kenter_temporary()'s first parameter, which is a physical address,
should be declared as vm_paddr_t not vm_offset_t.
2004-04-10 23:28:49 +00:00
Alan Cox
b14d6acced - pmap_kenter_temporary() is unused by machine-independent code. Therefore,
move its declaration to the machine-dependent header file on those
   machines that use it.  In principle, only i386 should have it.
   Alpha and AMD64 should use their direct virtual-to-physical mapping.
 - Remove pmap_kenter_temporary() from ia64.  It is unused.  Approved
   by: marcel@
2004-04-10 22:41:46 +00:00
Mark Murray
4ebf3fc96b I hate noticing bugs after committing. :-(
ALWAYS set up the CPU base identity string. THEN optionally
add features.
2004-04-09 17:00:03 +00:00
Mark Murray
c97ed2df4e Add extra output to show when VIA C3 Nehemiah CPUs have hardware
Random Number Generator (RNG) and/or Advanced Cryptography Engine
(ACE).
2004-04-09 15:01:44 +00:00