Skip to content
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

Merged
merged 75 commits into from
Jan 14, 2025
Merged

Support SATA device #72

merged 75 commits into from
Jan 14, 2025

Conversation

Alignof
Copy link
Owner

@Alignof Alignof commented Jan 14, 2025

  • Support SATA device without IOMMU.
  • Add debug_log feature.
  • Modify supervisor software interrupt handler.

Alignof and others added 25 commits January 12, 2025 17:39
@Alignof Alignof self-assigned this Jan 14, 2025
};

let read_value = unsafe { core::ptr::read_volatile(config_reg_32bit_addr as *const u32) };
read_value >> (offset_byte * 8) & mask

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

};

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

// 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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

// 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,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

core::ptr::read_volatile((hba_base_addr.raw() + offset + 0x4) as *const u32)
as usize
};
GuestPhysicalAddress(upper_addr << 32 | value as usize)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

// translate command table address
let cmd_table_gpa = unsafe {
GuestPhysicalAddress(
((*cmd_header_ptr).ctba_u as usize) << 32 | (*cmd_header_ptr).ctba as usize,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

// load hpa
let cmd_table_hpa = unsafe {
HostPhysicalAddress(
((*cmd_header_ptr).ctba_u as usize) << 32 | (*cmd_header_ptr).ctba as usize,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

ConfigSpaceHeaderField::ClassCode,
);
let (base_class, sub_class, interface) = (
class_code >> 16 & 0xff,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

);
let (base_class, sub_class, interface) = (
class_code >> 16 & 0xff,
class_code >> 8 & 0xff,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [clippy] clippy::precedence reported by reviewdog 🐶
operator precedence can trip the unwary

@Alignof Alignof merged commit deae958 into develop Jan 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant