Commit Graph

3937 Commits

Author SHA1 Message Date
Peter Wemm
c15e347e22 GC the unused <machine/kse.h> file. 2003-12-24 00:51:30 +00:00
Peter Wemm
9b68618df0 Add an additional field to the elf brandinfo structure to support
quicker exec-time replacement of the elf interpreter on an emulation
environment where an entire /compat/* tree isn't really warranted.
2003-12-23 02:42:39 +00:00
Alan Cox
925692caa5 - Significantly reduce the number of preallocated pv entries in
pmap_init().  Such a large preallocation is unnecessary and wastes
   nearly eight megabytes of kernel virtual address space per gigabyte
   of managed physical memory.
 - Increase UMA_BOOT_PAGES by two.  This enables the removal of
   pmap_pv_allocf().  (Note: this function was only used during
   initialization, specifically, after pmap_init() but before
   pmap_init2().  During pmap_init2(), a new allocator is installed.)
2003-12-22 01:01:32 +00:00
Alan Cox
35833d6a20 Since we have additional kernel virtual address space, allow the buffer
cache to grow to 400M bytes.
2003-12-20 20:03:10 +00:00
Peter Wemm
d50c65bfce MFi386: remove APIC_IRQ* defines that are no longer used. 2003-12-11 02:48:25 +00:00
Peter Wemm
bf342084e5 MFi386: (jhb): Deal with MAXCPU etc correctly 2003-12-11 02:47:35 +00:00
David E. O'Brien
70005bdb38 Add just enough of i386/include/pcvt_ioctl.h to amd64/include/pcvt_ioctl.h
such that 'ispcvt' can build.  Unforunately 'ispcvt' is needed in order for
/etc/rc.d/syscons to run.  This fixes the bug where I could not get my
keymap effective at boot.
2003-12-10 02:49:17 +00:00
Nate Lawson
cac6460cfe Use the ACPI-CA definitions for the various APIC tables instead of our
own.
2003-12-09 03:04:19 +00:00
Alan Cox
4d4a286cba Increase VM_KMEM_SIZE_MAX from 200MB to 400MB.
Discussed with:	peter
2003-12-07 04:51:04 +00:00
Peter Wemm
3db6450423 Reconfigure the runq macros to use the 64 bit ffs/bsf routines instead
of doing a loop and taking two 32 bit passes at the runqueue bits.  All
the 64 bit platforms should probably do this since there are 64 run queues.

Approved by:  re (scottl)
2003-12-06 23:24:18 +00:00
Peter Wemm
176ce2b1f4 Add 64 bit bsf*/ffs* routines. Have the ffs() inline use gcc's builtin
because it uses the better cmove instructions to avoid branches.
2003-12-06 23:22:43 +00:00
Peter Wemm
21616ec307 Various whitespace and cosmetic sync-up's with i386.
Approved by:  re (scottl)
2003-12-06 23:19:47 +00:00
Peter Wemm
90be5e4e7d amd64_protection_init and the protection_codes[] array was overkill.
Inline it instead.

Approved by:  re (scottl)
2003-12-06 23:18:42 +00:00
Peter Wemm
62b689edc9 Kill the ASM versions of the mtx_lock_spin and friends. They were never
used on amd64, and were actually totally broken.  They had the wrong
calling conventions.  I believe the i386 versions are going away too.

Approved by:  re (scottl)
2003-12-06 23:17:18 +00:00
Peter Wemm
cfef943682 MFi386: put the apic disable hook in a better place.
Approved by:  re (scottl)
2003-12-06 23:14:44 +00:00
Peter Wemm
42f5377536 Revert some amd64 changes that cached curthread and converge back to the
i386 version.  The curthread special case in pcpu.h solves my complaint
about the verbose macro expansion in this case.  Note that the i386
version still has some OBE comments, I didn't re-add them back again.

