Commit Graph

250 Commits

Author SHA1 Message Date
Jeremy Soller e3d5abdaa1 pcid: also scan bus 0x80 by default for Arrow Lake 2025-11-23 08:14:58 -07:00
Jeremy Soller 6a11465e3e pcid: allow unaligned access 2025-11-23 08:08:11 -07:00
Jeremy Soller 2e96800384 pcid: add access file 2025-11-22 17:29:11 -07:00
Jeremy Soller 93eeb4ca0b Adjust pcid logging 2025-11-02 08:00:19 -07:00
Jeremy Soller 28dd3596f3 More logging adjustments and set default level to info 2025-11-02 07:55:32 -07:00
Jeremy Soller 6d5523de2a Set all log levels, reduce unnecessary logs 2025-11-01 19:36:38 -06:00
Jeremy Soller b7e260747f array_chunks feature is stable in new nightly 2025-10-04 08:10:15 -06:00
bjorn3 2945b86b82 pcid: Helper to allocate first MSI interrupt 2025-08-30 19:14:01 +02:00
bjorn3 0b6b5e0d04 pcid: Move MappedMsixRegs to pcid_interface 2025-08-30 19:14:01 +02:00
bjorn3 191e6ac4eb pcid: Disable MSI and MSI-X before launching a driver 2025-08-30 18:34:41 +02:00
bjorn3 04ae0158c9 Update most crates to redox-scheme 0.6
A couple of crates need to stay on redox-scheme 0.4 as they need
cancellation for async schemes.
2025-07-04 22:13:24 +02:00
bjorn3 1d43e39b0e pcid: Handle #address-cells on interrupt parent 2025-04-12 14:55:17 +02:00
bjorn3 7625dcd0ce pcid: Avoid legacy scheme path format 2025-04-12 14:54:50 +02:00
bjorn3 fb24979c51 Reduce verbosity of debug logs during booting
These logs are only useful when actively working on the respective driver.
2025-03-15 21:09:12 +01:00
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 7dbce70d95 Get rid of the State struct and the Arc wrapper around Pcie 2025-03-01 17:19:06 +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 cffa5308a1 Use pico-args instead of structopt for pcid
It is much lighter weight.

Co-Authored-By: 4lDO2 <4lDO2@protonmail.com>
2025-02-27 20:07:12 +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 5b45f06cf3 Extract enable_function out of handle_parsed_header
This is the only part that actually modifies the PCI configuration. In
the future we will want to delay enabling a PCI device until it is
actually going to be used while still reading metadata about the PCI
device before that point.
2025-02-27 20:02:29 +01:00
bjorn3 581d9eea33 Replace a whole bunch more repr(packed) with repr(C, packed) 2025-02-22 16:19:25 +01:00
Jeremy Soller 471b9ebf4f Merge branch 'no_scan_single_function_device' into 'master'
Don't scan through all 8 functions of a single function PCI device

Closes #32

See merge request redox-os/drivers!232
2025-02-22 14:25:54 +00:00
bjorn3 6828b744fd Make Mcfg repr(C, packed) rather than repr(packed)
repr(packed) officially still allows reordering the fields.
2025-02-22 14:05:33 +01:00
bjorn3 1cae6512fa Don't scan through all 8 functions of a single function PCI device 2025-02-22 13:57:15 +01:00
bjorn3 898f8dc72b pcid: Remove usage of paw 2024-12-30 11:41:34 +01:00
bjorn3 e6139319e8 pcid: Remove a couple of unused dependencies 2024-12-30 11:40:02 +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
Andrey Turkin 18b688a49c Partial risc-v support 2024-10-17 20:07:17 +03:00
Kamil Koczurek e49fae6533 chore: fmt.sh 2024-09-30 13:22:34 +02:00
Kamil Koczurek d2c82add9d Move Io/Pio/Mmio from redox_syscall to common
* Fix Mmio repr from transparent to packed.
* Rename Mmio::from to Mmio::new.
* Remove dead imports around affected code.
* Minor formatting.
2024-09-30 13:01:36 +02: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 7935ed0248 Deduplicate setup_logging between all drivers
This will make it easier to change the way logging is done for all
drivers. This also fixes the log category for a couple of drivers as
well as makes failing to set the logger a fatal error. Only when a
logger is already set is it impossible to set another logger.
2024-07-24 22:00:40 +02:00
bjorn3 10f6c16141 Remove an incorrect assertion preventing access to PCI extended capabilities 2024-07-21 21:26:05 +02:00
bjorn3 15d2078a13 Handle daemonization of pcid in a better way
Currently pcid exits the main thread once it is done spawning drivers
and expects all background threads handling driver communication to stay
around. This only works as exitting the main thread on redox os
currently doesn't cause the whole process to die. This will have to be
fixed at some point for compatibility with programs that expect that
exitting the main thread kills all other threads in the process, at
which point pcid would break without the changes in this commit.
2024-07-20 15:11:34 +02: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
Jeremy Soller e7781dcced Fix compilation on aarch64 2024-06-24 11:43:17 -06:00
bjorn3 4ffed8096d Move all drivers to /usr/lib/drivers
This makes them harder to accidentally run them from the shell, which
would not work. In the future this may also allow embedding the driver
config in the driver executable itself without having to look at all
non-driver executables too.
2024-06-16 17:02:14 +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 16819bc693 pcid: Get rid of PciHeader
It is a reminant of when pci_types wasn't used yet and doesn't simplify
things a lot anymore.
2024-06-16 13:42:45 +02:00
bjorn3 a34266b029 pcid: Remove all PciEndpointHeader methods 2024-06-16 13:33:55 +02:00
bjorn3 6c2fdae08c pcid: Remove all tests of PciHeader 2024-06-16 13:32:11 +02:00
bjorn3 de4d79e69e pcid: Inline PciEndpointHeader::bars 2024-06-16 13:23:27 +02:00
bjorn3 160acff5a8 pcid: Move the code in PciHeader::display to other places 2024-06-16 13:20:16 +02:00