History log of /netbsd-current/sys/arch/x86/x86/mpacpi.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.110 24-Mar-2023 bouyer

mpacpi_config_cpu(): Xen with a PVH dom0 reports x2apic->LocalApicId
below 0xff, which causes a panic later because no CPUs are attached.
Accept the bogus LocalApicId value for VM_GUEST_XENPVH.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.109 22-Jan-2022 thorpej

branches: 1.109.4;
Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.


# 1.108 07-Oct-2021 msaitoh

KNF. No functional change.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.107 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.106 12-May-2021 thorpej

branches: 1.106.4;
In mpacpi_pci_attach_hook(), set the device handle of the PCI bus instance
to the associated ACPI handle if a device handle is not already set.

XXX This is a mess. Sure would be nice if it looked / worked more like
XXX the ARM code.


Revision tags: cjep_staticlib_x-base
# 1.105 24-Apr-2021 thorpej

branches: 1.105.2; 1.105.4;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.104 17-Jan-2020 jmcneill

branches: 1.104.8;
Add support for Arm N1 SDP PCIe host controller.

The N1 SDP has a few bugs that we need to work around:
- PCIe root port config space lives in a non-standard location.
- Access to PCIe config space of devices that do not exist results in
an sync SError. Firmware creates a "known devices" table at a fixed
physical address that we use to filter PCI conf access to only known
devices.

This change splits the Arm ACPI PCI quirks into separate files for each
host controller, and allows per-segment quirks to be applied.

These changes exposed some bugs in the MI ACPI layer related to
multi-segment support. The MI ACPI PCI code was using a shared PCI
chipset tag to access devices, and these accesses can happen before our
PCI host bridge drivers are attached! The global chipset tag is now gone,
and an MD callback can provide a custom tag on a per-segment basis.


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.103 01-Jun-2017 chs

branches: 1.103.10; 1.103.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


# 1.109 22-Jan-2022 thorpej

Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.


# 1.108 07-Oct-2021 msaitoh

KNF. No functional change.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.107 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.106 12-May-2021 thorpej

branches: 1.106.4;
In mpacpi_pci_attach_hook(), set the device handle of the PCI bus instance
to the associated ACPI handle if a device handle is not already set.

XXX This is a mess. Sure would be nice if it looked / worked more like
XXX the ARM code.


Revision tags: cjep_staticlib_x-base
# 1.105 24-Apr-2021 thorpej

branches: 1.105.2; 1.105.4;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.104 17-Jan-2020 jmcneill

branches: 1.104.8;
Add support for Arm N1 SDP PCIe host controller.

The N1 SDP has a few bugs that we need to work around:
- PCIe root port config space lives in a non-standard location.
- Access to PCIe config space of devices that do not exist results in
an sync SError. Firmware creates a "known devices" table at a fixed
physical address that we use to filter PCI conf access to only known
devices.

This change splits the Arm ACPI PCI quirks into separate files for each
host controller, and allows per-segment quirks to be applied.

These changes exposed some bugs in the MI ACPI layer related to
multi-segment support. The MI ACPI PCI code was using a shared PCI
chipset tag to access devices, and these accesses can happen before our
PCI host bridge drivers are attached! The global chipset tag is now gone,
and an MD callback can provide a custom tag on a per-segment basis.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.103 01-Jun-2017 chs

branches: 1.103.10; 1.103.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


# 1.108 07-Oct-2021 msaitoh

KNF. No functional change.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.107 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.106 12-May-2021 thorpej

branches: 1.106.4;
In mpacpi_pci_attach_hook(), set the device handle of the PCI bus instance
to the associated ACPI handle if a device handle is not already set.

XXX This is a mess. Sure would be nice if it looked / worked more like
XXX the ARM code.


Revision tags: cjep_staticlib_x-base
# 1.105 24-Apr-2021 thorpej

branches: 1.105.2; 1.105.4;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.104 17-Jan-2020 jmcneill

branches: 1.104.8;
Add support for Arm N1 SDP PCIe host controller.

The N1 SDP has a few bugs that we need to work around:
- PCIe root port config space lives in a non-standard location.
- Access to PCIe config space of devices that do not exist results in
an sync SError. Firmware creates a "known devices" table at a fixed
physical address that we use to filter PCI conf access to only known
devices.

This change splits the Arm ACPI PCI quirks into separate files for each
host controller, and allows per-segment quirks to be applied.

These changes exposed some bugs in the MI ACPI layer related to
multi-segment support. The MI ACPI PCI code was using a shared PCI
chipset tag to access devices, and these accesses can happen before our
PCI host bridge drivers are attached! The global chipset tag is now gone,
and an MD callback can provide a custom tag on a per-segment basis.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.103 01-Jun-2017 chs

branches: 1.103.10; 1.103.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


# 1.107 07-Aug-2021 thorpej

Merge thorpej-cfargs2.


Revision tags: thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 thorpej-i2c-spi-conf-base
# 1.106 12-May-2021 thorpej

branches: 1.106.4;
In mpacpi_pci_attach_hook(), set the device handle of the PCI bus instance
to the associated ACPI handle if a device handle is not already set.

XXX This is a mess. Sure would be nice if it looked / worked more like
XXX the ARM code.


Revision tags: cjep_staticlib_x-base
# 1.105 24-Apr-2021 thorpej

branches: 1.105.2; 1.105.4;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.104 17-Jan-2020 jmcneill

branches: 1.104.8;
Add support for Arm N1 SDP PCIe host controller.

The N1 SDP has a few bugs that we need to work around:
- PCIe root port config space lives in a non-standard location.
- Access to PCIe config space of devices that do not exist results in
an sync SError. Firmware creates a "known devices" table at a fixed
physical address that we use to filter PCI conf access to only known
devices.

This change splits the Arm ACPI PCI quirks into separate files for each
host controller, and allows per-segment quirks to be applied.

These changes exposed some bugs in the MI ACPI layer related to
multi-segment support. The MI ACPI PCI code was using a shared PCI
chipset tag to access devices, and these accesses can happen before our
PCI host bridge drivers are attached! The global chipset tag is now gone,
and an MD callback can provide a custom tag on a per-segment basis.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.103 01-Jun-2017 chs

branches: 1.103.10; 1.103.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


Revision tags: thorpej-i2c-spi-conf-base
# 1.106 12-May-2021 thorpej

In mpacpi_pci_attach_hook(), set the device handle of the PCI bus instance
to the associated ACPI handle if a device handle is not already set.

XXX This is a mess. Sure would be nice if it looked / worked more like
XXX the ARM code.


Revision tags: cjep_staticlib_x-base
# 1.105 24-Apr-2021 thorpej

branches: 1.105.2;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.104 17-Jan-2020 jmcneill

branches: 1.104.8;
Add support for Arm N1 SDP PCIe host controller.

The N1 SDP has a few bugs that we need to work around:
- PCIe root port config space lives in a non-standard location.
- Access to PCIe config space of devices that do not exist results in
an sync SError. Firmware creates a "known devices" table at a fixed
physical address that we use to filter PCI conf access to only known
devices.

This change splits the Arm ACPI PCI quirks into separate files for each
host controller, and allows per-segment quirks to be applied.

These changes exposed some bugs in the MI ACPI layer related to
multi-segment support. The MI ACPI PCI code was using a shared PCI
chipset tag to access devices, and these accesses can happen before our
PCI host bridge drivers are attached! The global chipset tag is now gone,
and an MD callback can provide a custom tag on a per-segment basis.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.103 01-Jun-2017 chs

branches: 1.103.10; 1.103.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


# 1.105 24-Apr-2021 thorpej

Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).


Revision tags: thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1
# 1.104 17-Jan-2020 jmcneill

