The NetBSD Project

CVS log for src/sys/dev/pci/pci_resource.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / dev / pci

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.7: download - view: text, markup, annotated - select for diffs
Mon Mar 3 19:38:43 2025 UTC (2 weeks, 1 day ago) by riastradh
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +57 -42 lines
pci_resource(9): Handle multiple bus ranges too.

Seen on orion o6.

Prompted by:

PR port-amd64/59118: Thinkpad T495s - iwm PCI BAR is zero

Revision 1.6: download - view: text, markup, annotated - select for diffs
Mon Mar 3 19:02:30 2025 UTC (2 weeks, 1 day ago) by riastradh
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +213 -122 lines
pci_resource(9): Handle multiple ranges of the same type.

Rather than having the caller fill in an array indexed by range type
of a single start/end pair for each type, the caller will now do:

	struct pci_resource_info info;

	memset(&info, 0, sizeof(info));

	pci_resource_add_range(&info, PCI_RANGE_MEM, mstart1, mend1);
	pci_resource_add_range(&info, PCI_RANGE_MEM, mstart2, mend2);
	pci_resource_add_range(&info, PCI_RANGE_MEM, mstart3, mend3);
	pci_resource_add_range(&info, PCI_RANGE_PMEM, pstart1, pend1);
	pci_resource_add_range(&info, PCI_RANGE_IO, iostart1, ioend1);
	...

While here, fix a format string -- 0x% or %# is enough to say that
the output is hexadecimal; we don't need to belabour the point by
printing a `0x0x' prefix!

XXX While this handles multiple io/mem/prefetchable-mem ranges, it
doesn't yet handle multiple bus ranges, which we have seen in
practice, e.g. on orion o6.  TBD.

ok jmcneill@

PR port-amd64/59118: Thinkpad T495s - iwm PCI BAR is zero

Revision 1.3.2.2: download - view: text, markup, annotated - select for diffs
Wed Jul 3 19:13:19 2024 UTC (8 months, 2 weeks ago) by martin
Branches: netbsd-10
CVS tags: netbsd-10-1-RELEASE
Diff to: previous 1.3.2.1: preferred, colored; branchpoint 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3.2.1: +12 -7 lines
Pull up following revision(s) (requested by jmcneill in ticket #735):

	sys/dev/pci/pci_resource.c: revision 1.5
	sys/arch/arm/pci/pci_msi_machdep.c: revision 1.10
	sys/arch/aarch64/include/vmparam.h: revision 1.21
	sys/dev/acpi/acpi_resource.c: revision 1.43

pci_resource: Make unexpected bus numbers in bridges non-fatal.

Firmware bugs happen. Log a warning and continue instead of panicing.
acpi: Ignore producer/consumer bit for fixed memory resources.

The requirement to honour the producer/consumer bit in fixed memory
resource descriptors was dropped at some point in a revision to the ACPI
2.0 specification because too many firmware implementations got it wrong.

aarch64: Bump VM_PHYSSEG_MAX to match DRAM_BANKS / FDT_MEMORY_RANGES.

On aarch64 there is a single free list, so VM_PHYSSEG_MAX needs to be
the same as FDT_MEMORY_RANGES (which needs to be the same as DRAM_BANKS).

Future cleanup should be done to fold these into a single define.

arm: pci: Fix ITS ID lookup for MSIs.
pci_get_frameid expects a BDF requestor ID as input, not a Device ID.

Fixes MSI/MSI-X support on Ampere Altra systems.

Revision 1.4.2.1: download - view: text, markup, annotated - select for diffs
Mon Jul 1 01:01:14 2024 UTC (8 months, 2 weeks ago) by perseant
Branches: perseant-exfatfs
Diff to: previous 1.4: preferred, colored; next MAIN 1.5: preferred, colored
Changes since revision 1.4: +12 -7 lines
Sync with HEAD.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Sun Jun 30 09:30:45 2024 UTC (8 months, 2 weeks ago) by jmcneill
Branches: MAIN
CVS tags: perseant-exfatfs-base-20240630
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +12 -7 lines
pci_resource: Make unexpected bus numbers in bridges non-fatal.

Firmware bugs happen. Log a warning and continue instead of panicing.

Revision 1.3.2.1: download - view: text, markup, annotated - select for diffs
Wed Nov 29 12:34:46 2023 UTC (15 months, 2 weeks ago) by martin
Branches: netbsd-10
CVS 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
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +42 -9 lines
Pull up following revision(s) (requested by jmcneill in ticket #483):

	sys/dev/pci/pci_resource.c: revision 1.4

pci: Improve resource allocation for non-prefetchable BARs.

When allocating resources for PCI devices, use the following criteria:
  - Prefetchable memory must be allocated from the prefetchable range
    of the parent bridge.
  - For 64-bit MMIO, try the prefetchable range first, and fallback to
    the non-prefetchable range. The idea here is to preserve 32-bit resources
    for 32-bit BARs.
  - For 32-bit MMIO, try the non-prefetchable range first. If that fails,
    make one last attempt at allocating from the prefetchable range, in the
    event that it has resources below 4GB.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Sun Nov 12 13:56:20 2023 UTC (16 months ago) by jmcneill
Branches: MAIN
CVS tags: perseant-exfatfs-base
Branch point for: perseant-exfatfs
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +42 -9 lines
pci: Improve resource allocation for non-prefetchable BARs.

When allocating resources for PCI devices, use the following criteria:
 - Prefetchable memory must be allocated from the prefetchable range
   of the parent bridge.
 - For 64-bit MMIO, try the prefetchable range first, and fallback to
   the non-prefetchable range. The idea here is to preserve 32-bit resources
   for 32-bit BARs.
 - For 32-bit MMIO, try the non-prefetchable range first. If that fails,
   make one last attempt at allocating from the prefetchable range, in the
   event that it has resources below 4GB.

Revision 1.3: download - view: text, markup, annotated - select for diffs
Sat Oct 15 20:11:44 2022 UTC (2 years, 5 months ago) by riastradh
Branches: MAIN
CVS tags: thorpej-ifq-base, thorpej-ifq, thorpej-altq-separation-base, thorpej-altq-separation, netbsd-10-base, netbsd-10-0-RC1
Branch point for: netbsd-10
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +7 -7 lines
pci_resource(9): Fix whitespace.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Sat Oct 15 20:11:00 2022 UTC (2 years, 5 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +5 -10 lines
pci_resource(9): vmem_create and vmem_add never fail with VM_SLEEP.

Prune dead error branches.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Fri Oct 14 22:10:15 2022 UTC (2 years, 5 months ago) by jmcneill
Branches: MAIN
Add a PCI resource manager and use it on Arm ACPI platforms.

The Arm ACPI code relied on PCI_NETBSD_CONFIGURE to configure devices that
were not enabled by system firmware. This is not safe to do unless the
firmware explicitly permits it using a device specific method defined in
the PCI firmware spec.

Introduce a new PCI resource manager that discovers what has already been
configured by firmware and allocates from the remaining space. This will
ensure that devices setup by firmware are untouched and only will program
BARs of devices that are not enabled at boot time.

The current implementation assumes that the parent PCI-PCI bridge's
are already configured. A worthwhile improvement in the future would be
to support programming windows for bridges that are not fully configured.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options

CVSweb <webmaster@jp.NetBSD.org>