Skip to content

Commit 8da2acf

Browse files
authored
Merge pull request #1619 from seijikun/mr-raw-atapt2
uefi-raw: Fix ATA_PASS_THRU_PROTOCOL bindings
2 parents 3acb50c + 2328e82 commit 8da2acf

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

Diff for: uefi-raw/src/protocol/ata.rs

+29-27
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bitflags::bitflags! {
3131
}
3232
}
3333

34-
#[derive(Debug)]
34+
#[derive(Clone, Debug)]
3535
#[repr(C)]
3636
pub struct AtaPassThruMode {
3737
pub attributes: AtaPassThruAttributes,
@@ -76,37 +76,37 @@ newtype_enum! {
7676
#[repr(C)]
7777
pub struct AtaStatusBlock {
7878
pub reserved1: [u8; 2],
79-
pub ata_status: u8,
80-
pub ata_error: u8,
81-
pub ata_sector_number: u8,
82-
pub ata_cylinder_low: u8,
83-
pub ata_cylinder_high: u8,
84-
pub ata_device_head: u8,
85-
pub ata_sector_number_exp: u8,
86-
pub ata_cylinder_low_exp: u8,
87-
pub ata_cylinder_high_exp: u8,
79+
pub status: u8,
80+
pub error: u8,
81+
pub sector_number: u8,
82+
pub cylinder_low: u8,
83+
pub cylinder_high: u8,
84+
pub device_head: u8,
85+
pub sector_number_exp: u8,
86+
pub cylinder_low_exp: u8,
87+
pub cylinder_high_exp: u8,
8888
pub reserved2: u8,
89-
pub ata_sector_count: u8,
90-
pub ata_sector_count_exp: u8,
89+
pub sector_count: u8,
90+
pub sector_count_exp: u8,
9191
pub reserved3: [u8; 6],
9292
}
9393

94-
#[derive(Debug)]
94+
#[derive(Debug, Default)]
9595
#[repr(C)]
9696
pub struct AtaCommandBlock {
9797
pub reserved1: [u8; 2],
98-
pub ata_command: u8,
99-
pub ata_features: u8,
100-
pub ata_sector_number: u8,
101-
pub ata_cylinder_low: u8,
102-
pub ata_cylinder_high: u8,
103-
pub ata_device_head: u8,
104-
pub ata_sector_number_exp: u8,
105-
pub ata_cylinder_low_exp: u8,
106-
pub ata_cylinder_high_exp: u8,
107-
pub ata_features_exp: u8,
108-
pub ata_sector_count: u8,
109-
pub ata_sector_count_exp: u8,
98+
pub command: u8,
99+
pub features: u8,
100+
pub sector_number: u8,
101+
pub cylinder_low: u8,
102+
pub cylinder_high: u8,
103+
pub device_head: u8,
104+
pub sector_number_exp: u8,
105+
pub cylinder_low_exp: u8,
106+
pub cylinder_high_exp: u8,
107+
pub features_exp: u8,
108+
pub sector_count: u8,
109+
pub sector_count_exp: u8,
110110
pub reserved2: [u8; 6],
111111
}
112112

@@ -118,6 +118,8 @@ pub struct AtaPassThruCommandPacket {
118118
pub timeout: u64,
119119
pub in_data_buffer: *mut c_void,
120120
pub out_data_buffer: *const c_void,
121+
pub in_transfer_length: u32,
122+
pub out_transfer_length: u32,
121123
pub protocol: AtaPassThruCommandProtocol,
122124
pub length: AtaPassThruLength,
123125
}
@@ -131,7 +133,7 @@ pub struct AtaPassThruProtocol {
131133
port: u16,
132134
port_multiplier_port: u16,
133135
packet: *mut AtaPassThruCommandPacket,
134-
event: *mut Event,
136+
event: Event,
135137
) -> Status,
136138
pub get_next_port: unsafe extern "efiapi" fn(this: *const Self, port: *mut u16) -> Status,
137139
pub get_next_device: unsafe extern "efiapi" fn(
@@ -143,7 +145,7 @@ pub struct AtaPassThruProtocol {
143145
this: *const Self,
144146
port: u16,
145147
port_multiplier_port: u16,
146-
device_path: *mut *mut DevicePathProtocol,
148+
device_path: *mut *const DevicePathProtocol,
147149
) -> Status,
148150
pub get_device: unsafe extern "efiapi" fn(
149151
this: *const Self,

0 commit comments

Comments
 (0)