Approved by:  re (scottl)
2003-12-06 23:13:22 +00:00
John Baldwin
b6c71225a9 Fix all users of mp_maxid to use the same semantics, namely:
1) mp_maxid is a valid FreeBSD CPU ID in the range 0 .. MAXCPU - 1.
2) For all active CPUs in the system, PCPU_GET(cpuid) <= mp_maxid.

Approved by:	re (scottl)
Tested on:	i386, amd64, alpha
2003-12-03 14:57:26 +00:00
Peter Wemm
3554ecf032 Catch up with the procsig locking changes elsewhere. We were doing
things like copyin/out with psp->ps_mtx held.  That was not good.

Approved by:  re (scottl)
2003-12-03 07:00:30 +00:00
Peter Wemm
98248357d4 Add an additional knob to just disable the apic code without also having
to resort to disabling acpi as well.  I'll document this in the release
notes for amd64.

Approved by: re (scottl)
2003-12-03 06:58:48 +00:00
Jeff Roberson
28c6f1ae42 - Make mp_maxid reflect the same meaning as it does on other architectures.
It is one past the last valid cpuid.  This relied on a different bug in
   UMA to work properly.

Reported/Tested by:	phk
Approved by:		rwatson
2003-11-30 22:20:40 +00:00
Peter Wemm
4c7452eb27 Fix i386 apic support merge botch. sizeof(long) is 8, not 4. This fixes
the annoying 'sysctl: hw.intrcnt: out of memory' error message in systat.

Approved by:  re (rwatson)
2003-11-27 17:20:44 +00:00
Peter Wemm
9972cccea4 Argh! The Athlon64 and Opteron only implement 40 bits of address space in
the MTRR Base/Mask registers.  If you use the documented algorithm in the
systems programming guide, you'll get a GPF. The only thing that has
prevented this so far is that the bios pre-sets some MTRR entries which
we mis-interpreted sufficiently to fool the memcontrol interface into
thinking all the address space was taken and therefore rejected XFree86's
requests.  However, not all bioses do this..  You get an insta-panic in
that case.  Grrr.  A better fix (dynamic mask) will happen by 5.3/5-stable
so that we automatically adapt to more than 40 physical bits.

Approved by:  re (scottl)
2003-11-22 01:11:07 +00:00
John Baldwin
798a45964d - Split cpu_mp_probe() into two parts. cpu_mp_setmaxid() is still called
very early (SI_SUB_TUNABLES - 1) and is responsible for setting mp_maxid.
  cpu_mp_probe() is now called at SI_SUB_CPU and determines if SMP is
  actually present and sets mp_ncpus and all_cpus.  Splitting these up
  allows an architecture to probe CPUs later than SI_SUB_TUNABLES by just
  setting mp_maxid to MAXCPU in cpu_mp_setmaxid().  This could allow the
  CPU probing code to live in a module, for example, since modules
  sysinit's in modules cannot be invoked prior to SI_SUB_KLD.  This is
  needed to re-enable the ACPI module on i386.
- For the alpha SMP probing code, use LOCATE_PCS() instead of duplicating
  its contents in a few places.  Also, add a smp_cpu_enabled() function
  to avoid duplicating some code.  There is room for further code
  reduction later since much of this code is also present in cpu_mp_start().
- All archs besides i386 still set mp_maxid to the same values they set it
  to before this change.  i386 now sets mp_maxid to MAXCPU.

Tested on:	alpha, amd64, i386, ia64, sparc64
Approved by:	re (scottl)
2003-11-21 22:23:26 +00:00
Peter Wemm
68cd0cc3c4 Turn on NO_MIXED_MODE for amd64 generic. It turns out that all the
known samples of broken chipsets that needed mixed mode in the first place
are so broken (ie: locks up) that we can't use IO APIC mode at all and it
needs to be turned off in the bios.  So, the MIXED_MODE penalty on the
good chipsets gained nothing.

