History log of /netbsd-current/sys/dev/pci/ppb.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.75 26-Nov-2023 rin

ppb(4): Print out PCIe Gen5 link speed correctly


Revision tags: thorpej-ifq-base thorpej-altq-separation-base netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
# 1.74 10-Oct-2021 msaitoh

Use PCI-SIG official acronyms:

- RP stands for Root Port.
- RC stands for Root Complex.
- RCIEP stands for Root Complex Integrated End Point.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.73 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.72 11-May-2021 thorpej

branches: 1.72.4;
Forward the bridge's devhandle to the downstream bus.


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

branches: 1.71.2; 1.71.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
# 1.70 12-Jul-2020 rin

branches: 1.70.4;
Remove duplicate include of opt_ppb.h.
No binary changes.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.69 09-Jul-2019 msaitoh

branches: 1.69.2;
Identify 16GT/s.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8; 1.63.10;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.74 10-Oct-2021 msaitoh

Use PCI-SIG official acronyms:

- RP stands for Root Port.
- RC stands for Root Complex.
- RCIEP stands for Root Complex Integrated End Point.


Revision tags: thorpej-i2c-spi-conf2-base
# 1.73 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.72 11-May-2021 thorpej

branches: 1.72.4;
Forward the bridge's devhandle to the downstream bus.


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

branches: 1.71.2; 1.71.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
# 1.70 12-Jul-2020 rin

branches: 1.70.4;
Remove duplicate include of opt_ppb.h.
No binary changes.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.69 09-Jul-2019 msaitoh

Identify 16GT/s.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8; 1.63.10;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.73 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.72 11-May-2021 thorpej

branches: 1.72.4;
Forward the bridge's devhandle to the downstream bus.


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

branches: 1.71.2; 1.71.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
# 1.70 12-Jul-2020 rin

branches: 1.70.4;
Remove duplicate include of opt_ppb.h.
No binary changes.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.69 09-Jul-2019 msaitoh

Identify 16GT/s.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8; 1.63.10;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.72 11-May-2021 thorpej

Forward the bridge's devhandle to the downstream bus.


Revision tags: cjep_staticlib_x-base thorpej-i2c-spi-conf-base
# 1.71 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
# 1.70 12-Jul-2020 rin

branches: 1.70.4;
Remove duplicate include of opt_ppb.h.
No binary changes.


Revision tags: netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.69 09-Jul-2019 msaitoh

Identify 16GT/s.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8; 1.63.10;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.71 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
# 1.70 12-Jul-2020 rin

branches: 1.70.4;
Remove duplicate include of opt_ppb.h.
No binary changes.


Revision tags: netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.69 09-Jul-2019 msaitoh

Identify 16GT/s.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8; 1.63.10;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.70 12-Jul-2020 rin

Remove duplicate include of opt_ppb.h.
No binary changes.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.69 09-Jul-2019 msaitoh

Identify 16GT/s.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8; 1.63.10;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.69 09-Jul-2019 msaitoh

Identify 16GT/s.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8; 1.63.10;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


Revision tags: isaki-audio2-base
# 1.68 01-Mar-2019 msaitoh

- Almost all ppbreg.h's definitions are also in pcireg.h. Remove duplicated
definitions from ppbreg.h and move some definitions from ppbreg.h to
pcireg.h.
- Change fast back-to-back "capable" to "enable" in pci_subr.c.
- Print Primary Discard Timer, Secondary Discard Timer, Discard Timer Status
and Discard Timer SERR# Enable bit in pci_subr.c.
- PCI_BRIDGE_PREFETCHBASE32_REG and PCI_BRIDGE_PREFETCHLIMIT32_REG are
"upper" 32bit registers, rename to *UP32_REG to avoid confusion.
- Use macro.


# 1.67 29-Jan-2019 msaitoh

If the secondary bus is configured and the bus mastering is not enabled,
enable it. Suggested by thorpej@.


# 1.66 28-Jan-2019 msaitoh

Explicitly enable bus masterling in case BIOS, UEFI or firmware don't enable
it. Might fix PR kern/53811.


# 1.65 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 1.64 07-Dec-2018 msaitoh

- defflag PPB_USEINTR
- Print "interrupting at "


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 jdolecek-ncqfixes-base 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 prg-localcount2-base3 prg-localcount2-base2
# 1.63 10-May-2017 msaitoh

branches: 1.63.2; 1.63.8;
Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.63 10-May-2017 msaitoh

Fix typos.


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.62 09-May-2017 msaitoh

- Fix a bug that a device which has no PCIe capability incorrectly
accessess the PCI config area in ppbdetach().
- Don't add event counters if slot interrupt isn't used.


