History log of /netbsd-current/sys/external/bsd/drm2/include/linux/pci.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.58 19-May-2024 riastradh

linux: Add a few more cases to pci_get_class.

Should fix crash on boot with amdgpu now that the ACPI business is
enabled.


Revision tags: thorpej-ifq-base thorpej-altq-separation-base
# 1.57 30-Sep-2023 mrg

drm: enable almost all PCIe functionality

linux_pci.c revisions 1.24 and 1.25 implemented most of the remaining
missing PCIe backends, but only enabled them for some amdgpu portions.

this enables all code marked with "XXX amdgpu pcie", "XXX radeon pcie",
and "XXX pcie speed". for most of it, simply removing #ifndefs __NetBSD__
to enable compliation was required, once the new "bus->max_bus_speed"
member was added to struct pci_bus. add an "always fails" backend for
pci_enable_atomic_ops_to_root() which seems to only be necessary
for virtual GPU functionality (and could be implemented if needed.)

tested on radeon 5450, 7750, R7 240 [radeon], and RX 550 [amdgpu], and
nvidia 750 and 1030 [nouveau].


this still does not quite work on nvidia cards. there are two problems
that remain:

- the call to set the link speed is skipped because the speed is set
to the default value of "-1". nvkm_pcie_set_link() will actually
determine the right value for this and for some cards, calling this
function if the current speed is -1 helps set the link speed. it
may be that on linux other paths we don't have enabled properly
would set this (there's one via debugfs, and a jetson specific one,
though perhaps setting either AC or DC speed values as boot options
(after hooking up these for netbsd) would currently work.

- worse, cards newer than kepler - geforce 900, 1000, and newer, are
all lacking the backing support to set pcie link speed. the GT 1030
card i have been testing with remains at pcie 1.0.


Revision tags: netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base
# 1.56 25-Oct-2022 riastradh

linux/pci.h: Stubs for pci_request/release_region(s).


# 1.55 17-Oct-2022 mrg

add pcie capability and read request size linux compat, some pci root support

implement support for:
- pcie_capability_read_dword()
- pcie_capability_read_word()
- pcie_capability_write_dword()
- pcie_capability_write_word()
- pcie_get_readrq()
- pcie_set_readrq()

implement the "struct pci_dev" bus->self member by creating a minimal fake
"struct pci_dev" for the pci bus itself. this is kind of gross. it checks
that the current device's parent is a netbsd "pci" device, and that it has
a (grand) parent "ppb" device, and then fills in the fake device based upon
the pci and ppb devices.

add some PCIE_LCSR2_TGT_LSPEED encodings, and map them to linux names.
map several other PCIE_LCSR and PCIE_LCAP names.

uncomment several pcie code segments in radeon and amdgpu. (not sure that
we can test the amdgpu_si.c change, as we use the radeon version and the
amdgpu version hangs on the one machine i have.)

tested on amdgpu (RX550) and radeon (7750 & 3650).


ok @riastradh


Revision tags: bouyer-sunxi-drm-base
# 1.54 20-Sep-2022 mrg

fill out more of the linux pci API compat

- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and
pci_is_root_bus().
- expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds.
- add "enum pcie_link_width".
- add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW
(negotiated lane width) to pcireg.h
- enable amdgpu_device_get_pcie_info() code now it works.

ok riastradh@


# 1.53 27-Feb-2022 riastradh

linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


# 1.52 27-Feb-2022 riastradh

drm: Omit needless conditionals around #include "acpica.h".


# 1.51 19-Dec-2021 riastradh

linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC.


# 1.50 19-Dec-2021 riastradh

linux: pci_name


# 1.49 19-Dec-2021 riastradh

i915: another whack at it


# 1.48 19-Dec-2021 riastradh

drm: Remove local diffs for drm_pci_set_busid.

Instead, move it to its own file that can be safely used without
bringing in a link/run-time dependency on pci.


# 1.47 19-Dec-2021 riastradh

Move acpi includes to linux_pci.c to avoid pollution.


# 1.46 19-Dec-2021 riastradh

Provide enum pci_bus_speed

We don't really make use of it but why not.


Author: Maya Rashish <maya@NetBSD.org>


# 1.45 19-Dec-2021 riastradh

Stub dev_is_pci


Author: Maya Rashish <maya@NetBSD.org>


# 1.44 19-Dec-2021 riastradh

Define pci_is_thunderbolt_attached (answer: no).


# 1.43 19-Dec-2021 riastradh

Side-load <linux/interrupt.h> in <linux/pci.h>.


# 1.42 19-Dec-2021 riastradh

Define pci_get/set_drvdata properly.


# 1.41 19-Dec-2021 riastradh

pci_get_bus_and_slot -> pci_get_domain_bus_and_slot


# 1.40 19-Dec-2021 riastradh

Define some obscure PCI ids.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-4-RELEASE netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.57 30-Sep-2023 mrg

drm: enable almost all PCIe functionality

linux_pci.c revisions 1.24 and 1.25 implemented most of the remaining
missing PCIe backends, but only enabled them for some amdgpu portions.

this enables all code marked with "XXX amdgpu pcie", "XXX radeon pcie",
and "XXX pcie speed". for most of it, simply removing #ifndefs __NetBSD__
to enable compliation was required, once the new "bus->max_bus_speed"
member was added to struct pci_bus. add an "always fails" backend for
pci_enable_atomic_ops_to_root() which seems to only be necessary
for virtual GPU functionality (and could be implemented if needed.)

tested on radeon 5450, 7750, R7 240 [radeon], and RX 550 [amdgpu], and
nvidia 750 and 1030 [nouveau].


this still does not quite work on nvidia cards. there are two problems
that remain:

- the call to set the link speed is skipped because the speed is set
to the default value of "-1". nvkm_pcie_set_link() will actually
determine the right value for this and for some cards, calling this
function if the current speed is -1 helps set the link speed. it
may be that on linux other paths we don't have enabled properly
would set this (there's one via debugfs, and a jetson specific one,
though perhaps setting either AC or DC speed values as boot options
(after hooking up these for netbsd) would currently work.

- worse, cards newer than kepler - geforce 900, 1000, and newer, are
all lacking the backing support to set pcie link speed. the GT 1030
card i have been testing with remains at pcie 1.0.


Revision tags: netbsd-10-base
# 1.56 25-Oct-2022 riastradh

linux/pci.h: Stubs for pci_request/release_region(s).


# 1.55 17-Oct-2022 mrg

add pcie capability and read request size linux compat, some pci root support

implement support for:
- pcie_capability_read_dword()
- pcie_capability_read_word()
- pcie_capability_write_dword()
- pcie_capability_write_word()
- pcie_get_readrq()
- pcie_set_readrq()

implement the "struct pci_dev" bus->self member by creating a minimal fake
"struct pci_dev" for the pci bus itself. this is kind of gross. it checks
that the current device's parent is a netbsd "pci" device, and that it has
a (grand) parent "ppb" device, and then fills in the fake device based upon
the pci and ppb devices.

add some PCIE_LCSR2_TGT_LSPEED encodings, and map them to linux names.
map several other PCIE_LCSR and PCIE_LCAP names.

uncomment several pcie code segments in radeon and amdgpu. (not sure that
we can test the amdgpu_si.c change, as we use the radeon version and the
amdgpu version hangs on the one machine i have.)

tested on amdgpu (RX550) and radeon (7750 & 3650).


ok @riastradh


Revision tags: bouyer-sunxi-drm-base
# 1.54 20-Sep-2022 mrg

fill out more of the linux pci API compat

- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and
pci_is_root_bus().
- expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds.
- add "enum pcie_link_width".
- add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW
(negotiated lane width) to pcireg.h
- enable amdgpu_device_get_pcie_info() code now it works.

ok riastradh@


# 1.53 27-Feb-2022 riastradh

linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


# 1.52 27-Feb-2022 riastradh

drm: Omit needless conditionals around #include "acpica.h".


# 1.51 19-Dec-2021 riastradh

linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC.


# 1.50 19-Dec-2021 riastradh

linux: pci_name


# 1.49 19-Dec-2021 riastradh

i915: another whack at it


# 1.48 19-Dec-2021 riastradh

drm: Remove local diffs for drm_pci_set_busid.

Instead, move it to its own file that can be safely used without
bringing in a link/run-time dependency on pci.


# 1.47 19-Dec-2021 riastradh

Move acpi includes to linux_pci.c to avoid pollution.


# 1.46 19-Dec-2021 riastradh

Provide enum pci_bus_speed

We don't really make use of it but why not.


Author: Maya Rashish <maya@NetBSD.org>


# 1.45 19-Dec-2021 riastradh

Stub dev_is_pci


Author: Maya Rashish <maya@NetBSD.org>


# 1.44 19-Dec-2021 riastradh

Define pci_is_thunderbolt_attached (answer: no).


# 1.43 19-Dec-2021 riastradh

Side-load <linux/interrupt.h> in <linux/pci.h>.


# 1.42 19-Dec-2021 riastradh

Define pci_get/set_drvdata properly.


# 1.41 19-Dec-2021 riastradh

pci_get_bus_and_slot -> pci_get_domain_bus_and_slot


# 1.40 19-Dec-2021 riastradh

Define some obscure PCI ids.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.56 25-Oct-2022 riastradh

linux/pci.h: Stubs for pci_request/release_region(s).


# 1.55 17-Oct-2022 mrg

add pcie capability and read request size linux compat, some pci root support

implement support for:
- pcie_capability_read_dword()
- pcie_capability_read_word()
- pcie_capability_write_dword()
- pcie_capability_write_word()
- pcie_get_readrq()
- pcie_set_readrq()

implement the "struct pci_dev" bus->self member by creating a minimal fake
"struct pci_dev" for the pci bus itself. this is kind of gross. it checks
that the current device's parent is a netbsd "pci" device, and that it has
a (grand) parent "ppb" device, and then fills in the fake device based upon
the pci and ppb devices.

add some PCIE_LCSR2_TGT_LSPEED encodings, and map them to linux names.
map several other PCIE_LCSR and PCIE_LCAP names.

uncomment several pcie code segments in radeon and amdgpu. (not sure that
we can test the amdgpu_si.c change, as we use the radeon version and the
amdgpu version hangs on the one machine i have.)

tested on amdgpu (RX550) and radeon (7750 & 3650).


ok @riastradh


Revision tags: bouyer-sunxi-drm-base
# 1.54 20-Sep-2022 mrg

fill out more of the linux pci API compat

- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and
pci_is_root_bus().
- expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds.
- add "enum pcie_link_width".
- add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW
(negotiated lane width) to pcireg.h
- enable amdgpu_device_get_pcie_info() code now it works.

ok riastradh@


# 1.53 27-Feb-2022 riastradh

linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


# 1.52 27-Feb-2022 riastradh

drm: Omit needless conditionals around #include "acpica.h".


# 1.51 19-Dec-2021 riastradh

linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC.


# 1.50 19-Dec-2021 riastradh

linux: pci_name


# 1.49 19-Dec-2021 riastradh

i915: another whack at it


# 1.48 19-Dec-2021 riastradh

drm: Remove local diffs for drm_pci_set_busid.

Instead, move it to its own file that can be safely used without
bringing in a link/run-time dependency on pci.


# 1.47 19-Dec-2021 riastradh

Move acpi includes to linux_pci.c to avoid pollution.


# 1.46 19-Dec-2021 riastradh

Provide enum pci_bus_speed

We don't really make use of it but why not.


Author: Maya Rashish <maya@NetBSD.org>


# 1.45 19-Dec-2021 riastradh

Stub dev_is_pci


Author: Maya Rashish <maya@NetBSD.org>


# 1.44 19-Dec-2021 riastradh

Define pci_is_thunderbolt_attached (answer: no).


# 1.43 19-Dec-2021 riastradh

Side-load <linux/interrupt.h> in <linux/pci.h>.


# 1.42 19-Dec-2021 riastradh

Define pci_get/set_drvdata properly.


# 1.41 19-Dec-2021 riastradh

pci_get_bus_and_slot -> pci_get_domain_bus_and_slot


# 1.40 19-Dec-2021 riastradh

Define some obscure PCI ids.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.55 17-Oct-2022 mrg

add pcie capability and read request size linux compat, some pci root support

implement support for:
- pcie_capability_read_dword()
- pcie_capability_read_word()
- pcie_capability_write_dword()
- pcie_capability_write_word()
- pcie_get_readrq()
- pcie_set_readrq()

implement the "struct pci_dev" bus->self member by creating a minimal fake
"struct pci_dev" for the pci bus itself. this is kind of gross. it checks
that the current device's parent is a netbsd "pci" device, and that it has
a (grand) parent "ppb" device, and then fills in the fake device based upon
the pci and ppb devices.

add some PCIE_LCSR2_TGT_LSPEED encodings, and map them to linux names.
map several other PCIE_LCSR and PCIE_LCAP names.

uncomment several pcie code segments in radeon and amdgpu. (not sure that
we can test the amdgpu_si.c change, as we use the radeon version and the
amdgpu version hangs on the one machine i have.)

tested on amdgpu (RX550) and radeon (7750 & 3650).


ok @riastradh


Revision tags: bouyer-sunxi-drm-base
# 1.54 20-Sep-2022 mrg

fill out more of the linux pci API compat

- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and
pci_is_root_bus().
- expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds.
- add "enum pcie_link_width".
- add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW
(negotiated lane width) to pcireg.h
- enable amdgpu_device_get_pcie_info() code now it works.

ok riastradh@


# 1.53 27-Feb-2022 riastradh

linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


# 1.52 27-Feb-2022 riastradh

drm: Omit needless conditionals around #include "acpica.h".


# 1.51 19-Dec-2021 riastradh

linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC.


# 1.50 19-Dec-2021 riastradh

linux: pci_name


# 1.49 19-Dec-2021 riastradh

i915: another whack at it


# 1.48 19-Dec-2021 riastradh

drm: Remove local diffs for drm_pci_set_busid.

Instead, move it to its own file that can be safely used without
bringing in a link/run-time dependency on pci.


# 1.47 19-Dec-2021 riastradh

Move acpi includes to linux_pci.c to avoid pollution.


# 1.46 19-Dec-2021 riastradh

Provide enum pci_bus_speed

We don't really make use of it but why not.


Author: Maya Rashish <maya@NetBSD.org>


# 1.45 19-Dec-2021 riastradh

Stub dev_is_pci


Author: Maya Rashish <maya@NetBSD.org>


# 1.44 19-Dec-2021 riastradh

Define pci_is_thunderbolt_attached (answer: no).


# 1.43 19-Dec-2021 riastradh

Side-load <linux/interrupt.h> in <linux/pci.h>.


# 1.42 19-Dec-2021 riastradh

Define pci_get/set_drvdata properly.


# 1.41 19-Dec-2021 riastradh

pci_get_bus_and_slot -> pci_get_domain_bus_and_slot


# 1.40 19-Dec-2021 riastradh

Define some obscure PCI ids.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.54 20-Sep-2022 mrg

fill out more of the linux pci API compat

- implement pcie_get_speed_cap(), pcie_bandwidth_available(), and
pci_is_root_bus().
- expand "enum pci_bus_speed" to add PCIe 5.x and 6.x speeds.
- add "enum pcie_link_width".
- add defines for PCIE_LCSR_LINKSPEED (PCIe generation) and PCIE_LCSR_NLW
(negotiated lane width) to pcireg.h
- enable amdgpu_device_get_pcie_info() code now it works.

ok riastradh@


# 1.53 27-Feb-2022 riastradh

linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


# 1.52 27-Feb-2022 riastradh

drm: Omit needless conditionals around #include "acpica.h".


# 1.51 19-Dec-2021 riastradh

linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC.


# 1.50 19-Dec-2021 riastradh

linux: pci_name


# 1.49 19-Dec-2021 riastradh

i915: another whack at it


# 1.48 19-Dec-2021 riastradh

drm: Remove local diffs for drm_pci_set_busid.

Instead, move it to its own file that can be safely used without
bringing in a link/run-time dependency on pci.


# 1.47 19-Dec-2021 riastradh

Move acpi includes to linux_pci.c to avoid pollution.


# 1.46 19-Dec-2021 riastradh

Provide enum pci_bus_speed

We don't really make use of it but why not.


Author: Maya Rashish <maya@NetBSD.org>


# 1.45 19-Dec-2021 riastradh

Stub dev_is_pci


Author: Maya Rashish <maya@NetBSD.org>


# 1.44 19-Dec-2021 riastradh

Define pci_is_thunderbolt_attached (answer: no).


# 1.43 19-Dec-2021 riastradh

Side-load <linux/interrupt.h> in <linux/pci.h>.


# 1.42 19-Dec-2021 riastradh

Define pci_get/set_drvdata properly.


# 1.41 19-Dec-2021 riastradh

pci_get_bus_and_slot -> pci_get_domain_bus_and_slot


# 1.40 19-Dec-2021 riastradh

Define some obscure PCI ids.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.53 27-Feb-2022 riastradh

linux: Define PCI_CLASS_DISPLAY_OTHER, wanted by radeon/amdgpu.


# 1.52 27-Feb-2022 riastradh

drm: Omit needless conditionals around #include "acpica.h".


# 1.51 19-Dec-2021 riastradh

linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC.


# 1.50 19-Dec-2021 riastradh

linux: pci_name


# 1.49 19-Dec-2021 riastradh

i915: another whack at it


# 1.48 19-Dec-2021 riastradh

drm: Remove local diffs for drm_pci_set_busid.

Instead, move it to its own file that can be safely used without
bringing in a link/run-time dependency on pci.


# 1.47 19-Dec-2021 riastradh

Move acpi includes to linux_pci.c to avoid pollution.


# 1.46 19-Dec-2021 riastradh

Provide enum pci_bus_speed

We don't really make use of it but why not.


Author: Maya Rashish <maya@NetBSD.org>


# 1.45 19-Dec-2021 riastradh

Stub dev_is_pci


Author: Maya Rashish <maya@NetBSD.org>


# 1.44 19-Dec-2021 riastradh

Define pci_is_thunderbolt_attached (answer: no).


# 1.43 19-Dec-2021 riastradh

Side-load <linux/interrupt.h> in <linux/pci.h>.


# 1.42 19-Dec-2021 riastradh

Define pci_get/set_drvdata properly.


# 1.41 19-Dec-2021 riastradh

pci_get_bus_and_slot -> pci_get_domain_bus_and_slot


# 1.40 19-Dec-2021 riastradh

Define some obscure PCI ids.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.51 19-Dec-2021 riastradh

linux: PCI_BUS_NUM; tweak types for PCI_SLOT/PCI_FUNC.


# 1.50 19-Dec-2021 riastradh

linux: pci_name


# 1.49 19-Dec-2021 riastradh

i915: another whack at it


# 1.48 19-Dec-2021 riastradh

drm: Remove local diffs for drm_pci_set_busid.

Instead, move it to its own file that can be safely used without
bringing in a link/run-time dependency on pci.


# 1.47 19-Dec-2021 riastradh

Move acpi includes to linux_pci.c to avoid pollution.


# 1.46 19-Dec-2021 riastradh

Provide enum pci_bus_speed

We don't really make use of it but why not.


Author: Maya Rashish <maya@NetBSD.org>


# 1.45 19-Dec-2021 riastradh

Stub dev_is_pci


Author: Maya Rashish <maya@NetBSD.org>


# 1.44 19-Dec-2021 riastradh

Define pci_is_thunderbolt_attached (answer: no).


# 1.43 19-Dec-2021 riastradh

Side-load <linux/interrupt.h> in <linux/pci.h>.


# 1.42 19-Dec-2021 riastradh

Define pci_get/set_drvdata properly.


# 1.41 19-Dec-2021 riastradh

pci_get_bus_and_slot -> pci_get_domain_bus_and_slot


# 1.40 19-Dec-2021 riastradh

Define some obscure PCI ids.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3
# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.39 14-Feb-2020 maya

Reduce diffs by side-loading some header files like Linux.

From riastradh


Revision tags: ad-namecache-base2
# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

branches: 1.37.6;
Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.38 18-Jan-2020 jmcneill

Pull in acpica.h on aarch64


Revision tags: ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2; 1.24.4;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


Revision tags: isaki-audio2-base pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.37 27-Aug-2018 riastradh

Move the Linux PCI shim into its very own .c file.

The poor thing has deserved this for a very long time, even though it
is full of kludges. Also I'm tired of recompiling everything every
time I touch it.


# 1.36 27-Aug-2018 riastradh

Fix sense of test to make linux_pci_dev_destroy work.


# 1.35 27-Aug-2018 riastradh

Initialize more of struct pci_device.


# 1.34 27-Aug-2018 riastradh

Implement linux_pci_dev_destroy.


# 1.33 27-Aug-2018 riastradh

Pass the parent explicitly to linux_pci_dev_init.

This will allow us to use it in match routines.


# 1.32 27-Aug-2018 riastradh

Free the bus crap.


# 1.31 27-Aug-2018 riastradh

For the kludges we don't have or need a device (parent) pointer.


# 1.30 27-Aug-2018 riastradh

Add no_64bit_msi field. (What to do wiht it?)


# 1.29 27-Aug-2018 riastradh

Add pci_enable/disable_device, pci_domain_nr, and some vendor ids.


# 1.28 27-Aug-2018 riastradh

Add pci_bus_read/write_config_{byte,word,dword}.


# 1.27 27-Aug-2018 riastradh

Namespace our private fields in Linux struct pci_device.


# 1.26 27-Aug-2018 riastradh

Stub pci_is_root_bus.


# 1.25 27-Aug-2018 riastradh

Forward-declare struct pci_driver, which is unused but appears in prototypes.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base tls-maxphys-base-20171202
# 1.24 31-Aug-2017 maya

branches: 1.24.2;
Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

branches: 1.23.6;
drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.24 31-Aug-2017 maya

Disable MSI on DRMKMS (again).

It is causing problems on some older nvidia graphics cards:
http://mail-index.netbsd.org/netbsd-users/2017/08/02/msg020026.html
http://mail-index.netbsd.org/pkgsrc-users/2017/08/26/msg025492.html
PR kern/52440


Revision tags: nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320
# 1.23 02-Mar-2017 nonaka

drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

branches: 1.22.2; 1.22.4;
Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


# 1.23 02-Mar-2017 nonaka

drmkms_pci: Use MSI if available (Take 2)

tested by martin@ and yhardy@


Revision tags: 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
# 1.22 17-Jan-2016 riastradh

Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.


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
# 1.22 17-Jan-2016 riastradh

Use PCI ROM MD fallback if PCI ROM BAR points to invalid ROM.

We previously applied the PCI ROM MD fallback only if the PCI ROM BAR
was altogether unpopulated. Some Radeon devices seem to have a
populated PCI ROM BAR pointing at a bogus ROM, while 0xc0000 works
fine.

Fixes at least one manifestation of PR kern/49964.


Revision tags: nick-nhusb-base-20151226
# 1.21 27-Oct-2015 riastradh

Eliminate Linux struct pci_dev::dev, struct platform_device::dev.


# 1.20 17-Oct-2015 jmcneill

Don't include ACPI headers unless NACPICA > 0


Revision tags: nick-nhusb-base-20150921
# 1.19 24-Jun-2015 riastradh

Fix type of pd_rom_found_size: it's a size, not a handle.


# 1.18 24-Jun-2015 riastradh

Save the location of the found ROM so caller can bus_space_read it.


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406
# 1.17 06-Apr-2015 riastradh

Missed a zero: it's 0x100000, not 0x10000.


# 1.16 06-Apr-2015 riastradh

Don't let anyone else allocate the video BIOS either.


# 1.15 06-Mar-2015 riastradh

One last round for nouveau. It links!


# 1.14 25-Feb-2015 riastradh

Add sizep argument to pci_platform_rom stub.


# 1.13 25-Feb-2015 riastradh

Add pci_platform_rom stub to <linux/pci.h>.


# 1.12 25-Feb-2015 riastradh

Add pci_enable_rom/pci_disable_rom to <linux/pci.h>.


Revision tags: nick-nhusb-base
# 1.11 11-Nov-2014 nonaka

branches: 1.11.2;
fix build failure.

> /tmp/bracket/build/2014.11.10.22.43.46-i386/src/sys/external/bsd/drm2/include/linux/pci.h:36:20: fatal error: acpica.h: No such file or directory


# 1.10 05-Nov-2014 nonaka

i915drmkms(4): Enable CONFIG_ACPI if NACPICA > 0.
Now brightness can be adjusted via hotkey on Mouse Computer LB-J300X (Clevo W330SU2).


# 1.9 16-Oct-2014 riastradh

Generalize pci_find_rom and use it to locate x86 video ROM in drm2.

- Make pci_find_rom take the ROM `BAR' size as a parameter, instead
of using pci_find_mem with the ROM `BAR' to detect the size.

- Use it to find the x86 video ROM in [0xc0000, 0xe0000) in drm2,
when nothing else reports that location.

- Adapt the one other caller in radeonfb, which already has the
maximum ROM size handy (romsz).

XXX pullup to netbsd-7


# 1.8 13-Aug-2014 riastradh

branches: 1.8.2;
Fix shifts & masks in Linux pci_read_config_{word,byte}.


Revision tags: tls-maxphys-base netbsd-7-base tls-earlyentropy-base
# 1.7 06-Aug-2014 riastradh

branches: 1.7.2;
Add Linux PCI DMA stuff and NVIDIA vendor.


# 1.6 16-Jul-2014 riastradh

Remove needless pci_map_rom error messages.


# 1.5 16-Jul-2014 riastradh

First whack at radeon driver.

No hardware to test yet, but it builds.


# 1.4 16-Jul-2014 riastradh

Make it build and boot on my test machines.

Screen blanks on boot on the Ivy Bridge system with

DRM error in cpt_serr_int_handler: PCH transcoder A FIFO underrun

But after that everything is OK. Appears to be an upstream problem.
To investigate...

I think there's a cache flushing issue somewhere -- there are little
display artefacts on my T60.


Revision tags: yamt-pagecache-base9 rmind-smpnet-base rmind-smpnet-nbase
# 1.3 03-Apr-2014 riastradh

branches: 1.3.2; 1.3.4; 1.3.6;
Miscellaneous fixes for drm2 on i386.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 1.2 18-Mar-2014 riastradh

Merge riastradh-drm2 to HEAD.


Revision tags: riastradh-drm2-base3
# 1.1 24-Jul-2013 riastradh

branches: 1.1.2;
file pci.h was initially added on branch riastradh-drm2.