Approved by:  re (scottl)
2003-11-21 03:19:59 +00:00
Peter Wemm
cda078658e Cosmetic and/or trivial sync up with i386.
Approved by:  re (rwatson)
2003-11-21 03:02:00 +00:00
Peter Wemm
014a9c6e58 MFi386 rev 1.54 (jhb): Add interrupts that are actually available to the
resource manager, rather than adding everything.

Approved by:  re (scottl)
2003-11-21 03:00:05 +00:00
Peter Wemm
dd9a634b8a MFi386: pre-register idt slots for atpic so we catch any strays without
blowing up.

Approved by:  re (scottl)
2003-11-21 02:58:26 +00:00
Peter Wemm
108d22fa65 MFi386 rev 1.207 (phk): Don't mistakenly disable the TSC when using
statclock_disable.

Approved by:  re (scottl)
2003-11-21 02:53:49 +00:00
Peter Wemm
b4bae2b0c5 Argh! Followup to previous commit. I checked in the patch with an
unintended local change.  Change Xurthread back to curthread.
2003-11-20 23:49:28 +00:00
Peter Wemm
5dd883833c Provide a streamlined '#define curthread __curthread()' for amd64 to avoid
the compiler having to parse and optimize the PCPU_GET(curthread) so often.
__curthread() is an inline optimized version of PCPU_GET(curthread) that
knows that pc_curthread is at offset zero in the pcpu struct.  Add a
CTASSERT() to catch any possible changes to this.  This accounts for
just over a 1% wall clock speedup for total kernel compile/link time,
and 20% compile time speedup on some specific files depending on which
compile options are used.

Approved by:  re (jhb)
2003-11-20 22:54:44 +00:00
Peter Wemm
b8aeddf146 Sync with i386.
- turn on SMP in generic
- add 'device atpic' - this is unconditional on i386, but certain nvidia
  based systems need to disable acpi because the reference bios seems to be
  hosed.  If acpi is disabled, we won't find the apic.  amd64 has the
  mptable code in a seperate compile option as well.
- turn sym back on, it doesn't fail to compile anymore.

Approved by: re
2003-11-19 18:11:27 +00:00
Peter Wemm
ef3c5c9015 Add SMP changes as should have been committed as rev 1.28 2003-11-17 09:19:12 +00:00
Peter Wemm
07cda73444 Restore file accidently killed in the crossfire from the smp commit. 2003-11-17 09:11:04 +00:00
Peter Wemm
0d2a298904 Initial landing of SMP support for FreeBSD/amd64.
- This is heavily derived from John Baldwin's apic/pci cleanup on i386.
- I have completely rewritten or drastically cleaned up some other parts.
  (in particular, bootstrap)
- This is still a WIP.  It seems that there are some highly bogus bioses
  on nVidia nForce3-150 boards.  I can't stress how broken these boards
  are.  I have a workaround in mind, but right now the Asus SK8N is broken.
  The Gigabyte K8NPro (nVidia based) is also mind-numbingly hosed.
- Most of my testing has been with SCHED_ULE.  SCHED_4BSD works.
- the apic and acpi components are 'standard'.
- If you have an nVidia nForce3-150 board, you are stuck with 'device
  atpic' in addition, because they somehow managed to forget to connect the
  8254 timer to the apic, even though its in the same silicon!  ARGH!
  This directly violates the ACPI spec.
2003-11-17 08:58:16 +00:00
Peter Wemm
0469a9ecfd Oh, how embarresing. I broke my own platform. :-) 2003-11-17 07:50:59 +00:00
Peter Wemm
0bfbe7b935 Widen the enable/disable helper function's argument in line with the
ithread_create() changes etc.  This should be mostly a NOP.
2003-11-17 06:10:15 +00:00
Bruce Evans
6a0d1abc5d Fixed pedantic warnings for statement-expressions using __extension__
and by not using a statement-expression for the non-expression
__PCPU_SET().
2003-11-17 04:40:58 +00:00
Bruce Evans
81bbee5996 Fixed a pedantic syntax error (a stray semicolon at the end of
PCPU_MD_FIELDS).
2003-11-17 03:40:41 +00:00
Alan Cox
0ec3db3072 - Remove unnecessary synchronization from sf_buf_init(). (There is only
one active CPU when sf_buf_init() is performed.)
2003-11-16 23:40:06 +00:00
Alan Cox
e45db9b837 - Modify alpha's sf_buf implementation to use the direct virtual-to-
physical mapping.
 - Move the sf_buf API to its own header file; make struct sf_buf's
   definition machine dependent.  In this commit, we remove an
   unnecessary field from struct sf_buf on the alpha, amd64, and ia64.
   Ultimately, we may eliminate struct sf_buf on those architecures
   except as an opaque pointer that references a vm page.
2003-11-16 06:11:26 +00:00
Bruce Evans
416ab90e6b Localized the cy driver's locking. 2003-11-16 00:55:54 +00:00
Nate Lawson
b72e9cf526 Add the pc_acpi_id PCPU member. The new acpi_cpu driver uses this to
dereference the softc.
2003-11-15 18:58:29 +00:00
Peter Wemm
1f6c75db0b Preemptively burn a bridges. The isa timer code is likely to be
replaced by the HPET timer at some point, so dont even make a release
with the aquire/release_timer0 functions.
2003-11-14 22:34:43 +00:00
Peter Wemm
5333eee414 Minor source sync with amd64. Use int as the type for the width
field of %.*s rather than size_t.
2003-11-14 22:29:21 +00:00
Peter Wemm
ad641f0fd5 Minor source sync with amd64. For %.*s printf formats, pass in an
int rather than a size_t.  cast the ioapicaddress variable via
uintptr_t before going to void *.
2003-11-14 22:26:29 +00:00
Peter Wemm
7b66b81ee4 Convert a couple of pointers to integers for source compatability with
amd64.
2003-11-14 22:23:30 +00:00
Peter Wemm
40e3826a9f Whitespace nit (sorry, couldn't help it) 2003-11-14 22:21:30 +00:00
John Baldwin
64bb257f0b Always install IDT entries for ATPIC interrupt sources. The APIC no
longer uses these interrupt vectors for its ISA interrupt pins, so these
entries will not be overwritten.  If we get a spurious interrupt from the
ATPIC when using the APIC, it will be treated as a stray interrupt instead
of causing a panic.
2003-11-14 21:02:49 +00:00
John Baldwin
43d63d12fa If an interrupt source doesn't have an ithread, treat it as a stray
interrupt.  This can only happen if an unregistered interrupt source
triggers an interrupt.
2003-11-14 21:00:32 +00:00
Peter Wemm
db049820e1 basemem is in K, not bytes. I think I tricked jhb into making the same
mistake I did and then committing it to cvs.
2003-11-14 20:51:07 +00:00
Peter Wemm
2edfe38b10 "opt_auto_eoi.h" is not used here anymore. See atpic.c. 2003-11-14 20:06:24 +00:00
John Baldwin
f082493f10 Replace magic numbers with macros for i8259A register constants. Still
need the ICW4 bits for PC98 though.
2003-11-14 19:13:06 +00:00
John Baldwin
3ab2ba59f4 Shuffle the APIC interrupt vectors around a bit:
- Move the IPI and local APIC interrupt vectors up into the 0xf0 - 0xff
  range.  The pmap lazyfix IPI was reordered down next to the TLB
  shootdowns to avoid conflicting with the spurious interrupt vector.
- Move the base of APIC interrupts up 16 so that the first 16 APIC
  interrupts do not overlap the vectors used by the ATPIC.
- Remove bogus interrupt vector reservations for LINT[01].
- Now that 0xc0 - 0xef are available, use them for device interrupts.
  This increases the number of APIC device interrupts to 191.
- Increase the system-wide number of global interrupts to 191 to catch up
  to more APIC interrupts.

Requested by:	peter (2)
2003-11-14 19:10:13 +00:00
Peter Wemm
3ef6155b2e Fix up the control word 3 bits. jhb discovered how much I screwed this
up. :-]
2003-11-14 18:20:20 +00:00
John Baldwin
dced4b0c31 Whitespace. 2003-11-13 18:16:37 +00:00
John Baldwin
69487322d8 Fix a typo. 2003-11-13 16:41:07 +00:00
Peter Wemm
e46fe241d3 Stop pretending to support kernel profiling. The FAKE_MCOUNT() etc
calls are just gradually getting more and more stale.  At this point it
would be better to start from scratch once prof_machdep.c is adapted.
2003-11-13 02:38:33 +00:00
John Baldwin
bd9cd7e3f7 - Move manipulation of td_intr_nesting_level out of assembly interrupt
vector stubs and into the C functions they call.
- Move disabling and EOIing of interrupt sources out of PIC driver entry
  points and into intr_execute_handlers().  Intr_execute_handlers() only
  disables a source for an interrupt if it is a stray interrupt or has
  threaded handlers.  Sources with fast handlers no longer disable (mask)
  the source while executing the handlers.