Revision tags: prg-localcount2-base1
# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

branches: 1.60.2;
Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


# 1.61 27-Apr-2017 msaitoh

Make ppb(4) interrupt support stable:
- Disable all interrupts in the beginning of attach. Without this, interrupt
storm occurs while cold == 1 on some environment.
- Disable command complete interrput for a while to prevent hangup on some
enviroment. I'm sorry, I don't know what this bit is :-|
- Check all status bits and return 0 if an interrupt is not for me. It's
required for INTx. Tested on XEN3_DOM0 because it doesn't support MSI yet.
- Return 1 when a interrupt is processed.


Revision tags: prg-localcount2-base
# 1.60 26-Apr-2017 msaitoh

Disable ppb(4)'s interrupt for a while. It causes hangup on some environment.
Define PPB_USEINTR if you'd like to use interrupt.


# 1.59 26-Apr-2017 msaitoh

Disable and disestablish interrupt in ppbdetach().


Revision tags: pgoyette-localcount-20170426
# 1.58 24-Apr-2017 chs

in ppbdetach(), try to detach the children before tearing down our own state,
to avoid trouble if detaching the children fails.


Revision tags: bouyer-socketcan-base1
# 1.57 18-Apr-2017 msaitoh

Enable PCIe's interrupt as much as possilbe in ppb(4) to detect and count
status change event. HotPlug function itself have not implemented yet.

- Interrupt and each event are counted by evcnt(9). Example:

ppb0 Interrupt 0 0 intr
ppb0 Attention Button Pressed 0 0 misc
ppb0 Power Fault Detected 0 0 misc
ppb0 MRL Sensor Changed 0 0 misc
ppb0 Presence Detect Changed 0 0 misc
ppb0 Command Completed 0 0 misc
ppb0 Data Link Layer State Changed 0 0 misc

- Print message if ppb_printevent is not zero. The default vaule is 0.
The output messages:

Attention Button Pressed
Power Fault Detected
MRL Sensor Changed
Presence Detect Changed
Command Completed
Data Link Layer State Changed

- Remove workaround code to disable interrupt (ppb.c rev. 1.35).

Tested with Dell Latitude 2120 without if_bge.c rev. 1.304's workaround.
dmesg when bge's device timeout occured:

ppb3: Presence Detect Changed
ppb3: Data Link Layer State Changed
ppb3: Presence Detect Changed

vmstat -e |grep ppb

ppb3 Interrupt 2 0 intr
ppb3 Presence Detect Changed 2 0 misc
ppb3 Data Link Layer State Changed 1 0 misc


Revision tags: jdolecek-ncq-base
# 1.56 05-Apr-2017 msaitoh

Move struct ppb_softc into ppbvar.h.


Revision tags: 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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

branches: 1.55.2; 1.55.4;
Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)


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 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.55 16-Nov-2015 msaitoh

Define PCIE_XCAP_{VER,TYPE}(x) and use them.


Revision tags: nick-nhusb-base-20150921 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.54 24-Sep-2014 msaitoh

branches: 1.54.2;
Rename PCIE_XCAP_VER_* macros to avoid confusion.


# 1.53 24-Sep-2014 msaitoh

- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
is not specification's version number but the capability structure's version
number. To avoid confusion, print "PCI Express capability version x".
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s -> GT/s


Revision tags: 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.52 21-Apr-2013 msaitoh

branches: 1.52.10;
Delete "PCI_" from PCIX and PICE capability registers.


Revision tags: agc-symver-base
# 1.51 06-Mar-2013 yamt

ppb: fix link speed print


Revision tags: yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.50 20-Oct-2012 matt

Print out negotiated link width and speed for PCIe (merged from
matt-nb5-mips64).


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 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 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-base2 netbsd-6-base
# 1.49 29-Jan-2012 drochner

branches: 1.49.6;
extend the pci_aprint_devinfo slightly to cover the cases commonly
used by drivers: a short name for the quiet/naive case and a string
to override the "pcidevs" based name by one provided by the driver,
ride on yesterday's kernel minor version bump


# 1.48 26-Jan-2012 drochner

put printing of the pci_devinfo into its own function (not inlined
by purpose) - this is a stack hog, and with this change my uTCA amd64
system boots again
a lot of similar code can be eliminated from pci device drivers this way,
but before doing so (and making the new function part of the module API)
I'd like to consider a modification to make it work with drivers which
prefer to print names from other sources (like pciide)


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.47 21-Oct-2011 dyoung

branches: 1.47.2; 1.47.6;
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus < pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


# 1.46 17-Aug-2011 dyoung

Redefine PCI_MSI_* and PCI_PCIE_* constants in terms of bits(3).

Use named constants and more conventional variable names in
pci_msi_establish() and pci_msi_disestablish(). Fix a couple of bugs:
pci_msi_establish() returned a pointer to the struct intrhand instead of
to the struct msi_hdl as it was intended to, and pci_msi_disestablish()
did not free(9) the msi_hdl.


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base rmind-uvmplock-base
# 1.45 10-Jan-2011 cegger

add missing break


# 1.44 10-Jan-2011 jmcneill

ppb_fix_pcix changes:
- rename to ppb_fix_pcie
- support version PCI-E 2.0
- print version and device/port type information
- use constants from pcireg.h instead of magic numbers

changes:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: unsupported PCI Express version

to:

ppb2 at pci0 dev 21 function 0: vendor 0x15ad product 0x07a0 (rev. 0x01)
ppb2: PCI Express 2.0 <Root Port of PCI-E Root Complex>


Revision tags: matt-mips64-premerge-20101231
# 1.43 11-Dec-2010 matt

On powerpc, recognize PCI Express RC root bridges.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9
# 1.42 24-Feb-2010 dyoung

branches: 1.42.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.


Revision tags: uebayasi-xip-base
# 1.41 08-Jan-2010 dyoung

branches: 1.41.2;
Expand PMF_FN_* macros.


Revision tags: matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.40 02-Apr-2009 dyoung

During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base matt-mips64-base2 haad-dm-base1 wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 haad-dm-base wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 wrstuden-revivesa-base mjf-devfs2-base
# 1.39 03-May-2008 cegger

branches: 1.39.8; 1.39.10; 1.39.14; 1.39.18; 1.39.22;
device_t / softc split. Tested on amd64.
"looks good" spz


# 1.38 03-May-2008 cegger

unuspported -> unsupported


Revision tags: yamt-pf42-baseX yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.37 22-Feb-2008 dyoung

branches: 1.37.2; 1.37.4;
Add methods for detaching self and for detaching children.

Use device_t and accessors. Use aprint_*_dev().


Revision tags: nick-net80211-sync-base bouyer-xeni386-merge1 vmlocking2-base3 bouyer-xeni386-nbase yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 bouyer-xeni386-base mjf-devfs-base matt-armv6-base
# 1.36 09-Dec-2007 jmcneill

branches: 1.36.6; 1.36.10;
Merge jmcneill-pm branch.


Revision tags: yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base jmcneill-pm-base reinoud-bufcleanup-base
# 1.35 16-Oct-2007 joerg

branches: 1.35.6; 1.35.8;
Merge 1.34.22.7 from jmcneill-pm:
Next attempt at trying to fix the irregular interrupt storms on my
Thinkpad: when we find a PCI Express device, check the list of
notification events and if any are sets, clear them. We can't handle
them ATM anyway.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase nick-csl-alignment-base5 wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 yamt-x86pmap-base3 yamt-x86pmap-base2 netbsd-4-0-RC2 yamt-x86pmap-base netbsd-4-0-RC1 matt-mips64-base nick-csl-alignment-base yamt-idlelwp-base8 wrstuden-fixsa-base thorpej-atomic-base mjf-ufs-trans-base vmlocking-base ad-audiomp-base post-newlock2-merge newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.34 16-Nov-2006 christos

branches: 1.34.8; 1.34.22; 1.34.24; 1.34.26;
__unused removal on arguments; approved by core.


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

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


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 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 rpaulo-netinet-merge-pcb-base
# 1.32 11-Dec-2005 christos

branches: 1.32.20; 1.32.22;
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.31 28-Jun-2005 thorpej

branches: 1.31.2;
Use ANSI function decls and static.


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 kent-audio2-base
# 1.30 04-Feb-2005 perry

de-__P


Revision tags: yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 30-Aug-2004 drochner

branches: 1.29.4; 1.29.6;
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.28 23-Apr-2004 itojun

pass string length (= boundary info) to pci_devinfo so that we do not run over
the end of memory region


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.27 09-Dec-2003 briggs

Use aprint_*()


# 1.26 15-Jun-2003 fvdl

branches: 1.26.2;
Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base nathanw_sa_base
# 1.25 01-Jan-2003 thorpej

Use aprint_normal() in cfprint routines.


Revision tags: gmcgarry_ctxsw_base gmcgarry_ucred_base kqueue-aftermerge kqueue-beforemerge kqueue-base
# 1.24 02-Oct-2002 thorpej

Add trailing ; to CFATTACH_DECL.


# 1.23 30-Sep-2002 thorpej

Use CFATTACH_DECL().


# 1.22 27-Sep-2002 thorpej