branches: 1.104.8;
Add support for Arm N1 SDP PCIe host controller.

The N1 SDP has a few bugs that we need to work around:
- PCIe root port config space lives in a non-standard location.
- Access to PCIe config space of devices that do not exist results in
an sync SError. Firmware creates a "known devices" table at a fixed
physical address that we use to filter PCI conf access to only known
devices.

This change splits the Arm ACPI PCI quirks into separate files for each
host controller, and allows per-segment quirks to be applied.

These changes exposed some bugs in the MI ACPI layer related to
multi-segment support. The MI ACPI PCI code was using a shared PCI
chipset tag to access devices, and these accesses can happen before our
PCI host bridge drivers are attached! The global chipset tag is now gone,
and an MD callback can provide a custom tag on a per-segment basis.


Revision tags: netbsd-9-1-RELEASE netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.103 01-Jun-2017 chs

branches: 1.103.10; 1.103.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


Revision tags: ad-namecache-base1
# 1.104 17-Jan-2020 jmcneill

Add support for Arm N1 SDP PCIe host controller.

The N1 SDP has a few bugs that we need to work around:
- PCIe root port config space lives in a non-standard location.
- Access to PCIe config space of devices that do not exist results in
an sync SError. Firmware creates a "known devices" table at a fixed
physical address that we use to filter PCI conf access to only known
devices.

This change splits the Arm ACPI PCI quirks into separate files for each
host controller, and allows per-segment quirks to be applied.

These changes exposed some bugs in the MI ACPI layer related to
multi-segment support. The MI ACPI PCI code was using a shared PCI
chipset tag to access devices, and these accesses can happen before our
PCI host bridge drivers are attached! The global chipset tag is now gone,
and an MD callback can provide a custom tag on a per-segment basis.


Revision tags: ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base
# 1.103 01-Jun-2017 chs

branches: 1.103.16;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


# 1.103 01-Jun-2017 chs

remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.


Revision tags: prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104 nick-nhusb-base-20161004 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907
# 1.102 07-Jul-2016 msaitoh

KNF. Remove extra spaces. No functional change.


Revision tags: nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 nick-nhusb-base-20150921
# 1.101 17-Jul-2015 msaitoh

KNF. No functional change.


# 1.100 15-Jul-2015 msaitoh

Configure ioapic before lapic because lapic(lapic_set_lvt()) checks the
existence of ioapic. This change fixes a problem that some machines hang
after attaching ehci (little after writing EHCI_USBINTR to enable interrupt).
Even though cold == 1, LAPIC_LVINT0 was not set as masked. Perhaps it's the
reason of the problem.

This problem was observed on SuperMicro X10SLX-F, X10SDV-TLN4F and
Shuttle DS57U without wm(4) driver.


# 1.99 15-Jul-2015 msaitoh

- Add lapic_dump() to print lapic's setting.
- Add mpacpi_dump() to dump mp_intrs[].


# 1.98 22-Jun-2015 msaitoh

Fix wrong output in mpacpi_pci_foundbus() with MPVERBOSE. Assign
vaues before printing them.


Revision tags: netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 rmind-smpnet-nbase riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base tls-maxphys-base
# 1.97 25-Mar-2013 chs

branches: 1.97.10; 1.97.12;
redo the ACPI interrupt handler setup again, this time handling
MADT overrides that change the pin as well as the polarity.
fixes PR 47648.


Revision tags: agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 03-Oct-2012 chs

as a workaround for PR 47016, call ioapic_reenable() at the end of
ACPI interrupt routing to fix the settings for the SCI interrupt.
the problem is that after my recent changes, the SCI handler is
installed before the MADT info is parsed, so we don't know what
polarity it should have. the real fix for this will be to rearrange
the ACPI initialization so that everything is done in a more sensible
order, but that will take some more time.


# 1.95 23-Sep-2012 chs

