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
Jeremy Soller
f624ed92f7
Merge branch 'pci_use_pci_types' into 'master'
...
Start using the pci_types crate
See merge request redox-os/drivers!135
2024-01-22 16:12:54 +00: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
d2431d4140
Make all parsing in PciHeader::from_reader use pci_types
2024-01-22 16:32:18 +01:00
Jeremy Soller
fda74cb359
Merge branch 'pci_cleanup2' into 'master'
...
Couple more pci cleanups
See merge request redox-os/drivers!134
2024-01-22 15:06:46 +00: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
5192816de7
Introduce expect_port and expect_mem helpers
2024-01-21 21:12:24 +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
e5772c132b
Remove a lot of fields from PciHeader which are unlikely to be used
...
Some of these are removed with PCIe while many others only need to be
used by the firmware to initialize the PCI bridges. If we ever need
them anyway, we can always add them back, but for now it improves
readability.
2024-01-21 19:12:35 +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
Jeremy Soller
e2976d0f52
Merge branch 'pci_force_pcid_interface' into 'master'
...
Migrate all PCI drivers to pcid_interface
See merge request redox-os/drivers!133
2024-01-20 23:08:12 +00:00
Jeremy Soller
a4acf55ad8
Merge branch 'pci_cleanup' into 'master'
...
Couple more pcid cleanups
See merge request redox-os/drivers!132
2024-01-20 23:07:34 +00:00
bjorn3
dc13752d74
Force usage of pcid_interface
2024-01-20 19:42:06 +01:00
bjorn3
3b4d0e858f
Migrate vboxd to pcid_interface (untested)
2024-01-20 19:26:46 +01:00
bjorn3
878a02f29f
Migrate ixgbed to pcid_interface (untested)
2024-01-20 19:13:27 +01:00
bjorn3
075e28339f
Migrate e1000d to pcid_interface
2024-01-20 19:04:15 +01:00
bjorn3
d950e33184
Migrate ac97d to pcid_interface
2024-01-20 18:58:09 +01:00
bjorn3
f9f3407f36
Migrate ahacid to pcid_interface
2024-01-20 18:51:29 +01:00
bjorn3
558f11b3eb
Migrate bgad to pcid_interface
2024-01-20 18:34:40 +01:00
bjorn3
de7677604e
Use hex instead of decimal in all config.toml
...
This matches the way basically everyone prints PCI ids
2024-01-20 17:59:38 +01:00
bjorn3
382047b14e
Rename the pcie module to cfg_access
2024-01-20 16:04:18 +01:00
bjorn3
d832717bf9
Remove a bit of dead code
2024-01-20 14:42:29 +01:00
bjorn3
20eb92ae02
Assert PCI config space accesses are aligned
2024-01-20 14:36:37 +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
Jeremy Soller
46b83bac04
Merge branch 'pci_perf' into 'master'
...
Improve performance of PCIe MMIO config space accesses
See merge request redox-os/drivers!131
2024-01-19 22:25:15 +00:00
bjorn3
cf7fbacdaf
Stop leaking Mcfg again
...
We don't need it after Pcie::new anymore
2024-01-19 19:53:39 +01:00
bjorn3
529b4935ee
Physmap all buses upfront
...
This avoids a costly Mutex lock and BTreeMap lookup for each config
space access.
2024-01-19 19:50:11 +01:00
bjorn3
23d963361a
Fix a couple of warnings
2024-01-19 19:14:22 +01:00
bjorn3
cb9edcb7d6
Reduce log verbosity of Capability::parse_vendor by combining some logs
2024-01-19 19:11:05 +01:00
bjorn3
8d87b701ba
Remove Mcfgs type
...
This wrapper was only useful back when we accepted multiple MCFG tables.
2024-01-19 19:10:35 +01:00
bjorn3
ae7e2dac9f
Only parse a single MCFG ACPI table
...
There should only be one and Linux only parses the first one too.
2024-01-19 18:41:28 +01:00
bjorn3
07c029ec21
Add a fixme for using ACPI
2024-01-19 18:10:57 +01:00
Jeremy Soller
b014145232
Merge branch 'pci_types' into 'master'
...
A bunch of pci improvements
See merge request redox-os/drivers!130
2024-01-19 16:18:00 +00:00
bjorn3
101f062b56
Remove a couple of error conditions in Mcfgs::fetch()
...
* Every directory entry has to have a filename, so use unwrap
* Handle non-UTF-8 ACPI table filenames by using as_encoded_bytes
2024-01-19 14:58:09 +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