Declare all cfattach structures const.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base
# 1.21 16-May-2002 thorpej

branches: 1.21.2;
* Add "pcitag_t *pba_bridgetag" to pci_attach_args. This is set to
NULL for root PCI busses. For busses behind a bridge, it points to
a persistent copy of the bridge's pcitag_t. This can be very useful
for machine-dependent PCI bus enumeration code.
* Implement a machine-dependent pci_enumerate_bus() for sparc64 which
uses OFW device nodes to enumerate the bus. When a PCI bus that is
behind a bridge is attached, pci_attach_hook() allocates a new PCI
chipset tag for the new bus and sets it's "curnode" to the OFW node
of the bridge. This is used as a starting point when enumerating
that bus. Root busses get the OFW node of the host bridge (psycho).
* Garbage-collect "ofpci" and "ofppb" from the sparc64 port.


Revision tags: eeh-devprop-base newlock-base ifpoll-base
# 1.20 13-Nov-2001 lukem

add RCSID


Revision tags: netbsd-1-5-PATCH003 thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base netbsd-1-5-PATCH002 netbsd-1-5-PATCH001 thorpej_scsipi_beforemerge thorpej_scsipi_nbase netbsd-1-5-RELEASE netbsd-1-5-BETA2 netbsd-1-5-BETA netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base fvdl-softdep-base thorpej_scsipi_base
# 1.19 04-Nov-1999 thorpej

branches: 1.19.6; 1.19.8;
Don't pass rd/mult capability though a PCI-PCI bridge. The bridge would
have to break it up into mutliple rd/line's anyhow, so why bother letting
the device issue it in the first place.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 comdex-fall-1999-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base eeh-paddr_t-base
# 1.18 08-Jun-1998 thorpej

branches: 1.18.14; 1.18.16; 1.18.20;
Nuke __BROKEN_INDIRECT_CONFIG.


# 1.17 04-Mar-1998 cgd

clean up slightly, correct a few comments


# 1.16 12-Jan-1998 thorpej

branches: 1.16.2;
Update for config changes.


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base thorpej-bus-dma-base
# 1.15 30-Aug-1997 mycroft

branches: 1.15.2; 1.15.4;
Pass down bus_dma_tag_t's as appropriate (per Jason's bus_dma code).


# 1.14 30-Aug-1997 mycroft

Pass the I/O and memory enable flags through the bridge.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.13 05-Dec-1996 cgd

update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.


# 1.12 21-Oct-1996 thorpej

New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.


# 1.11 13-Oct-1996 christos

backout kprintf changes


# 1.10 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


# 1.9 27-Aug-1996 cgd

change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.8 03-May-1996 christos

remove unused variables


# 1.7 27-Mar-1996 cgd

modify these to provide a new, better-specified PCI interface
(soon to be documented on mailing lists; eventually in section 9 manual
pages), most importantly:
(1) support interrupt pin swizzling on non-i386 systems with
PCI-PCI bridges (per PPB spec; done, but meaningless, on i386).
(2) provide pci_{io,mem}_find(), to determine what I/O or memory
space is described by a given PCI configuration space
mapping register.
(3) provide pci_intr_map(), pci_intr_string(), and
pci_intr_{,dis}establish() to manipulate and print info about
PCI interrupts.
(4) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.


# 1.6 17-Mar-1996 cgd

spacing nit


# 1.5 17-Mar-1996 thorpej

New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.


# 1.4 14-Mar-1996 cgd

These devices don't actually need softc's that are supersets of 'struct
device.' No point in adding that complexity + space if they're not needed,
so axe them.


# 1.3 14-Mar-1996 cgd

(1) provide #defines for cf_loc[] entries for devices that attach to
pcibus and pci.
(2) remove the #ifdef i386 from pci.c, and provide a machine-dependent
hook (pci_md_attach_hook()) to do any machine-dependent attachment
gunk, e.g. on the i386 printing out the configuration mode (if bus 0)
(3) don't pass max device number for a given bus in, use
PCI_MAX_DEVICE_NUMBER, which can be defined on a per-machine basis.
(defaults to 32. on i386, it's 32 if pci conf mode == 1, 16 if 2.)


# 1.2 04-Mar-1996 cgd

fix aux argument to config_found() for secondary bus.


# 1.1 28-Feb-1996 cgd

Preliminary support for PCI-PCI bridges. Recognize a PCI-PCI bridge
and attach the secondary pci bus as a 'pci' device. Note that this support
is incomplete and will not yet work for ports other than that i386. (The
i386 can rely on the PCI interrupt 'line' information to determine
interrupt mapping, which is not necessarily possible on other systems.)