- Move the setting of clkintr_pending into intr_execute_handlers() and set
  the variable for any interrupt source with a vector of 0.  (Should only
  be true for IRQ 0.)  This fixes clkintr_pending in the NO_MIXED_MODE
  case.
- Implement lapic_eoi() and use it to implement ioapic_eoi_source().
- Rename atpic_sched_ithd() to atpic_handle_intr() since it is used to
  handle all atpic interrupts and not just threaded ones.

Inspired by:	peter's changes to amd64 in p4 (1)
Requested by:	bde (2)
2003-11-12 18:13:57 +00:00
Peter Wemm
b79c9c6c58 Cosmetic sync with i386 2003-11-12 01:49:49 +00:00
John Baldwin
fd7d14d30b Don't probe busses in the MP Table for the MP Table PCI bridge drivers
if the bus number doesn't correspond to a PCI bus in the MP Table.

Reported by:	jhay
2003-11-11 21:19:43 +00:00
John Baldwin
d3c01334ce Some motherboards like to remap the SCI (normally IRQ 9) up to a PCI
interrupt such as IRQ 22 or 19.  However, the ACPI BIOS still routes
interrupts from some PCI devices to the same intpin calling the pin
IRQ 22.  Thus, ACPI expects to address a single interrupt source via two
different names.  To work around this, if the SCI is remapped to a non-ISA
interrupt (i.e., greater than 15), then we use
acpi_OverrideInterruptLevel() function to tell ACPI to use IRQ 22 or 19
rather than IRQ 9 for the SCI.

Previously we would change IRQ 22 or 19's name to IRQ 9 when we encountered
such an Interrupt Source Override entry in the MADT which routed the SCI
properly but left PCI devices mapped to IRQ 22 or 19 w/o a routable
interrupt.

Tested by:	sos
2003-11-11 18:20:10 +00:00
John Baldwin
da17811e64 Enable HTT CPUs by default instead of halting them by default. Users
should now only have HTT CPUs if they have explicitly asked for them
either by enabling HyperThreading in the BIOS or by using the
MPTABLE_FORCE_HTT kernel option.
2003-11-11 17:16:15 +00:00
John Baldwin
f9dbba5c4e Disable probing of HTT CPUs by default for the MP Table case. HTT CPUs
should only be used if they are enabled in the BIOS.  Now that we support
enumerating CPUs using the ACPI MADT, any HTT machine using ACPI should
respect the BIOS setting.  For HTT machines with ACPI disabled in the
kernel, the MPTABLE_FORCE_HTT kernel option can be used to try to probe HTT
CPUs like have done in the past for the MP Table case.  This option should
only be enabled if HTT is enabled in the BIOS.
2003-11-11 17:14:26 +00:00
John Baldwin
4e478d4521 MFamd64 (via P4, not in CVS yet):
- Use the static boot_address variable directly rather than passing it
  around to several functions.
- Clean up a couple of magic numbers.
2003-11-10 21:24:34 +00:00
John Baldwin
95020215db Bump APIC ID limits up to 32 since a machine with 16 CPUs will have APIC
IDs for the I/O APICs that are greater than 16.

Reported by:	John Cagle <john.cagle@hp.com>
2003-11-10 19:52:58 +00:00
Marcel Moolenaar
fcaa2925a9 Change the clear_ret argument of get_mcontext() to be a flags argument.
Since all callers either passed 0 or 1 for clear_ret, define bit 0 in
the flags for use as clear_ret. Reserve bits 1, 2 and 3 for use by MI
code for possible (but unlikely) future use. The remaining bits are for
use by MD code.

This change is triggered by a need on ia64 to have another knob for
get_mcontext().
2003-11-09 20:31:04 +00:00
Peter Wemm
4cd2d525e3 Move a MD 32 bit binary support routine into the MD areas. exec_setregs
is highly MD in an emulation environment since it operates on the host
environment.  Although the setregs functions are really for exec support
rather than signals, they deal with the same sorts of context and include
files.  So I put it there rather than create yet another file.
2003-11-08 07:43:44 +00:00
Peter Wemm
fcfe57d640 Update the graffiti. 2003-11-08 04:39:22 +00:00
Peter Wemm
398dbb11d8 Switch from having a fpu "device" to something that is more like the
integrated part of the cpu core that it is.
2003-11-08 04:37:54 +00:00
Peter Wemm
bf2f09ee97 The great s/npx/fpu/gi 2003-11-08 03:33:38 +00:00
Peter Wemm
a4d60a7fb3 Converge with i386/GENERIC 2003-11-08 03:17:36 +00:00
Peter Wemm
8b2454d833 Rename npx* to fpu*. I haven't done the flags/function names yet. 2003-11-08 02:39:46 +00:00
Peter Wemm
7538a488f5 There isn't much point printing 'npx0: INT 16 interface' because that is
the only way it works here.
2003-11-08 00:13:43 +00:00
John Baldwin
88861af1fb Dump the trigger and polarity of each intpin's default setting in the
bootverbose output.
2003-11-07 23:44:35 +00:00
Scott Long
eb3b7bf69f Document the lockfunc and lockfuncarg arguments to bus_dma_tag_create() in
the busdma headers.
2003-11-07 23:29:42 +00:00
John Baldwin
8dec768242 Only disable the old pin when doing a remap if it's current vector is still
the old vector.

Reported by:	sam
2003-11-06 14:47:53 +00:00
Peter Wemm
6350f49c4a OK, this might be a bit silly, but add another popcnt() candidate. 2003-11-06 01:24:25 +00:00
John Baldwin
f84d8b318a When remapping an ISA interrupt from one intpin to another, disable the
pin that is used by the default identity mapping if it still maps to the
old vector.  The ACPI case might need some tweaking for the SCI interrupt
case since ACPI likes to address the intpin using both the IRQ remapped to
it as well as the previous existing PCI IRQ mapped to it.

Reported by:	kan
2003-11-05 23:15:52 +00:00
John Baldwin
240cfc80b3 Two style nits. 2003-11-05 23:07:39 +00:00
John Baldwin
be11140dfb - Adjust some of the bitfields in the ioapic_intsrc struct to be unsigned
rather than signed.  This fixes some cosmetics such as verbose printf's
  for IRQs greater than 127.
- The calculation for next_ioapic_base was also adjusted so that it will
  only complain once for each hole in the IRQs provided by ACPI for IO
  APICs.

