Skip to content

Commit c145482

Browse files
committed
build: Bump zerocopy to 0.8.23
Manually bump zerocopy to 0.8.23 to unblock our downstream to upgrade zerocopy. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
1 parent 56c71b1 commit c145482

File tree

23 files changed

+109
-67
lines changed

23 files changed

+109
-67
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ license = "Apache-2.0"
1010
edition = "2021"
1111

1212
[dependencies]
13-
zerocopy = { version = "0.7.1", features = ["derive"] }
13+
zerocopy = { version = "0.8.23", features = ["derive"] }

src/bert.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
6+
use zerocopy::{
7+
byteorder::{self, LE},
8+
Immutable, IntoBytes,
9+
};
710

811
extern crate alloc;
912

@@ -17,7 +20,7 @@ type U64 = byteorder::U64<LE>;
1720
/// unhandled errors that occurred in the previous boot. The format of
1821
/// the Boot Error Region follows that of an `Error Status Block`.
1922
#[repr(C, packed)]
20-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
23+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
2124
pub struct BERT {
2225
header: TableHeader,
2326
error_region_length: U32,

src/cedt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
use zerocopy::AsBytes;
6+
use zerocopy::IntoBytes;
77

88
extern crate alloc;
99
use alloc::{boxed::Box, vec::Vec};

src/facs.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@
44
//
55

66
use crate::{Aml, AmlSink};
7-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
7+
use zerocopy::{
8+
byteorder::{self, LE},
9+
Immutable, IntoBytes,
10+
};
811

912
type U32 = byteorder::U32<LE>;
1013
type U64 = byteorder::U64<LE>;
1114

1215
#[repr(C, packed)]
13-
#[derive(Clone, Copy, Default, AsBytes)]
16+
#[derive(Clone, Copy, Default, IntoBytes, Immutable)]
1417
pub struct FACS {
1518
pub signature: [u8; 4],
1619
pub length: U32,

src/fadt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55

66
use crate::{gas::GAS, Aml, AmlSink};
7-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
7+
use zerocopy::{byteorder, byteorder::LE, Immutable, IntoBytes};
88

99
type U16 = byteorder::U16<LE>;
1010
type U32 = byteorder::U32<LE>;
@@ -64,7 +64,7 @@ pub enum PmProfile {
6464
}
6565

6666
#[repr(C, packed)]
67-
#[derive(Clone, Copy, Default, AsBytes)]
67+
#[derive(Clone, Copy, Default, IntoBytes, Immutable)]
6868
pub struct FADTBuilder {
6969
pub signature: [u8; 4],
7070
pub length: U32,

src/gas.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
//
55

66
use crate::{Aml, AmlSink};
7-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
7+
use zerocopy::{byteorder, byteorder::LE, Immutable, IntoBytes};
88

99
type U64 = byteorder::U64<LE>;
1010

1111
#[repr(u8)]
12-
#[derive(Clone, Copy, Debug, AsBytes, Default)]
12+
#[derive(Clone, Copy, Debug, IntoBytes, Default, Immutable)]
1313
pub enum AddressSpace {
1414
#[default]
1515
SystemMemory = 0x0,
@@ -28,7 +28,7 @@ pub enum AddressSpace {
2828
}
2929

3030
#[repr(u8)]
31-
#[derive(Clone, Copy, Debug, AsBytes, Default)]
31+
#[derive(Clone, Copy, Debug, IntoBytes, Default, Immutable)]
3232
pub enum AccessSize {
3333
#[default]
3434
Undefined = 0,
@@ -39,7 +39,7 @@ pub enum AccessSize {
3939
}
4040

4141
#[repr(C, packed)]
42-
#[derive(Clone, Copy, Debug, AsBytes, Default)]
42+
#[derive(Clone, Copy, Debug, IntoBytes, Default, Immutable)]
4343
pub struct GAS {
4444
pub address_space_id: AddressSpace,
4545
pub register_bit_width: u8,

src/hest.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
6+
use zerocopy::{
7+
byteorder::{self, LE},
8+
Immutable, IntoBytes,
9+
};
710

811
extern crate alloc;
912
use alloc::{boxed::Box, vec::Vec};
@@ -74,7 +77,7 @@ impl HEST {
7477

7578
pub fn add_structure<T>(&mut self, t: T)
7679
where
77-
T: Aml + AsBytes + Clone + 'static,
80+
T: Aml + IntoBytes + Immutable + Clone + 'static,
7881
{
7982
self.update_header(t.as_bytes());
8083
self.structures.push(Box::new(t));
@@ -97,7 +100,7 @@ impl Aml for HEST {
97100
/// This structure contains information for configuring AER support on
98101
/// a given root port.
99102
#[repr(C, packed)]
100-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
103+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
101104
pub struct PcieAerRootPort {
102105
r#type: U16,
103106
source_id: U16,
@@ -189,7 +192,7 @@ aml_as_bytes!(PcieAerRootPort);
189192
/// otherwise there should be one entry for each device that supports
190193
/// AER.
191194
#[repr(C, packed)]
192-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
195+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
193196
pub struct PcieAerDevice {
194197
r#type: U16,
195198
source_id: U16,
@@ -250,7 +253,7 @@ aml_as_bytes!(PcieAerDevice);
250253
/// PCIe/PCI-X bridges that support AER implement fields that control
251254
/// the behavior of how errors are reported across the bridge.
252255
#[repr(C, packed)]
253-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
256+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
254257
pub struct PcieAerBridge {
255258
r#type: U16,
256259
source_id: U16,
@@ -321,7 +324,7 @@ aml_as_bytes!(PcieAerBridge);
321324
/// for configure and control operations, therefore the error source
322325
/// must be configured by firmware during boot.
323326
#[repr(C, packed)]
324-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
327+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
325328
pub struct GenericHardwareSource {
326329
r#type: U16,
327330
source_id: U16,
@@ -366,7 +369,7 @@ impl GenericHardwareSource {
366369
aml_as_bytes!(GenericHardwareSource);
367370

368371
#[repr(C, packed)]
369-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
372+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
370373
pub struct NotificationStructure {
371374
r#type: NotificationType,
372375
length: u8,
@@ -400,7 +403,7 @@ impl NotificationStructure {
400403
aml_as_bytes!(NotificationStructure);
401404

402405
#[repr(u8)]
403-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
406+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
404407
pub enum NotificationType {
405408
#[default]
406409
Polled = 0,
@@ -422,7 +425,7 @@ pub enum NotificationType {
422425
}
423426

424427
#[repr(u32)]
425-
#[derive(Copy, Clone, Debug, AsBytes, Default)]
428+
#[derive(Copy, Clone, Debug, IntoBytes, Immutable, Default)]
426429
pub enum ErrorSeverity {
427430
Recoverable = 0,
428431
Fatal = 1,
@@ -543,7 +546,7 @@ impl Aml for GenericErrorData {
543546
/// for HW-reduced platforms that rely on "RAS controllers" to generate generic
544547
/// error records.
545548
#[repr(C, packed)]
546-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
549+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
547550
pub struct GenericHardwareSourceV2 {
548551
r#type: U16,
549552
source_id: U16,

src/hmat.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
6+
use zerocopy::{
7+
byteorder::{self, LE},
8+
Immutable, IntoBytes,
9+
};
710

811
extern crate alloc;
912
use alloc::{boxed::Box, vec, vec::Vec};
@@ -101,7 +104,7 @@ impl Aml for HMAT {
101104
// by the memory subsystem and its associativity with a processor
102105
// proximity domain.
103106
#[repr(C, packed)]
104-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
107+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
105108
pub struct MemoryProximityDomain {
106109
r#type: U16,
107110
_reserved0: U16,

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ pub mod xsdt;
3434

3535
extern crate alloc;
3636

37-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
37+
use zerocopy::{
38+
byteorder::{self, LE},
39+
Immutable, IntoBytes,
40+
};
3841

3942
type U32 = byteorder::U32<LE>;
4043

@@ -89,7 +92,7 @@ impl AmlSink for alloc::vec::Vec<u8> {
8992

9093
/// Standard header for many ACPI tables
9194
#[repr(C, packed)]
92-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
95+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
9396
struct TableHeader {
9497
pub signature: [u8; 4],
9598
pub length: U32,

src/madt.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
// SPDX-License-Identifier: Apache-2.0
44
//
55

6-
use zerocopy::{byteorder, byteorder::LE, AsBytes};
6+
use zerocopy::{
7+
byteorder::{self, LE},
8+
Immutable, IntoBytes,
9+
};
710

811
extern crate alloc;
912
use alloc::{boxed::Box, vec::Vec};
@@ -30,7 +33,7 @@ enum MadtStructureType {
3033
}
3134

3235
#[repr(C, packed)]
33-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
36+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
3437
struct Header {
3538
table_header: TableHeader,
3639
/// Must be ignored by OSPM for RISC-V
@@ -111,7 +114,7 @@ impl MADT {
111114

112115
pub fn add_structure<T>(&mut self, t: T)
113116
where
114-
T: Aml + AsBytes + Clone + 'static,
117+
T: Aml + IntoBytes + Immutable + Clone + 'static,
115118
{
116119
self.update_header(t.as_bytes());
117120
self.structures.push(Box::new(t));
@@ -136,7 +139,7 @@ impl Aml for MADT {
136139

137140
/// Processor-Local APIC
138141
#[repr(C, packed)]
139-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
142+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
140143
pub struct ProcessorLocalApic {
141144
r#type: u8,
142145
length: u8,
@@ -169,7 +172,7 @@ aml_as_bytes!(ProcessorLocalApic);
169172

170173
/// I/O APIC
171174
#[repr(C, packed)]
172-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
175+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
173176
pub struct IoApic {
174177
r#type: u8,
175178
length: u8,
@@ -196,7 +199,7 @@ aml_as_bytes!(IoApic);
196199

197200
/// GIC CPU Interface (GICC)
198201
#[repr(C, packed)]
199-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
202+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
200203
pub struct Gicc {
201204
r#type: u8,
202205
length: u8,
@@ -302,7 +305,7 @@ pub enum GicVersion {
302305

303306
/// GIC Distributor (GICD) Structure
304307
#[repr(C, packed)]
305-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
308+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
306309
pub struct Gicd {
307310
r#type: u8,
308311
length: u8,
@@ -334,7 +337,7 @@ aml_as_bytes!(Gicd);
334337

335338
/// GIC MSI Frame Structure
336339
#[repr(C, packed)]
337-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
340+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
338341
pub struct GicMsi {
339342
r#type: u8,
340343
length: u8,
@@ -372,7 +375,7 @@ aml_as_bytes!(GicMsi);
372375

373376
/// GIC Redistributor (GICR) Structure
374377
#[repr(C, packed)]
375-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
378+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
376379
pub struct Gicr {
377380
r#type: u8,
378381
length: u8,
@@ -398,7 +401,7 @@ aml_as_bytes!(Gicr);
398401

399402
/// GIC Interrupt Translation Service (ITS) Structure
400403
#[repr(C, packed)]
401-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
404+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
402405
pub struct GicIts {
403406
r#type: u8,
404407
length: u8,
@@ -428,7 +431,7 @@ aml_as_bytes!(GicIts);
428431
/// RISC-V platforms need to have a simple, per-hart interrupt controller
429432
/// available to supervisor mode.
430433
#[repr(C, packed)]
431-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
434+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
432435
pub struct RINTC {
433436
r#type: u8,
434437
length: u8,
@@ -486,7 +489,7 @@ aml_as_bytes!(RINTC);
486489
// provides information common across processors. The per-processor
487490
// information will be provided by the RINTC structure.
488491
#[repr(C, packed)]
489-
#[derive(Copy, Clone, Debug, Default, AsBytes)]
492+
#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)]
490493
pub struct IMSIC {
491494
r#type: u8,
492495
length: u8,
@@ -547,7 +550,7 @@ aml_as_bytes!(IMSIC);
547550
// interrupts only in the form of MSIs. In that case, the role of an
548551
// APLIC is to convert wired interrupts into MSIs for harts.
549552
#[repr(C, packed)]
550-
#[derive(Copy, Clone, Debug, AsBytes)]
553+
#[derive(Copy, Clone, Debug, IntoBytes, Immutable)]
551554
pub struct APLIC {
552555
r#type: u8,
553556
length: u8,
@@ -596,7 +599,7 @@ assert_same_size!(APLIC, [u8; 36]);
596599
aml_as_bytes!(APLIC);
597600

598601
#[repr(C, packed)]
599-
#[derive(Copy, Clone, Debug, AsBytes)]
602+
#[derive(Copy, Clone, Debug, IntoBytes, Immutable)]
600603
pub struct PLIC {
601604
r#type: u8,
602605
length: u8,

0 commit comments

Comments
 (0)