Commit Graph

189 Commits

Author SHA1 Message Date
bjorn3 386a63df42 pcid: Replace get_capabilities with get_vendor_capabilities
While this stops returning raw MSI/MSI-X capabilities from
get_capabilities, the same info can be obtained using
fetch_all_features and feature_info.
2024-06-14 11:12:06 +02:00
bjorn3 d2084e58cb pcid: Remove PciFunc 2024-06-13 15:06:49 +02:00
bjorn3 d3dc2e0f80 pcid: Remove all PciFunc methods 2024-06-13 14:52:02 +02:00
bjorn3 f6a709ee5a pcid: Simplify PciFunc::read_range
This also avoids UB caused by creating a slice of uninitialized u8.
2024-06-11 21:05:25 +02:00
bjorn3 8e02a87474 pcid: Reduce visibility of MsiCapability and MsixCapability methods 2024-06-11 16:57:58 +02:00
bjorn3 4f583b1cfb Store decoded MSI info instead of full capability in PciFeatureInfo 2024-06-11 16:48:43 +02:00
bjorn3 df66633111 pcid: Store decoded MsixInfo instead of full capability in PciFeatureInfo 2024-06-10 21:00:07 +02:00
bjorn3 7c112c34dd pcid: Remove some unused methods on MsixCapability 2024-06-10 19:44:12 +02:00
bjorn3 15c9ad1ba6 pcid: Ensure MSI and MSI-X are not enabled at the same time 2024-06-10 19:44:12 +02:00
bjorn3 588bbfe6a3 pcid: Stop returning feature enable status from fetch_all_features
For the same reason the feature_status method was removed.
2024-06-10 19:44:12 +02:00
bjorn3 e14e56349f pcid: Remove method to get the current feature status
Devices should never change the feature status behind the back of the
driver, so storing the current status after setting it is fine. Drivers
should reset all state when they start to recover from a crashed driver,
so they shouldn't need to get the current feature status at startup
either.
2024-06-10 19:44:12 +02:00
bjorn3 123eef9635 pcid: Move capability offset into the Capability enum
This makes it easier to move to using pci_types for parsing PCI
capabilities.
2024-06-10 19:44:12 +02:00
bjorn3 027d952c39 pcid: Remove parsing of unused capabilities
This will make it easier to switch to pci_types for capability parsing
in the future.
2024-06-09 20:38:46 +02:00
bjorn3 8f9bbecd0c pcid: Rustfmt main.rs 2024-06-09 20:38:46 +02:00
bjorn3 fd3cf79884 pcid: Move spawning and interacting with subdrivers out of main.rs 2024-06-09 20:38:46 +02:00
bjorn3 eb2e670cd6 pcid: Explain why PciBar is used instead of pcid_types::Bar 2024-06-09 18:53:19 +02:00
bjorn3 b04915673d pcid: Remove ConfigReader and ConfigWriter traits
Only PciFunc implements this trait.
2024-06-09 18:51:55 +02:00
bjorn3 d70cf080bb pcid: Remove with_pci_func_raw 2024-06-09 18:46:35 +02:00
bjorn3 9aed7d560e pcid: Merge CapabilityOffsetsIter into CapabilitiesIter 2024-06-09 18:21:50 +02:00
bjorn3 9d37d15827 pcid: Avoid duplicate read of vendor and device id 2024-06-09 18:14:52 +02:00
bjorn3 1593884938 pcid: Use capability_pointer method instead of a raw read 2024-06-09 18:14:49 +02:00
bjorn3 7f5a340c83 pcid: Remove cap_pointer from PciHeader::PciToPci
It is never used.
2024-06-09 18:14:46 +02:00
bjorn3 ba6b91d561 pcid: Move print_pci_function to a PciHeader method 2024-06-09 16:46:59 +02:00
bjorn3 4b384066f2 Use pci_types for setting the interrupt line 2024-06-09 15:05:47 +02:00
bjorn3 7ddae5fa03 pcid: Add fixme 2024-06-09 14:03:32 +02:00
bjorn3 3737a70cc1 pcid: Reduce visibility of server handle send/recv 2024-06-09 14:03:16 +02:00
bjorn3 6825d9b2ba pcid: Remove support for connecting to non-default server 2024-06-09 14:03:16 +02:00
bjorn3 785f53c70c pcid: Stop explicitly passing PciAddress to several functions
The PciHeader/PciEndpointHeader argument already contains the
PciAddress.
2024-06-09 14:03:13 +02:00
bjorn3 38a729bc76 Handle some stabilized rustc features 2024-06-09 14:03:13 +02:00
bjorn3 020a3ef631 pcid: Update to pci_types 0.9.0 2024-06-09 14:03:10 +02:00
4lDO2 4c35e88997 Use latest event queue interface everywhere. 2024-03-31 14:30:04 +02:00
Jacob Lorentzon ff956fd3bb Switch to libredox where applicable (fixed) 2024-03-18 22:09:25 +00:00
Jeremy Soller 98078650f8 Revert "Switch to libredox where applicable."
This reverts commit 2e7dbf1cc1.
2024-03-18 15:00:52 -06:00
4lDO2 2e7dbf1cc1 Switch to libredox where applicable. 2024-03-18 19:23:05 +01:00
bjorn3 15c8ab2331 Search for PCI ECAM in the device tree on ARM 2024-03-17 17:15:34 +01:00
Jacob Lorentzon e7a6bb6c81 Only do one memory:physical map per MCFG entry. 2024-02-20 22:27:14 +00:00
Jeremy Soller de2fae8183 Do not compile MSI-X function for x86 32-bit 2024-02-16 20:52:37 -07:00
bjorn3 67d3015e2e Add helper for allocating a single MSI/MSI-X interrupt vector
It doesn't actually configure the device to emit it though, but does
make this easier to do.
2024-01-25 14:43:44 +01:00
bjorn3 ecdcefba69 Clarify message_address argument names 2024-01-24 14:28:40 +01:00
bjorn3 f43aa8574c Simplify MSI-X table pointer computation 2024-01-24 14:28:40 +01:00
bjorn3 7dbf22331b Share msix config validation code 2024-01-24 14:28:40 +01:00
bjorn3 354c351b19 Unify device info printing between drivers 2024-01-23 13:01:40 +01:00
bjorn3 77b97bb2ed Introduce PciBar::physmap_mem helper 2024-01-23 12:02:40 +01:00
bjorn3 4302a35a7e Remove a couple of unused functions from MsixCapability
The set and write methods were useless as no rpc call is exposed by
pcid to actually write the new values. As for the rest, there were
no uses and they can be emulated using the other methods.
2024-01-22 20:44:17 +01:00
bjorn3 ad23ad5d93 Introduce irq_handle helper for legacy interrupts 2024-01-22 19:35:18 +01:00
bjorn3 bd6716efe4 Make legacy_interrupt_line an Option
Drivers don't need to know the exact legacy_interrupt_pin in use.
Just if legacy interrupts are enabled and if so which
legacy_interrupt_line is used.
2024-01-22 19:35:06 +01:00
bjorn3 e972047567 Use EndpointHeader methods for the command and status registers 2024-01-22 18:12:37 +01:00
bjorn3 623d12f276 Only try to load drivers for endpoint functions
For bridge functions we don't have any existing drivers and we
currently panic if we would try to load a driver for them.
2024-01-22 18:03:46 +01:00
bjorn3 545596f296 Don't try to fetch BARs unless there is a matching driver
Fetching BARs will temporarily invalidate them, which could cause
crashes if a driver happens to access it at the same time. As we
don't yet use a single pcid instance, we don't know which devices
have a driver attached or not. As such approximate this as the set
of devices for which the current pcid instance would load a driver.
2024-01-22 17:54:38 +01:00
bjorn3 18529f6cee Remove PciClass in favor of pci_types::DeviceType 2024-01-22 16:57:53 +01:00