Commit Graph

945 Commits

Author SHA1 Message Date
bjorn3 9262d034bd Port virtio-netd to driver-network 2024-02-27 14:07:17 +01:00
bjorn3 de6beb8992 Implement network:mac in all remaining network drivers 2024-02-26 20:48:02 +01:00
bjorn3 3751c915fe Unify the scheme handling of all network drivers
This deduplicates a fair bit of non-trivial logic and makes it easier to
keep all network drivers in sync when the interface changes.
2024-02-26 20:43:41 +01:00
Jeremy Soller 7b3e809573 Merge branch 'optimize_pcid_grants' into 'master'
Only do one memory:physical map per MCFG entry.

See merge request redox-os/drivers!139
2024-02-20 22:27:14 +00:00
Jacob Lorentzon e7a6bb6c81 Only do one memory:physical map per MCFG entry. 2024-02-20 22:27:14 +00:00
Jeremy Soller a2e9e28195 Fix build for 32-bit x86 2024-02-16 21:17:02 -07:00
Jeremy Soller c52e17dd46 Even more fixes for 32-bit x86 2024-02-16 21:00:13 -07:00
Jeremy Soller 2c672a0568 More fixes for 32-bit x86 2024-02-16 20:58:54 -07:00
Jeremy Soller 2a4e292e1d virtio-core: mark CommonCfg as packed 2024-02-16 20:52:55 -07:00
Jeremy Soller de2fae8183 Do not compile MSI-X function for x86 32-bit 2024-02-16 20:52:37 -07:00
Jeremy Soller 40e2189e22 ahcid: spin for all requests 2024-02-15 16:00:52 -07:00
Jeremy Soller 74a64bf2bb Merge branch 'fix-aarch64-build' into 'master'
ihdad, rtl8139d, rtl8168d, virtio-core, xhcid: Fix aarch64 build

See merge request redox-os/drivers!140
2024-02-10 17:21:04 +00:00
Enver Balalic 7439262994 ihdad, rtl8139d, rtl8168d, virtio-core, xhcid: Fix aarch64 build 2024-02-10 19:03:36 +01:00
Jeremy Soller c432f0fddf Merge branch 'pci_interrupts_rework2' into 'master'
Various improvements to the MSI-X support

See merge request redox-os/drivers!138
2024-01-26 17:27:17 +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 9b809312c2 Ignore MSI-X PBA in all drivers
It isn't used in any driver and even on Linux no driver seems to use it
at all. The only times it seems to be useful are if you were to mask an
interrupt and want to check if the interrupt fired without unmasking or
if you want to make the device itself trigger an interrupt.
2024-01-24 14:28:40 +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
Jeremy Soller 5f845538ea Merge branch 'pci_interrupts_rework' into 'master'
Couple of interrupt handling cleanups and some other changes

See merge request redox-os/drivers!137
2024-01-24 13:21:24 +00:00
Jeremy Soller 21add3ed09 Merge branch 'pci_use_pci_types2' into 'master'
Use the pci_types crate for writing the command register and reading the status register

See merge request redox-os/drivers!136
2024-01-24 13:19:46 +00: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 c13161c4a5 Fix nvmed 2024-01-22 19:57:24 +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
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