Skip to content

Commit

Permalink
fix(virtio/transport): make notif_addr a *mut le32
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Jun 1, 2024
1 parent 0af14e5 commit b12a6c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/drivers/virtio/transport/mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use virtio_spec::mmio::{
DeviceRegisterVolatileFieldAccess, DeviceRegisterVolatileWideFieldAccess, DeviceRegisters,
InterruptStatus,
};
use virtio_spec::DeviceStatus;
use virtio_spec::{le32, DeviceStatus};
use volatile::VolatileRef;

#[cfg(any(feature = "tcp", feature = "udp"))]
Expand Down Expand Up @@ -340,16 +340,16 @@ pub struct NotifCtrl {
/// Indicates if VIRTIO_F_NOTIFICATION_DATA has been negotiated
f_notif_data: bool,
/// Where to write notification
notif_addr: *mut u32,
notif_addr: *mut le32,
}

impl NotifCtrl {
/// Returns a new controller. By default MSI-X capabilities and VIRTIO_F_NOTIFICATION_DATA
/// are disabled.
pub fn new(notif_addr: *mut usize) -> Self {
pub fn new(notif_addr: *mut le32) -> Self {
NotifCtrl {
f_notif_data: false,
notif_addr: notif_addr as *mut u32,
notif_addr,
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/drivers/virtio/transport/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use core::sync::atomic::{fence, Ordering};
use core::{mem, ptr};

use virtio_spec::pci::{CommonCfg, CommonCfgVolatileFieldAccess, CommonCfgVolatileWideFieldAccess};
use virtio_spec::DeviceStatus;
use virtio_spec::{le32, DeviceStatus};
use volatile::VolatileRef;

#[cfg(all(not(feature = "rtl8139"), any(feature = "tcp", feature = "udp")))]
Expand Down Expand Up @@ -742,13 +742,13 @@ pub struct NotifCtrl {
/// Indicates if VIRTIO_F_NOTIFICATION_DATA has been negotiated
f_notif_data: bool,
/// Where to write notification
notif_addr: *mut usize,
notif_addr: *mut le32,
}

impl NotifCtrl {
/// Returns a new controller. By default MSI-X capabilities and VIRTIO_F_NOTIFICATION_DATA
/// are disabled.
pub fn new(notif_addr: *mut usize) -> Self {
pub fn new(notif_addr: *mut le32) -> Self {
NotifCtrl {
f_notif_data: false,
notif_addr,
Expand Down

0 comments on commit b12a6c2

Please sign in to comment.