add a pci device view on boot
This commit is contained in:
parent
64a02bbf01
commit
d6e27bc1f4
|
@ -184,56 +184,61 @@ impl Display for PciFullClass {
|
||||||
write!(f, " Class: ")?;
|
write!(f, " Class: ")?;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
PciFullClass::Unclassified_NonVgaCompatible => write!(f, "\0LIGHTBLUE\0")?,
|
PciFullClass::Unclassified_NonVgaCompatible => write!(f, "\u{001A}LIGHTBLUE\u{001A}")?,
|
||||||
PciFullClass::Unclassified_VgaCompatible => write!(f, "\0LIGHTBLUE\0")?,
|
PciFullClass::Unclassified_VgaCompatible => write!(f, "\u{001A}LIGHTBLUE\u{001A}")?,
|
||||||
PciFullClass::MassStorage_ScsiBus => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_ScsiBus => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_IDE => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_IDE => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_Floppy => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_Floppy => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_IpiBus => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_IpiBus => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_RAID => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_RAID => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_ATA => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_ATA => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_SATA => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_SATA => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_SerialSCSI => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_SerialSCSI => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_NVM => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_NVM => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::MassStorage_Other => write!(f, "\0CYAN\0")?,
|
PciFullClass::MassStorage_Other => write!(f, "\u{001A}CYAN\u{001A}")?,
|
||||||
PciFullClass::Network_Ethernet => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_Ethernet => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_TokenRing => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_TokenRing => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_FDDI => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_FDDI => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_ATM => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_ATM => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_ISDN => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_ISDN => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_WorldFlip => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_WorldFlip => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_PICMG => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_PICMG => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_Infiniband => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_Infiniband => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_Fabric => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_Fabric => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Network_Other => write!(f, "\0MAGENTA\0")?,
|
PciFullClass::Network_Other => write!(f, "\u{001A}MAGENTA\u{001A}")?,
|
||||||
PciFullClass::Display_VGA => write!(f, "\0YELLOW\0")?,
|
PciFullClass::Display_VGA => write!(f, "\u{001A}YELLOW\u{001A}")?,
|
||||||
PciFullClass::Display_XGA => write!(f, "\0YELLOW\0")?,
|
PciFullClass::Display_XGA => write!(f, "\u{001A}YELLOW\u{001A}")?,
|
||||||
PciFullClass::Display_3D => write!(f, "\0YELLOW\0")?,
|
PciFullClass::Display_3D => write!(f, "\u{001A}YELLOW\u{001A}")?,
|
||||||
PciFullClass::Display_Other => write!(f, "\0YELLOW\0")?,
|
PciFullClass::Display_Other => write!(f, "\u{001A}YELLOW\u{001A}")?,
|
||||||
PciFullClass::Multimedia_Video => write!(f, "\0LIGHTBLUE\0")?,
|
PciFullClass::Multimedia_Video => write!(f, "\u{001A}LIGHTBLUE\u{001A}")?,
|
||||||
PciFullClass::Multimedia_AudioController => write!(f, "\0LIGHTBLUE\0")?,
|
PciFullClass::Multimedia_AudioController => write!(f, "\u{001A}LIGHTBLUE\u{001A}")?,
|
||||||
PciFullClass::Multimedia_Telephony => write!(f, "\0LIGHTBLUE\0")?,
|
PciFullClass::Multimedia_Telephony => write!(f, "\u{001A}LIGHTBLUE\u{001A}")?,
|
||||||
PciFullClass::Multimedia_AudioDevice => write!(f, "\0LIGHTBLUE\0")?,
|
PciFullClass::Multimedia_AudioDevice => write!(f, "\u{001A}LIGHTBLUE\u{001A}")?,
|
||||||
PciFullClass::Multimedia_Other => write!(f, "\0LIGHTBLUE\0")?,
|
PciFullClass::Multimedia_Other => write!(f, "\u{001A}LIGHTBLUE\u{001A}")?,
|
||||||
PciFullClass::Memory_RAM => write!(f, "\0BLUE\0")?,
|
PciFullClass::Memory_RAM => write!(f, "\u{001A}BLUE\u{001A}")?,
|
||||||
PciFullClass::Memory_Flash => write!(f, "\0WHITE\0")?,
|
PciFullClass::Memory_Flash => write!(f, "\u{001A}WHITE\u{001A}")?,
|
||||||
PciFullClass::Memory_Other => write!(f, "\0LIGHTGREY\0")?,
|
PciFullClass::Memory_Other => write!(f, "\u{001A}LIGHTGREY\u{001A}")?,
|
||||||
PciFullClass::Bridge_Host => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_Host => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_ISA => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_ISA => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_EISA => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_EISA => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_MCA => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_MCA => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_PciToPci => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_PciToPci => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_PCMCIA => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_PCMCIA => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_NuBus => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_NuBus => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_CardBus => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_CardBus => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_RACEway => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_RACEway => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_PciToPciSemiTransparent => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_PciToPciSemiTransparent => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_InfinibandToPci => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_InfinibandToPci => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Bridge_Other => write!(f, "\0GREEN\0")?,
|
PciFullClass::Bridge_Other => write!(f, "\u{001A}GREEN\u{001A}")?,
|
||||||
PciFullClass::Unknown => write!(f, "\0RED\0")?,
|
PciFullClass::Unknown => write!(f, "\u{001A}RED\u{001A}")?,
|
||||||
}
|
}
|
||||||
|
|
||||||
write!(f, "{:?} ({:#06X})\0RESET\0", self, self.as_u16())?;
|
write!(
|
||||||
|
f,
|
||||||
|
"{:?} ({:#06X})\u{001A}RESET\u{001A}",
|
||||||
|
self,
|
||||||
|
self.as_u16()
|
||||||
|
)?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,7 @@ const CMD_READ_DMA_EXT: u8 = 0x25;
|
||||||
|
|
||||||
/// ATA write using LBA48 DMA command
|
/// ATA write using LBA48 DMA command
|
||||||
const CMD_WRITE_DMA_EXT: u8 = 0x35;
|
const CMD_WRITE_DMA_EXT: u8 = 0x35;
|
||||||
|
#[derive(Debug)]
|
||||||
pub struct PciIde {
|
pub struct PciIde {
|
||||||
device_info: PciDeviceInfo,
|
device_info: PciDeviceInfo,
|
||||||
ide_devices: Vec<IdeDevice>,
|
ide_devices: Vec<IdeDevice>,
|
||||||
|
@ -629,6 +629,7 @@ unsafe fn read_dword_buffer(port: u16, buffer: *mut u32, mut count: u32) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct IdeDevice {
|
struct IdeDevice {
|
||||||
pub channel: Channel,
|
pub channel: Channel,
|
||||||
pub drive: Drive,
|
pub drive: Drive,
|
||||||
|
|
|
@ -28,6 +28,7 @@ lazy_static! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum PciDevice {
|
pub enum PciDevice {
|
||||||
Ide(PciIde),
|
Ide(PciIde),
|
||||||
// Variant so that we aren't about irrefutable if-let patterns
|
// Variant so that we aren't about irrefutable if-let patterns
|
||||||
|
@ -41,6 +42,7 @@ pub fn init(mapper: &mut impl Mapper<Size4KiB>, frame_allocator: &mut BootInfoFr
|
||||||
for device in 0..32 {
|
for device in 0..32 {
|
||||||
if let Some(device_info) = device::check_device(bus, device) {
|
if let Some(device_info) = device::check_device(bus, device) {
|
||||||
trace!("{device_info}");
|
trace!("{device_info}");
|
||||||
|
println!("{device_info}");
|
||||||
match device_info.device_id {
|
match device_info.device_id {
|
||||||
// FIXME: Unknown class
|
// FIXME: Unknown class
|
||||||
S3_TRIO64V2 => {}
|
S3_TRIO64V2 => {}
|
||||||
|
|
|
@ -164,17 +164,17 @@ impl Display for Vendor {
|
||||||
use Vendor::*;
|
use Vendor::*;
|
||||||
|
|
||||||
match self {
|
match self {
|
||||||
Qemu => write!(f, "{}", "\0PINK\0QEMU (0x1234)"),
|
Qemu => write!(f, "{}", "\u{001A}PINK\u{001A}QEMU (0x1234)"),
|
||||||
VirtIO => write!(f, "{}", "\0PINK\0VirtIO (0x1AF4)"),
|
VirtIO => write!(f, "{}", "\u{001A}PINK\u{001A}VirtIO (0x1AF4)"),
|
||||||
VMWareInc => write!(f, "{}", "\0PINK\0VMWARE (0x15AD)"),
|
VMWareInc => write!(f, "{}", "\u{001A}PINK\u{001A}VMWARE (0x15AD)"),
|
||||||
S3Inc => write!(f, "{}", "\0YELLOW\0S3 Incorporated (0x5333)"),
|
S3Inc => write!(f, "{}", "\u{001A}YELLOW\u{001A}S3 Incorporated (0x5333)"),
|
||||||
IntelCorp => write!(f, "{}", "\0BLUE\0Intel Corp. (0x8086)"),
|
IntelCorp => write!(f, "{}", "\u{001A}BLUE\u{001A}Intel Corp. (0x8086)"),
|
||||||
ATITechnologiesInc => write!(f, "{}", "\0RED\0ATI (0x1002)"),
|
ATITechnologiesInc => write!(f, "{}", "\u{001A}RED\u{001A}ATI (0x1002)"),
|
||||||
Unknown(id) => write!(f, "\0RED\0Unknown ({:#6})", id),
|
Unknown(id) => write!(f, "\u{001A}RED\u{001A}Unknown ({:#6})", id),
|
||||||
other => write!(f, "{other:?}"),
|
other => write!(f, "{other:?}"),
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
write!(f, "\0RESET\0")?;
|
write!(f, "\u{001A}RESET\u{001A}")?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,8 @@ pub fn scratchpad() {
|
||||||
.iter()
|
.iter()
|
||||||
.find_map(|device_ref| {
|
.find_map(|device_ref| {
|
||||||
let device = device_ref.lock();
|
let device = device_ref.lock();
|
||||||
if let PciDevice::Ide(_) = &*device {
|
if let PciDevice::Ide(dev) = &*device {
|
||||||
|
println!("IDE Device found: {}", dev.device_info());
|
||||||
Some(device_ref.clone())
|
Some(device_ref.clone())
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
@ -136,7 +137,7 @@ pub fn scratchpad() {
|
||||||
device
|
device
|
||||||
.read(Channel::Primary, Drive::Master, 0, 1, &mut first_sector)
|
.read(Channel::Primary, Drive::Master, 0, 1, &mut first_sector)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
trace!("IDE Primary/Master sector 0: {first_sector:?}");
|
// trace!("IDE Primary/Master sector 0: {first_sector:?}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue