-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support SATA device #72
Conversation
Add a debug macro
…bc` is greater than 0x1000
src/device/pci/config_register.rs
Outdated
}; | ||
|
||
let read_value = unsafe { core::ptr::read_volatile(config_reg_32bit_addr as *const u32) }; | ||
read_value >> (offset_byte * 8) & mask |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci/config_register.rs
Outdated
}; | ||
|
||
let read_value = unsafe { core::ptr::read_volatile(config_reg_32bit_addr as *const u32) }; | ||
let write_value = (read_value & !(mask << (offset_byte * 8))) | data << (offset_byte * 8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci/sata.rs
Outdated
// 0x00: command list base address, 1K-byte aligned | ||
0x0 => (self.cmd_list_gpa.raw() & 0xffff_ffff) as u32, | ||
// 0x04: command list base address upper 32 bits | ||
0x4 => (self.cmd_list_gpa.raw() >> 32 & 0xffff_ffff) as u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci/sata.rs
Outdated
// 0x08: FIS base address, 256-byte aligned | ||
0x8 => (self.fis_gpa.raw() & 0xffff_ffff) as u32, | ||
// 0x0c: FIS base address upper 32 bits | ||
0xc => (self.fis_gpa.raw() >> 32 & 0xffff_ffff) as u32, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci/sata.rs
Outdated
core::ptr::read_volatile((hba_base_addr.raw() + offset + 0x4) as *const u32) | ||
as usize | ||
}; | ||
GuestPhysicalAddress(upper_addr << 32 | value as usize) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci/sata.rs
Outdated
// translate command table address | ||
let cmd_table_gpa = unsafe { | ||
GuestPhysicalAddress( | ||
((*cmd_header_ptr).ctba_u as usize) << 32 | (*cmd_header_ptr).ctba as usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci/sata.rs
Outdated
// load hpa | ||
let cmd_table_hpa = unsafe { | ||
HostPhysicalAddress( | ||
((*cmd_header_ptr).ctba_u as usize) << 32 | (*cmd_header_ptr).ctba as usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci.rs
Outdated
ConfigSpaceHeaderField::ClassCode, | ||
); | ||
let (base_class, sub_class, interface) = ( | ||
class_code >> 16 & 0xff, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci.rs
Outdated
); | ||
let (base_class, sub_class, interface) = ( | ||
class_code >> 16 & 0xff, | ||
class_code >> 8 & 0xff, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
src/device/pci/sata/command.rs
Outdated
clippy::similar_names | ||
)] | ||
pub fn translate_data_base_address(&mut self, ctba_list: &mut Vec<CommandTableAddressData>) { | ||
let db_gpa = GuestPhysicalAddress((self.dbau as usize) << 32 | self.dba as usize); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator precedence can trip the unwary
debug_log
feature.