locate PCI buses and determine their bus numbers using the info
previously extracted from ACPICA rather than trying to figure it out again.
allow PCI buses that don't have a _PRT method.


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9
# 1.94 27-Apr-2012 jruoho

branches: 1.94.2;
Revert previous. Revision 1.79 was right; Qemu does not implement _PIC.


# 1.93 26-Apr-2012 jruoho

Based on PR kern/44069, revert revision 1.79.

XXX: The actual problem related to Qemu/KVM is yet to be determined.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-0-5-RELEASE netbsd-6-0-4-RELEASE netbsd-6-0-3-RELEASE netbsd-6-0-2-RELEASE netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base jym-xensuspend-nbase jym-xensuspend-base
# 1.92 01-Jul-2011 dyoung

branches: 1.92.2; 1.92.8;
#include <sys/bus.h> instead of <machine/bus.h>.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.91 05-Apr-2011 pgoyette

Display a warning message if an attempt is made to process interrupt
routing for a bus that has previously been processed.

From PR kern/43570 - doesn't fix the problem but at least lets you
know it exists.


# 1.90 16-Mar-2011 dholland

Fix build with no pchb. From Aran Clauson in PR 44720.


Revision tags: uebayasi-xip-base7 bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base6 uebayasi-xip-base5 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10
# 1.89 07-Aug-2010 jruoho

branches: 1.89.2;
Reorganize: also the APIC tables will be dumped in ACPIVERBOSE, and the
callback functions will be modified to be suitable also with other tables.


# 1.88 04-Aug-2010 jruoho

Store the MADT-derived CPU ID to <x86/cpu.h>. This is required to properly
match the ACPI processor object ID with the ID available in the APIC table.


Revision tags: uebayasi-xip-base1
# 1.87 27-Apr-2010 jruoho

Clean up <dev/acpi/acpireg.h>. While documenting the control methods is an
admirable goal, it is pretty much mission impossible; the specifications are
nearly thousand pages each and the amount of methods is counted in hundreds.

In addition, use ACPICA's native constants from <actypes.h> when possible.
Also move ACPI_STA_OK from "mpacpi.c" to <dev/acpi/acpireg.h> to simplify
the evaluation of device status.


# 1.86 14-Apr-2010 jruoho

UINT32 -> uint32_t; UINT8 -> uint8_t.


# 1.85 08-Apr-2010 jruoho

ACPICA 20091112:

Implemented a post-order callback to AcpiWalkNamespace. The existing
interface only has a pre-order callback. This change adds an
additional parameter for a post-order callback which will be more
useful for bus scans. ACPICA BZ 779. Lin Ming. Updated the ACPICA
Programmer Reference.

We will use the old "pre-order callback" for the time being.


Revision tags: yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 09-Jan-2010 cegger

branches: 1.84.2; 1.84.4;
add x2apic support.
patch presented on current-users@, port-i386@ and port-amd64@ on 2009-12-22

No comments.


# 1.83 05-Jan-2010 jruoho

Put back the evaluation of the return value from mpacpi_get_bbn().

Break reported by njoly@. Thanks!


# 1.82 05-Jan-2010 jruoho

Use acpi_eval_set_integer() to simplify code. No functional change intended.

ok pgoyette@, jmcneill@


# 1.81 05-Jan-2010 jruoho

Fix several possible memory leaks in mpacpi_derive_bus().

ok pgoyette@, jmcneill@


# 1.80 05-Jan-2010 mbalmer

One semicolon only (;; -> ;)


Revision tags: matt-premerge-20091211
# 1.79 04-Nov-2009 toshii

Don't return an error if the _PIC method isn't found.
It's an optional method and not found in kvm/qemu.


# 1.78 16-Sep-2009 mlelstv

Allow for 'options ACPI_DEBUG' by providing module declarations
and using memory allocation macros instead of calling AcpiOs* stubs
directly.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 1.77 18-Aug-2009 jmcneill