Reported by:	Michal Mertl <mime@traveller.cz>
2003-11-05 16:18:06 +00:00
John Baldwin
fc0d431d4b Add a workaround for MP Tables that list the same PCI IRQ twice with
the same APIC / pin destination in both cases.

Reported by:	Pawel Jakub Dawidek <nick@garage.freebsd.pl>
2003-11-05 16:14:10 +00:00
John Baldwin
7542a92afa Tweak the version string output for ioapic devices. 2003-11-04 19:22:20 +00:00
Yoshihiro Takahashi
0ca1bf3907 Fix to support pc98. 2003-11-04 13:13:04 +00:00
Yoshihiro Takahashi
95755cc99b Split pc98 support into pc98/pc98/nmi.c. 2003-11-04 13:01:41 +00:00
Peter Wemm
93c3f67fe7 Make this compile with PAE. 2003-11-04 01:07:04 +00:00
John Baldwin
147ad8d5ad New i386 SMP code:
- The MP code no longer knows anything specific about an MP Table.
  Instead, the local APIC code adds CPUs via the cpu_add() function when
  a local APIC is enumerated by an APIC enumerator.
- Don't divide the argument to mp_bootaddress() by 1024 just so that we
  can turn around and mulitply it by 1024 again.
- We no longer panic if SMP is enabled but we are booted on a UP machine.
- init_secondary(), the asm code between init_secondary() and ap_init()
  in mpboot.s and ap_init() have all been merged together in C into
  init_secondary().
- We now use the cpuid feature bits to determine if we should enable
  PSE, PGE, or VME on each AP.
- Due to the change in the implementation of critical sections, acquire
  the SMP TLB mutex around a slightly larger chunk of code for TLB
  shootdowns.
- Remove some of the debug code from the original SMP implementation
  that is no longer used or no longer applies to the new APIC code.
- Use a temporary hack to disable the ACPI module until the SMP code has
  been further reorganized to allow ACPI to work as a module again.
- Add a DDB command to dump the interesting contents of the IDT.
2003-11-03 22:32:04 +00:00
John Baldwin
9738024229 Don't probe PnP BIOS devices for PICs for now to avoid problems with those
devices claiming resources that they don't actually use.  The PIC drivers
only register valid interrupt sources, so we don't need to rely on these
drivers to claim invalid IRQs to prevent their use by other drivers.
2003-11-03 22:22:04 +00:00
John Baldwin
ab089945d3 Add the ACPI MADT table APIC enumerator. This code uses the ACPI Multiple
APIC Descriptor Table to enumerate both I/O APICs and local APICs.  ACPI
does not embed PCI interrupt routing information in the MADT like the MP
Table does.  Instead, ACPI stores the PCI interrupt routing information
in the _PRT object under each PCI bus device.  The MADT table simply
provides hints about which interrupt vectors map to which I/O APICs.  Thus
when using ACPI, the existing ACPI PCI bridge drivers are sufficient to
route PCI interrupts.
2003-11-03 22:17:44 +00:00
John Baldwin
8f8914ad98 Add the MP Table APIC enumerator. This code uses the BIOS MP Table to
enumerate I/O APICs as well as local APICs.  It also provides Host-PCI
and PCI-PCI bridge drivers to use the MP Table to route PCI interrupts.
2003-11-03 22:12:37 +00:00
John Baldwin
6f92bdd0c1 New APIC support code:
- The apic interrupt entry points have been rewritten so that each entry
  point can serve 32 different vectors.  When the entry is executed, it
  uses one of the 32-bit ISR registers to determine which vector in its
  assigned range was triggered.  Thus, the apic code can support 159
  different interrupt vectors with only 5 entry points.
- We now always to disable the local APIC to work around an errata in
  certain PPros and then re-enable it again if we decide to use the APICs
  to route interrupts.
- We no longer map IO APICs or local APICs using special page table
  entries.  Instead, we just use pmap_mapdev().  We also no longer
  export the virtual address of the local APIC as a global symbol to
  the rest of the system, but only in local_apic.c.  To aid this, the
  APIC ID of each CPU is exported as a per-CPU variable.
