16 Commits

Author SHA1 Message Date
Travis Geiselbrecht
72112c0676 [pci] little bit of code cleanup in the pci bus driver
Mostly just suggestions by clang-tidy. No functional change.
2025-09-23 23:16:55 -07:00
Travis Geiselbrecht
bd423cad4d [lib][fdtwalk] skip scanning pci busses marked 'disabled' 2024-06-19 16:18:28 -07:00
Travis Geiselbrecht
2f98fbf772 [pci][fdt] do not attempt to configure PCI with 64bit bars on a 32bit system
Especially in the case where the 32bit system doesn't have an MMU, avoid
using any high addresses for BARs.
2024-05-09 22:18:19 -07:00
Pedro Falcato
93a8b45ada [bus][pci] Clarify device::assign_resource
The previous XXX comments were unnecessary as the spec defines the
bottom 3 bits as being hardwired and read-only.
2023-01-15 18:35:49 -08:00
Pedro Falcato
3b4dade91f [bus][pci] Disable IO and mem decoding around BAR enumeration
Disable IO and mem decoding around BAR enumation as described in the PCI
Local Bus specification. This behavior should be safer when messing
around BARs for BAR lengths.
2023-01-15 18:35:49 -08:00
Travis Geiselbrecht
96231b132f [bus][pci] make the pci bus dump on bootup use a little less horizontal space
Should fit better on an 80 column display
2022-10-19 00:24:10 -07:00
Travis Geiselbrecht
3a6c4aed8f [bus][pci] do not automatically initialize the bus manager in pci_init_legacy
This lets the caller do any last minute resource set up before starting
the bus manager. Is consistent with the way pci_init_ecam() works.
2022-10-18 23:58:18 -07:00
Travis Geiselbrecht
e555db5bda [bus][pci] at least register that MSIX is available
Doesn't yet have support for it, but set the bool and remember it was
present when scanning devices.
2022-02-27 19:36:59 -08:00
Travis Geiselbrecht
979cebecf2 [bus][pci] Make sure there's a fallback range in release mode 2022-02-06 20:50:24 -08:00
Travis Geiselbrecht
f1431b81d0 [bus][pci] Support for dynamically assigning BARs and bridges if needed
In the case of platforms where a bios or firmware has not already
assigned all the resources, do so. Requires the platform supply one or
more ranges of physical address space and IO that can be mapped into
BARs.

Handles iterating through bridges, computing the sizes of all the
peripherals downstream and rolling that up as well.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
36e73e0fac [bus][pci] add routines to pass in PCI bus resources prior to starting the pci bus manager
Wire them up on arm and riscv which need them. x86-pc does not, so dont
call it.

Also fix a few miscellaneous bugs, notably PCI not detecting 64bit bars
properly due to an off by one bit error.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
d5f394859d [bus][pci] first stab at assigning bus numbers to unconfigured bridges
Had to rearrange the proble logic somewhat, but now the bus manager will
assign consequtive bus numbers as it finds bridges and recursively
drills down to discover the entire bus structure.

Does not assign resources yet, but need to do this in the first pass
to find all of the devices before can figure out how much space they
occupy.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
ba21aa9236 [bus][pci] quick hack to not dive into bridges that appear unconfigured
This fixes an infinite recursion where it was stepped into bridge a
bridge that has the secondary bus set to 0, which caused it to start
over and probe bus 0 until it blew the stack.

Better fix is to actually assign busses.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
07f847e38a [bus][pci] add accessors for bridge ranges and print on dump 2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
95443413e8 [bus][pci] break the bus manager file into separate cpp files per object
No functional change aside from rearranging things.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
5e92f0adf7 [bus][pci] move the bus manager code into a subdir 2022-02-06 19:46:39 -08:00