Switch to ACPICA 20090730, and update for API changes.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 nick-hppapmap-base
# 1.76 17-Apr-2009 dyoung

Introduce sys/arch/x86/x86/mp.c for common x86 MP configuration code.
mpacpi_scan_pci() and mpbios_scan_pci() are identical code, so replace
them with mp_pci_scan().

Introduce mp_pci_childdetached(), which helps us to detach root PCI
buses that were enumerated either by MP BIOS or by ACPI.

Let us detach and re-attach PCI buses from mainbus0 on i386. This is
necessarily a work-in-progress, because testing detach and re-attach
is very difficult: to detach and re-attach the entire PCI tree on most
x86 computers that I own is not possible because some essential device
attaches under the PCI subtree: the console, com0, NIC, or storage
controller always attaches in the PCI tree.


Revision tags: nick-hppapmap-base2 mjf-devfs2-base
# 1.75 14-Jan-2009 cegger

branches: 1.75.2;
use KM_SLEEP per request from ad@


# 1.74 12-Jan-2009 sborrill

Return ENOENT instead of panicking when irq doesn't equal line
(mpacpi_findintr_linkdev: irq mismatch). This doesn't fix the cause of
kern/38540, but stops the bogus panic. It's pretty definite that the device
with the mismatched irq will not function.


# 1.73 23-Dec-2008 cegger

move from malloc to kmem


# 1.72 16-Dec-2008 christos

replace bitmask_snprintf(9) with snprintb(3)


Revision tags: haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.71 09-Nov-2008 cegger

struct device * -> device_t


# 1.70 09-Nov-2008 cegger

Nuke last parameter from mpaci_scan_apics() and mpbios_scan().
It is unused.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.69 26-Aug-2008 cegger

branches: 1.69.2; 1.69.4;
beautify dmesg with MPVERBOSE:

don't print an empty line.


# 1.68 31-Jul-2008 joerg

machdep.acpi_vbios_reset = 2 --> vga_pci_resume will use x86emu to do a
POST when options VGA_POST is present.


Revision tags: simonb-wapbl-nbase simonb-wapbl-base
# 1.67 21-Jul-2008 cegger

beautify dmesg with MPVERBOSE.
before:

pci0 at hypervisor0 bus 0: configuration mode 1hypervisor0: added to list as bus 0

pchb0 at pci0 dev 0 function 0

now:

pci0 at hypervisor0 bus 0: configuration mode 1
hypervisor0: added to list as bus 0
pchb0 at pci0 dev 0 function 0


# 1.66 03-Jul-2008 drochner

branches: 1.66.2;
Remove "struct device" from "struct pic", where it was only real
for ioapics and faked up for others. Add it to "struct ioapic_softc"
for now, until device/softc get split.
This required all typecasts between "struct pic" and "struct ioapic_softc"
to be replaced, I hope I got them all.
functionally tested on i386, compile-tested on xen, untested on amd64


# 1.65 25-Jun-2008 joerg

Mask the interrupt pin in the other places as well as reminded by
Jared.


# 1.64 25-Jun-2008 joerg

Mask the higher bits of the interrupt pin extract from the _PTR.
Alan Barrett reported a system in PR 38959 that (incorrectly) uses the
higher bits and which resulted in a bad table being built.


Revision tags: wrstuden-revivesa-base-1 yamt-pf42-base4 wrstuden-revivesa-base
# 1.63 06-Jun-2008 joerg

branches: 1.63.2;
Explicitly recognize the PNP ID of PCI-X bridges. This is normally
redundant as DSDTs should provide _CID for it.


# 1.62 04-Jun-2008 joerg

Add back break to fix PCI bridge traversal as reported by various users.


# 1.61 03-Jun-2008 joerg

Make the logic for _BBN overrides less aggressive. When mpacpi_get_bbn
failed and the current goal is to enumerate all PCI bus and this is the
first PCI host bridge, just assume it is bus 0 and ignore the error.
When querying the bus number, assume that the system paniced earlier if
an error happened and this is not the first/only PCI host bridge and
override the BBN as 0 in that case.


Revision tags: yamt-pf42-base3
# 1.60 01-Jun-2008 joerg

When a PCI host bridge description in the DSDT has a missing _BBN or the
_BBN is 0, check if the _ADR field is also 0. If it is, assume that the
_BBN really should be 0. Otherwise, try to extract the _BBN from the
bridge itself using pchb logic and panic only, if that fails as well.
Reported and tested by Martin Husemann as interrupt issue.


# 1.59 01-Jun-2008 joerg

When building the ACPI PCI Interrupt Table, check for duplicate entries
and drop all but the first. This is the behaviour Windows seems to
implement and some BIOSes depend on that due to broken dups.

This should fix PR 37001.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.58 26-Apr-2008 darcy

branches: 1.58.2; 1.58.4;
Add a little more detail when verbosity is requested.


Revision tags: yamt-pf42-baseX yamt-pf42-X yamt-pf42-base
# 1.57 16-Apr-2008 cegger

branches: 1.57.2;
- use aprint_*_dev and device_xname
- use POSIX integer types


Revision tags: ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 bouyer-xeni386-base matt-armv6-nbase mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.56 12-Dec-2007 jmcneill

branches: 1.56.6;
Try not to pass garbage to pci_make_tag; workaround for odd ACPI DSDTs.
Fixes kern/37527.


Revision tags: cube-autoconf-base yamt-kmem-base2
# 1.55 09-Dec-2007 jmcneill

branches: 1.55.2;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 vmlocking-nbase jmcneill-pm-base reinoud-bufcleanup-base
# 1.54 01-Dec-2007 jmcneill

branches: 1.54.2; 1.54.4;
aprintify


Revision tags: jmcneill-base bouyer-xenamd64-base2 bouyer-xenamd64-base
# 1.53 24-Oct-2007 joerg

branches: 1.53.2;
Remove code that was never meant to hit the tree in first place.


Revision tags: yamt-x86pmap-base4
# 1.52 17-Oct-2007 garbled

Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.


Revision tags: yamt-x86pmap-base3 ppcoea-renovation-base vmlocking-base
# 1.51 10-Oct-2007 joerg

branches: 1.51.2;
Install the default entries for the non-ISA interrupts as masked as
intended. Report by Christoph Egger.


# 1.50 06-Oct-2007 joerg

Merge from mpacpi.h 1.4.32.1, acpi_machdep.c 1.13.22.5 and
mpacpi.c 1.48.12.2 from jmcneill-pm:

Don't process the MADT and modify the interrupt config at one moment and
later trying to figure out if an entry was overriden and matches the
ACPI SCI. This is brain-dead and breaks in various situations.

Just check for each ISA override entry, if it matches the SCI. If it
does, remember it and use it for the interrupt setup. If there's no such
override assume that it is not changed, but override the polarity and
level from ISA settings to PCI settings.


Revision tags: nick-csl-alignment-base5 yamt-x86pmap-base2 yamt-x86pmap-base
# 1.49 10-Aug-2007 joerg

branches: 1.49.2; 1.49.4;
Print the polarity and trigger flags as well. Can help with debugging
on fancy notebooks.


Revision tags: nick-csl-alignment-base matt-mips64-base yamt-idlelwp-base8 thorpej-atomic-base mjf-ufs-trans-base
# 1.48 10-Apr-2007 bouyer

branches: 1.48.4; 1.48.8; 1.48.12;
Fix previous: don't AcpiOsFree() twice if the device is valid.


# 1.47 08-Apr-2007 bouyer

Properly skip inactive devices; avoids a panic in pci_make_tag() later.
Thanks to cube@ for the idea.
An ACPI kernel can now boot on a poweredge 2950.