- Interrupt sources are provided for each intpin on each IO APIC.
  Currently, each source is given a unique interrupt vector meaning that
  PCI interrupts are not shared on most machines with an I/O APIC.
  That mapping for interrupt sources to interrupt vectors is up to the
  APIC enumerator driver however.
- We no longer probe to see if we need to use mixed mode to route IRQ 0,
  instead we always use mixed mode to route IRQ 0 for now.  This can be
  disabled via the 'NO_MIXED_MODE' kernel option.
- The npx(4) driver now always probes to see if a built-in FPU is present
  since this test can now be performed with the new APIC code.  However,
  an SMP kernel will panic if there is more than one CPU and a built-in
  FPU is not found.
- PCI interrupts are now properly routed when using APICs to route
  interrupts, so remove the hack to psuedo-route interrupts when the
  intpin register was read.
- The apic.h header was moved to apicreg.h and a new apicvar.h header
  that declares the APIs used by the new APIC code was added.
2003-11-03 21:53:38 +00:00
John Baldwin
223e573bbd Add the new atpic(4) driver for the 8259A master and slave PICs. By
default we provide 16 interrupt sources for IRQs 0 through 15.  However,
if the I/O APIC driver has already registered sources for any of those IRQs
then we will silently fail to register our own source for that IRQ.

Note that i386/isa/icu.h is now specific to the 8259A and no longer
contains any info relevant to APICs.  Also note that fast interrupts no
longer use a separate entry point.  Instead, both fast and threaded
interrupts share the same entry point which merely looks up the appropriate
source and passes control to intr_execute_handlers().
2003-11-03 21:34:45 +00:00
John Baldwin
ecee5704ed New device interrupt code. This defines an interrupt source abstraction
that provides methods via a PIC driver to do things like mask a source,
unmask a source, enable it when the first interrupt handler is added, etc.
The interrupt code provides a table of interrupt sources indexed by IRQ
numbers, or vectors.  These vectors are what new-bus uses for its IRQ
resources and for bus_setup_intr()/bus_teardown_intr().  The interrupt
code then maps that vector a given interrupt source object.  When an
interrupt comes in, the low-level interrupt code looks up the interrupt
source for the source that triggered the interrupt and hands it off to
this code to execute the appropriate handlers.

By having an interrupt source abstraction, this allows us to have different
types of interrupt source providers within the shared IRQ address space.
For example, IRQ 0 may map to pin 0 of the master 8259A PIC, IRQs 1
through 60 may map to pins on various I/O APICs, and IRQs 120 through
128 may map to MSI interrupts for various PCI devices.
2003-11-03 21:25:52 +00:00
John Baldwin
e14243fac7 Move the NMI handling code out to its own file. 2003-11-03 21:10:17 +00:00
John Baldwin
1ab9ea3059 Include "opt_pmap.h" so that the DISABLE_P* options are honored. 2003-10-30 21:42:44 +00:00
John Baldwin
63239aa581 Always export r_gdt and r_idt and give them extern declarations in
machine/segments.h.
2003-10-30 21:42:17 +00:00
Peter Wemm
fbd00896e2 MFi386: thread specific fpu state optimizations 2003-10-30 19:04:58 +00:00
Peter Wemm
3f378ea44a MFi386: rev 1.451 (jhb): call pmap_kremove() rather than duplicate it 2003-10-30 04:08:22 +00:00
Peter Wemm
10d9b64384 MFi386: trap.c rev 1.259: fetch thread mailbox address in page fault trap 2003-10-30 04:06:28 +00:00
Peter Wemm
57e1fa205b Oops. Remove some rather noisy debug printfs that slipped in there
somehow.
2003-10-28 01:06:37 +00:00
John Baldwin
07930cce05 A few whitespace and comment tweaks. 2003-10-24 21:02:26 +00:00