1 // Copyright 2023, The Android Open Source Project
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 // Generated by ./bindgen.sh using bindgen 0.66.1
16
17 // Allow non-conventional naming for imports from C/C++.
18 #![allow(non_camel_case_types)]
19 #![allow(non_snake_case)]
20 #![allow(clippy::undocumented_unsafe_blocks)]
21
22 use zerocopy::{AsBytes, FromBytes, FromZeroes};
23
24 // Configure linkage for MacOS.
25 #[cfg(target_os = "macos")]
26 #[link(name = "IOKit", kind = "framework")]
27 #[link(name = "CoreFoundation", kind = "framework")]
28 extern "C" {}
29
30 #[repr(C)]
31 #[derive(Debug, Default, Copy, Clone, PartialEq)]
32 pub struct zbi_kernel_t {
33 pub entry: u64,
34 pub reserve_memory_size: u64,
35 }
36 #[test]
bindgen_test_layout_zbi_kernel_t()37 fn bindgen_test_layout_zbi_kernel_t() {
38 const UNINIT: ::std::mem::MaybeUninit<zbi_kernel_t> = ::std::mem::MaybeUninit::uninit();
39 let ptr = UNINIT.as_ptr();
40 assert_eq!(
41 ::std::mem::size_of::<zbi_kernel_t>(),
42 16usize,
43 concat!("Size of: ", stringify!(zbi_kernel_t))
44 );
45 assert_eq!(
46 ::std::mem::align_of::<zbi_kernel_t>(),
47 8usize,
48 concat!("Alignment of ", stringify!(zbi_kernel_t))
49 );
50 assert_eq!(
51 unsafe { ::std::ptr::addr_of!((*ptr).entry) as usize - ptr as usize },
52 0usize,
53 concat!("Offset of field: ", stringify!(zbi_kernel_t), "::", stringify!(entry))
54 );
55 assert_eq!(
56 unsafe { ::std::ptr::addr_of!((*ptr).reserve_memory_size) as usize - ptr as usize },
57 8usize,
58 concat!(
59 "Offset of field: ",
60 stringify!(zbi_kernel_t),
61 "::",
62 stringify!(reserve_memory_size)
63 )
64 );
65 }
66 pub const ZBI_ALIGNMENT: u32 = 8;
67 pub const ZBI_TYPE_KERNEL_PREFIX: u32 = 5132875;
68 pub const ZBI_TYPE_KERNEL_MASK: u32 = 16777215;
69 pub const ZBI_TYPE_DRIVER_METADATA_PREFIX: u32 = 109;
70 pub const ZBI_TYPE_DRIVER_METADATA_MASK: u32 = 255;
71 pub type zbi_type_t = u32;
72 pub const ZBI_TYPE_CONTAINER: zbi_type_t = 1414483778;
73 pub const ZBI_TYPE_KERNEL_X64: zbi_type_t = 1280201291;
74 pub const ZBI_TYPE_KERNEL_ARM64: zbi_type_t = 944656971;
75 pub const ZBI_TYPE_KERNEL_RISCV64: zbi_type_t = 1447973451;
76 pub const ZBI_TYPE_DISCARD: zbi_type_t = 1346980691;
77 pub const ZBI_TYPE_STORAGE_RAMDISK: zbi_type_t = 1263748178;
78 pub const ZBI_TYPE_STORAGE_BOOTFS: zbi_type_t = 1112753730;
79 pub const ZBI_TYPE_STORAGE_KERNEL: zbi_type_t = 1381258059;
80 pub const ZBI_TYPE_STORAGE_BOOTFS_FACTORY: zbi_type_t = 1179862594;
81 pub const ZBI_TYPE_CMDLINE: zbi_type_t = 1279544643;
82 pub const ZBI_TYPE_CRASHLOG: zbi_type_t = 1297043266;
83 pub const ZBI_TYPE_NVRAM: zbi_type_t = 1280071246;
84 pub const ZBI_TYPE_PLATFORM_ID: zbi_type_t = 1145654352;
85 pub const ZBI_TYPE_DRV_BOARD_INFO: zbi_type_t = 1230193261;
86 pub const ZBI_TYPE_CPU_TOPOLOGY: zbi_type_t = 1129338163;
87 pub const ZBI_TYPE_MEM_CONFIG: zbi_type_t = 1129137485;
88 pub const ZBI_TYPE_KERNEL_DRIVER: zbi_type_t = 1448232011;
89 pub const ZBI_TYPE_ACPI_RSDP: zbi_type_t = 1346655058;
90 pub const ZBI_TYPE_SMBIOS: zbi_type_t = 1229081939;
91 pub const ZBI_TYPE_EFI_SYSTEM_TABLE: zbi_type_t = 1397311045;
92 pub const ZBI_TYPE_EFI_MEMORY_ATTRIBUTES_TABLE: zbi_type_t = 1413565765;
93 pub const ZBI_TYPE_FRAMEBUFFER: zbi_type_t = 1111906131;
94 pub const ZBI_TYPE_IMAGE_ARGS: zbi_type_t = 1196573001;
95 pub const ZBI_TYPE_BOOT_VERSION: zbi_type_t = 1397904962;
96 pub const ZBI_TYPE_DRV_MAC_ADDRESS: zbi_type_t = 1128353133;
97 pub const ZBI_TYPE_DRV_PARTITION_MAP: zbi_type_t = 1414680685;
98 pub const ZBI_TYPE_DRV_BOARD_PRIVATE: zbi_type_t = 1380926061;
99 pub const ZBI_TYPE_HW_REBOOT_REASON: zbi_type_t = 1112692552;
100 pub const ZBI_TYPE_SERIAL_NUMBER: zbi_type_t = 1313624659;
101 pub const ZBI_TYPE_BOOTLOADER_FILE: zbi_type_t = 1279677506;
102 pub const ZBI_TYPE_DEVICETREE: zbi_type_t = 3490578157;
103 pub const ZBI_TYPE_SECURE_ENTROPY: zbi_type_t = 1145979218;
104 pub const ZBI_TYPE_DEBUGDATA: zbi_type_t = 1145520708;
105 pub const ZBI_CONTAINER_MAGIC: u32 = 2257385446;
106 pub const ZBI_ITEM_MAGIC: u32 = 3044546345;
107 pub type zbi_flags_t = u32;
108 pub const ZBI_FLAGS_VERSION: zbi_flags_t = 65536;
109 pub const ZBI_FLAGS_CRC32: zbi_flags_t = 131072;
110 pub const ZBI_ITEM_NO_CRC32: u32 = 1250420950;
111 #[repr(C)]
112 #[derive(Debug, Default, Copy, Clone, PartialEq, FromBytes, AsBytes, FromZeroes)]
113 pub struct zbi_header_t {
114 pub type_: zbi_type_t,
115 pub length: u32,
116 pub extra: u32,
117 pub flags: zbi_flags_t,
118 pub reserved0: u32,
119 pub reserved1: u32,
120 pub magic: u32,
121 pub crc32: u32,
122 }
123 #[test]
bindgen_test_layout_zbi_header_t()124 fn bindgen_test_layout_zbi_header_t() {
125 const UNINIT: ::std::mem::MaybeUninit<zbi_header_t> = ::std::mem::MaybeUninit::uninit();
126 let ptr = UNINIT.as_ptr();
127 assert_eq!(
128 ::std::mem::size_of::<zbi_header_t>(),
129 32usize,
130 concat!("Size of: ", stringify!(zbi_header_t))
131 );
132 assert_eq!(
133 ::std::mem::align_of::<zbi_header_t>(),
134 4usize,
135 concat!("Alignment of ", stringify!(zbi_header_t))
136 );
137 assert_eq!(
138 unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
139 0usize,
140 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(type_))
141 );
142 assert_eq!(
143 unsafe { ::std::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
144 4usize,
145 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(length))
146 );
147 assert_eq!(
148 unsafe { ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize },
149 8usize,
150 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(extra))
151 );
152 assert_eq!(
153 unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
154 12usize,
155 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(flags))
156 );
157 assert_eq!(
158 unsafe { ::std::ptr::addr_of!((*ptr).reserved0) as usize - ptr as usize },
159 16usize,
160 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(reserved0))
161 );
162 assert_eq!(
163 unsafe { ::std::ptr::addr_of!((*ptr).reserved1) as usize - ptr as usize },
164 20usize,
165 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(reserved1))
166 );
167 assert_eq!(
168 unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize },
169 24usize,
170 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(magic))
171 );
172 assert_eq!(
173 unsafe { ::std::ptr::addr_of!((*ptr).crc32) as usize - ptr as usize },
174 28usize,
175 concat!("Offset of field: ", stringify!(zbi_header_t), "::", stringify!(crc32))
176 );
177 }
178