# 1.46 05-Mar-2007 drochner

branches: 1.46.2; 1.46.4;
clean up how cpus and ioapics are attached at the mainbus:
Seperate "cpubus" and "ioapicbus" -- while they share a common "address
space" (the apic id), the kernel doesn't use this fact. There are different
data passed to cpus and apics, which caused some ugly polymorphism. This
also saves the special "submatch" functions needed to distingush cpus
and ioapics for autoconf. (And it makes that "apid" locators wired
in the kernel configuration are honored now; this allows one to dumb down
an mp box to singleprocessor by userconfig.)
Print "apid" locators in the buses "print" function "as everyone does",
so the per-port cpu drivers don't need to do it.
Being here, constify "struct cpu_functions" and g/c the unused MP_PICMODE
flag.


Revision tags: ad-audiomp-base
# 1.45 15-Feb-2007 ad

branches: 1.45.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.


Revision tags: post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.44 16-Nov-2006 christos

branches: 1.44.2;
__unused removal on arguments; approved by core.


Revision tags: yamt-splraiseipl-base2
# 1.43 12-Oct-2006 christos

- sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386


# 1.42 29-Sep-2006 martin

If using NLAPIC, we better include lapic.h. Pointed out by Kurt Schreiner
on current-users.


# 1.41 28-Sep-2006 bouyer

- make it possible to have ACPI without IOAPIC and/or LAPIC
- make it possible for machine-specific code to provide custom R/W routines
in its i82093*.h headers
- always initialize sc->sc_pins[pin], even in the !ioapic_cold case.
No objections on port-i386 and port-amd64.


# 1.40 23-Sep-2006 fvdl

While the low-level trigger and polarity values are the same for
ACPI and MPS, the ACPICA values are different. Convert them,
so that we get the right values into the ioapic.


# 1.39 23-Sep-2006 fvdl

Check for the bad irq0 override quirk.


Revision tags: yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 1.38 12-Aug-2006 fvdl

branches: 1.38.2; 1.38.4;
Record the ACPI global int in the interrupt structure for ISA interrupt
overrided (e.g. the SCI interrupt), so that it may be found correctly by
the ACPI interrupt establish function, should the number be different
from the original source.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.37 20-Jul-2006 kochi

eliminate bogus acpi debug #define symbols


# 1.36 04-Jul-2006 christos

Apply fvdl's acpi pci interrupt configuration code.
- MPACPI is no more.
- MPACPI_SCANPCI -> ACPI_SCANPCI


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base simonb-timcounters-final yamt-pdpolicy-base5 chap-midi-base yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5 simonb-timecounters-base
# 1.35 11-Dec-2005 christos

branches: 1.35.4; 1.35.8; 1.35.16;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 1.34 26-Aug-2005 drochner

s/locdesc_t/int/g


# 1.33 29-May-2005 christos

branches: 1.33.2;
Sprinkle const.


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base4 yamt-km-base3 netbsd-3-base yamt-km-base2 yamt-km-base kent-audio2-base kent-audio1-beforemerge
# 1.32 21-Dec-2004 fvdl

Use fixed mode, not lopri, for delivering IO interrupts. Suggested by
Peter O'Kane. Fixes interrupt problems on some Xeon systems.


Revision tags: kent-audio1-base
# 1.31 29-Nov-2004 ws

We just checked that the parent is the root, not current.
So we better determine the bus number of this parent node.
Now, MPACPI on my Opteron board finally correctly determines its
PCI/AGP busses even without the help of the AMD64 Address Map
support implemented in my local tree.


# 1.30 30-Aug-2004 drochner

Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.


# 1.29 23-May-2004 kochi

prevent panic for machines without any ACPI MADT table.


# 1.28 21-May-2004 kochi

Fix panic / bogus PCI bus detection.


