devices: add IDs and constants for virtio-media

BUG=b:308718439
BUG=b:348316475
BUG=b:347118653
TEST=emerge-brya chromeos-base/crosvm

Change-Id: I6c795cf2f5d384670c8f15722c0d91ba2b3c22a2
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5906969
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Alexandre Courbot 2024-10-07 13:13:31 +09:00 committed by crosvm LUCI
parent 8d06f7a776
commit 82e0b2f81c
5 changed files with 16 additions and 0 deletions

View file

@ -156,6 +156,11 @@ pub mod snd {
}
}
pub mod media {
const QUEUE_SIZE: u16 = 256;
pub const QUEUE_SIZES: &[u16] = &[QUEUE_SIZE, QUEUE_SIZE];
}
pub mod video {
use data_model::Le32;
use serde::Deserialize;

View file

@ -184,6 +184,7 @@ pub enum DeviceType {
Wl = virtio_ids::VIRTIO_ID_WL,
Tpm = virtio_ids::VIRTIO_ID_TPM,
Pvclock = virtio_ids::VIRTIO_ID_PVCLOCK,
Media = virtio_ids::VIRTIO_ID_MEDIA,
}
impl DeviceType {
@ -214,6 +215,7 @@ impl DeviceType {
DeviceType::Wl => 2, // in, out
DeviceType::Tpm => 1, // request queue
DeviceType::Pvclock => 1, // request queue
DeviceType::Media => 2, // commandq, eventq
}
}
}
@ -243,6 +245,7 @@ impl std::fmt::Display for DeviceType {
DeviceType::VideoEncoder => write!(f, "video-encoder"),
DeviceType::Mac80211HwSim => write!(f, "mac80211-hwsim"),
DeviceType::Scmi => write!(f, "scmi"),
DeviceType::Media => write!(f, "media"),
}
}
}

View file

@ -445,6 +445,10 @@ impl VirtioPciDevice {
PciClassCode::MultimediaController,
&PciMultimediaSubclass::VideoController as &dyn PciSubclass,
),
DeviceType::Media => (
PciClassCode::MultimediaController,
&PciMultimediaSubclass::VideoController as &dyn PciSubclass,
),
DeviceType::Scmi => (
PciClassCode::BaseSystemPeripheral,
&PciBaseSystemPeripheralSubclass::Other as &dyn PciSubclass,

View file

@ -58,6 +58,8 @@ VIRTIO_IDS_EXTRAS="
// Added by virtio_sys/bindgen.sh - do not edit the generated file.
// TODO(b/236144983): Fix this id when an official virtio-id is assigned to this device.
pub const VIRTIO_ID_PVCLOCK: u32 = 61;
// TODO: Remove this once the ID is included in the Linux headers.
pub const VIRTIO_ID_MEDIA: u32 = 49;
"
bindgen_generate \

View file

@ -14,6 +14,8 @@
// Added by virtio_sys/bindgen.sh - do not edit the generated file.
// TODO(b/236144983): Fix this id when an official virtio-id is assigned to this device.
pub const VIRTIO_ID_PVCLOCK: u32 = 61;
// TODO: Remove this once the ID is included in the Linux headers.
pub const VIRTIO_ID_MEDIA: u32 = 49;
pub const VIRTIO_ID_NET: u32 = 1;
pub const VIRTIO_ID_BLOCK: u32 = 2;