Commit Graph

101 Commits

Author SHA1 Message Date
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 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 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
Jacob Lorentzon e7a6bb6c81 Only do one memory:physical map per MCFG entry. 2024-02-20 22:27:14 +00: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 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
bjorn3 fb0dcb384b Use pci_types in a couple more places in PciHeader::from_reader 2024-01-22 16:48:52 +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 d1b6009e3d Start converting PciHeader::from_reader to pci_types 2024-01-22 15:25:08 +01:00
bjorn3 0b611dca04 Start using the pci_types crate 2024-01-22 11:25:43 +01:00
bjorn3 d56881de88 Use CfgAccess instead of ConfigReader in PciHeader::from_reader
This will enable getting BAR sizes directly inside this function in the future.
2024-01-22 11:00:17 +01:00
bjorn3 cc015eab13 Move PciHeader out of the pcid_interface crate 2024-01-21 21:25:50 +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 92914e808c Reduce code indentation one level 2024-01-21 14:03:33 +01:00
bjorn3 b9c4c61dcc Move driver matching to config.rs 2024-01-21 13:02:47 +01:00
bjorn3 92428c535b Only enable redox scheme logger when compiling for redox
This allows running pcid tests on the host.
2024-01-21 11:35:06 +01:00
bjorn3 dc13752d74 Force usage of pcid_interface 2024-01-20 19:42:06 +01:00
bjorn3 382047b14e Rename the pcie module to cfg_access 2024-01-20 16:04:18 +01:00
bjorn3 cb7dc2abd2 Only set iopl for helper threads when actually necessary 2024-01-20 14:17:51 +01:00
bjorn3 3cbfbf6442 Move the IO port based fallback for PCI out of the pci module
The pci module is included in the pcid_interface library, which never
needs it.
2024-01-20 14:07:31 +01:00
bjorn3 4f20b90fc3 Remove PciBus and PciDev types
They weren't used in a load bearing way. If we want to keep persistent
state about buses and devices in the future they would probably get a
different shape.
2024-01-20 13:38:45 +01:00
bjorn3 07c029ec21 Add a fixme for using ACPI 2024-01-19 18:10:57 +01:00
bjorn3 240e59e2bf Handle pci buses without a device at the first slot 2024-01-19 14:45:48 +01:00
bjorn3 c611988768 Fix MCFG parsing for PCIe 2024-01-19 13:19:53 +01:00
bjorn3 15249127a5 Fix a couple of warnings 2024-01-19 12:47:42 +01:00
bjorn3 2b5ed69a06 Use PciAddress in a couple more places 2024-01-19 12:40:54 +01:00
bjorn3 42b2f52d41 Directly store a PciAddress inside PciFunc instead of a PciDev + num 2024-01-19 12:29:22 +01:00
bjorn3 a7c5391c6c Introduce PciAddress type copied from the pci_types crate 2024-01-19 12:14:00 +01:00
4lDO2 ba661f9719 Replace SYS_PIPE2 with libc::pipe in pcid. 2023-08-31 21:20:23 +02:00
Ron Williams 156be64a9d pcid: replace add that should allow wrapping with explicit wrapping_add 2023-07-27 01:22:56 -07: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 96246acca5 pcid: Optimize PCI bus scanning 2023-02-15 20:05:25 -07:00
Jeremy Soller 5bbe2e3f4c ahci, ihda, pci, xhci: logging adjustments 2023-02-15 19:30:59 -07: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
Jeremy Soller 4bca3e55d3 Fix xhcid compilation 2022-08-31 08:49:39 -06:00
4lDO2 21e30b7339 Replace syscall::clone() with libc::fork(). 2022-07-27 16:25:01 +02:00
4lDO2 d426ffacea Update toolchain to 2022-03-18. 2022-03-19 15:06:29 +01:00
Jeremy Soller 31bae74334 Merge branch 'code_hygiene' into 'master'
Code hygiene

See merge request redox-os/drivers!72
2020-08-08 12:55:24 +00:00