# 1.27 21-May-2004 kochi

Clean up variable usage.


# 1.26 21-May-2004 kochi

Make sure we don't use the same bus number for PCI and ISA.


# 1.25 21-May-2004 kochi

Back out bogus node check of revision 1.22.
This check is not necessary.


# 1.24 21-May-2004 kochi

add some comments, make local variables/functions static and some style fix.


# 1.23 25-Apr-2004 tron

Make this compile without ACPI_DEBUG again.


# 1.22 25-Apr-2004 christos

make this compile with ACPI_DEBUG again.


# 1.21 22-Apr-2004 skd

1) Skip over bogus device nodes, prevents a panic in pci_make_tag.
2) Clarify a printf.


# 1.20 10-Apr-2004 kochi

whitespace nit


Revision tags: netbsd-2-0-base
# 1.19 24-Mar-2004 martin

branches: 1.19.2;
Make it compile (int -> ACPI_INTEGER)


# 1.18 23-Mar-2004 kochi

Don't use ACPI CA internal functions


# 1.17 13-Nov-2003 fvdl

Remove leftover debugging printf.


# 1.16 31-Oct-2003 fvdl

Catch up with the new acpica code.


# 1.15 30-Oct-2003 fvdl

* keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant


# 1.14 21-Oct-2003 fvdl

If a bus has not been configured by MPBIOS/ACPI, and the attach hook
for it is called, mark it as configured.


# 1.13 16-Oct-2003 fvdl

Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.


# 1.12 09-Oct-2003 fvdl

Allow probing of CPUs only by ACPI, so that MPBIOS can still do interrupt
mapping should ACPI have a quirk. From Christos. One change by me: make
sure that lapic_boot_init doesn't get called twice, otherwise the
cpu_info entry for the CPU with id 0 gets zapped.


# 1.11 07-Oct-2003 fvdl

Backout previous for now, it breaks second CPU spinup. It'll be back later.


# 1.10 07-Oct-2003 fvdl

Changes from Christos to fall back to MPBIOS for interrupt probing
if MPACPI fails, so that MPACPI can be used to only probe CPUs
if needed.


# 1.9 06-Sep-2003 fvdl

When establishing the ACPI SCI, make sure it's always active low (as well
as level-triggered). Do this by changing the MP config entry that was
set up for the interrupt. Do not change anything if there was an ACPI
interrupt source override, assume that this contains the correct
information already.


# 1.8 22-Jul-2003 simonb

Use local APIC id to determine boot CPU.

Fixes PR kern/20690 from Jaromir Dolecek. Fix from fvdl.


# 1.7 14-Jul-2003 lukem

add __KERNEL_RCSID()


# 1.6 01-Jun-2003 fvdl

branches: 1.6.2;
mpb_name may not be set for a bus, since it's possible a PCI bus
doesn't show up when looking at ACPI, but is found on a ppb. So
check if it's NULL before doing a strcmp on it.

From Takayoshi Kochi.


# 1.5 29-May-2003 fvdl

Add the options MPBIOS_SCANPCI and MPACPI_SCANPCI to configure PCI roots
with the MPBIOS/ACPI bus information, by walking through the buses, and
descending down every bus that hasn't been marked configured yet.


# 1.4 15-May-2003 fvdl

Don't start the process of scanning CPUs and I/O APICs (with interrupt
routing to follow later) if the ACPI implementation is marked as
having a quirky PCI bus/interrupt configuration. If MPBIOS is also
defined, it'll do the job instead.


# 1.3 15-May-2003 fvdl

Try a little harder to find PCI buses in the MPACPI code, in a (probably
futile) attempt to get quirky ACPI implementations going.

Work around a problem with quirky MP tables for ioapic interrupt routing.


# 1.2 11-May-2003 fvdl

Remove machine/cputypes include.


# 1.1 11-May-2003 fvdl

Moved here from sys/arch/i386/i386