bjorn3
e7fe3183b0
Make all pcid_interface methods abort the process on errors
...
Effectively the only way to recover from errors in the communication
with pcid is by restarting the driver from scratch possibly after
restarting pcid. As such moving the aborts from individual drivers to
pcid_interface simplifies drivers while at the same time allowing nicer
error messages.
2025-03-02 12:36:35 +01:00
bjorn3
8f1549e284
Introduce a pci scheme and move driver spawning to pcid-spawner
...
This allows a single PCI daemon to run on the whole system, prevents
multiple drivers from claiming the same PCI device and makes it possible
for userspace to enumerate all available PCI devices. In the future this
will enable an lspci tool, possibly PCIe hot plugging and more.
Co-Authored-By: 4lDO2 <4lDO2@protonmail.com >
2025-03-01 17:18:15 +01:00
bjorn3
cd5604a054
Move config from pcid to pcid_interface
...
This will allow serializing/deserializing to be shared across programs.
For pcid-spawner will need to parse the config files and if we want to
embed config files into the driver executables at some point it may also
be useful.
2025-02-27 20:04:26 +01:00
bjorn3
2c042f8c98
Fix a ton of unused import warnings
2024-12-26 16:05:04 +01:00
Andrey Turkin
e5e753a426
Sync up with changes to kernel's phandle irq scheme
2024-12-18 21:16:30 +03:00
Andrey Turkin
8152de14a9
Remap PCI IRQs as instructed in FDT
2024-10-22 20:33:35 +03:00
Timothy Finnegan
806e8b42b7
Added an assertion to map_bar that causes the calling driver to panic rather than crash the kernel
2024-09-20 18:42:03 -07:00
Timothy Finnegan
306bb7d698
Added an assertion to map_bar that causes the calling driver to panic rather than crash the kernel
2024-09-20 18:39:25 -07:00
bjorn3
fd8dabd1bc
Use the new scheme format in most places
...
The graphics subsystem still uses the old format as orbital manually
parses the fpath result.
2024-07-11 21:14:45 +02:00
bjorn3
07aaf6ea94
pcid: Don't include source files in two different crates
...
This confuses rust-analyzer.
2024-06-16 15:29:09 +02:00
bjorn3
6d15fbba75
pcid: Move msi from pci to driver_interface
2024-06-16 15:23:32 +02:00
bjorn3
ba6224bc27
pcid: Move VendorSpecificCapability form pci to driver_interface
2024-06-16 15:21:51 +02:00
bjorn3
5c9bbb5c96
pcid: Move PciBar from pci to driver_interface
2024-06-16 15:20:52 +02:00
bjorn3
52d1c0fb4f
pcid: Move FullDeviceId from pci to driver_interface
2024-06-16 15:19:14 +02:00
bjorn3
2144eaa62c
Rustfmt pcid
2024-06-15 21:38:43 +02:00
bjorn3
23ac696491
pcid: Add PciFunctionHandle::map_bar method
...
This will enable the pcid driver interface to safely map the MSI-X table
in the future without having to worry about a BAR being mapped twice.
2024-06-15 15:47:48 +02:00
bjorn3
a3b957c2e5
pcid: Fetch config in PciFunctionHandle::connect_default()
2024-06-15 15:16:09 +02:00
bjorn3
fdb9ea816b
pcid: Rename PcidServerHandle to PciFunctionHandle
2024-06-15 15:05:59 +02:00
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
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
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
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
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
354c351b19
Unify device info printing between drivers
2024-01-23 13:01:40 +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
a5d0c7c354
Use pci_types for reading BARs
...
This simplifies a lot of code and adds support for 64bit BARs.
2024-01-22 15:54:18 +01:00
bjorn3
0b611dca04
Start using the pci_types crate
2024-01-22 11:25:43 +01:00
bjorn3
be0e6b9dd7
Pass self instead of &self to PciFeature methods
...
PciFeature is Copy, so passing it behind a reference is not necessary.
2024-01-21 20:46:00 +01:00
bjorn3
d0e90f5ded
Remove fetch_header from pcid_interface
...
Most things are already stored in SubdriverArguments and the couple of
things that aren't may change over time and thus should be read again
each time they are accessed, while fetch_header would receive a fixed
copy from pcid.
2024-01-21 19:35:39 +01:00
bjorn3
1890293e86
Introduce a FullDeviceId type and pass it in pcid_interface
2024-01-21 15:18:56 +01:00
bjorn3
2b5ed69a06
Use PciAddress in a couple more places
2024-01-19 12:40:54 +01:00
Anhad Singh
7e5a3196c2
pcid::server_handle: add get_capabilities
...
This commit adds the `get_capabilities` function to `PcidServerHandle`
which returns all of the `Capability`s (raw representation) of the PCI
device.
Signed-off-by: Anhad Singh <andypython@protonmail.com >
2023-06-19 12:18:56 +10:00
Jeremy Soller
a6bafa17b0
Add pcid methods to read/write pci config region
2022-09-12 21:47:16 -06:00
Jeremy Soller
e2a8255547
Allow reading PCI header through pcid socket
2022-09-07 12:15:41 -06:00
Wren Turkal
dadc0c6c10
Remove unused imports.
...
Signed-off-by: Wren Turkal <wt@penguintechs.org >
2020-08-01 12:48:06 -07:00
4lDO2
7b69d5b9b5
WIP: Use the enhanced pcid IPC.
2020-04-22 21:21:55 +02:00
4lDO2
4f62888bb4
Various fixes.
2020-04-21 15:42:51 +02:00