xref: /xnu-8020.140.41/EXTERNAL_HEADERS/img4/image.h (revision 27b03b360a988dfd3dfdf34262bb0042026747cc)
1 /*!
2  * @header
3  * Interfaces for manipulating Image4 firmware images.
4  */
5 #ifndef __IMG4_IMAGE_H
6 #define __IMG4_IMAGE_H
7 
8 #ifndef __IMG4_INDIRECT
9 #error "Please #include <img4/firmware.h> instead of this file directly"
10 #endif // __IMG4_INDIRECT
11 
12 OS_ASSUME_NONNULL_BEGIN
13 
14 /*!
15  * @function img4_image_get_bytes
16  * Returns the authenticated payload from an Image4 image.
17  *
18  * @param image
19  * The image to query.
20  *
21  * @result
22  * A buffer which describes the authenticated payload.
23  */
24 #if !XNU_KERNEL_PRIVATE
25 IMG4_API_AVAILABLE_20200508
26 OS_EXPORT OS_WARN_RESULT OS_NONNULL1
27 const img4_buff_t *
28 img4_image_get_bytes(img4_image_t image);
29 #else
30 #define img4_image_get_bytes(...) (img4if->i4if_v7.image_get_bytes(__VA_ARGS__))
31 #endif
32 
33 /*!
34  * @function img4_image_get_property_bool
35  * Retrieves the Boolean value for the requested image property.
36  *
37  * @param image
38  * The image to query.
39  *
40  * @param _4cc
41  * The 4cc of the desired image property.
42  *
43  * @param storage
44  * A pointer to storage for a Boolean value.
45  *
46  * @result
47  * If the property is present for the image, a pointer to the storage provided
48  * in {@link storage}. If the property is not present in the image or its value
49  * is not a Boolean, NULL is returned.
50  *
51  * @discussion
52  * If the property is present for the image, a pointer to the storage provided
53  * in {@link storage}. If the property is not present in the image or its value
54  * is not a Boolean, NULL is returned.
55  */
56 #if !XNU_KERNEL_PRIVATE
57 IMG4_API_AVAILABLE_20200508
58 OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL3
59 const bool *
60 img4_image_get_property_bool(img4_image_t image,
61 		img4_4cc_t _4cc,
62 		bool *storage);
63 #else
64 #define img4_image_get_property_bool(...) \
65 		(img4if->i4if_v7.image_get_property_bool(__VA_ARGS__))
66 #endif
67 
68 /*!
69  * @function img4_image_get_property_uint32
70  * Retrieves the unsigned 32-bit integer value for the requested image property.
71  *
72  * @param image
73  * The image to query.
74  *
75  * @param _4cc
76  * The 4cc of the desired image property.
77  *
78  * @param storage
79  * A pointer to storage for a 32-bit unsigned integer value.
80  *
81  * @result
82  * If the property is present for the image, a pointer to the storage provided
83  * in {@link storage}. If the property is not present in the image or its value
84  * is not an unsigned 32-bit integer, NULL is returned.
85  */
86 #if !XNU_KERNEL_PRIVATE
87 IMG4_API_AVAILABLE_20200508
88 OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL3
89 const uint32_t *
90 img4_image_get_property_uint32(img4_image_t image,
91 		img4_4cc_t _4cc,
92 		uint32_t *storage);
93 #else
94 #define img4_image_get_property_uint32(...) \
95 		(img4if->i4if_v7.image_get_property_uint32(__VA_ARGS__))
96 #endif
97 
98 /*!
99  * @function img4_image_get_property_uint64
100  * Retrieves the unsigned 64-bit integer value for the requested image property.
101  *
102  * @param image
103  * The image to query.
104  *
105  * @param _4cc
106  * The 4cc of the desired image property.
107  *
108  * @param storage
109  * A pointer to storage for a 64-bit unsigned integer value.
110  *
111  * @result
112  * If the property is present for the image, a pointer to the storage provided
113  * in {@link storage}. If the property is not present in the image or its value
114  * is not an unsigned 64-bit integer, NULL is returned.
115  */
116 #if !XNU_KERNEL_PRIVATE
117 IMG4_API_AVAILABLE_20200508
118 OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL3
119 const uint64_t *
120 img4_image_get_property_uint64(img4_image_t image,
121 		img4_4cc_t _4cc,
122 		uint64_t *storage);
123 #else
124 #define img4_image_get_property_uint64(...) \
125 		(img4if->i4if_v7.image_get_property_uint64(__VA_ARGS__))
126 #endif
127 
128 /*!
129  * @function img4_image_get_property_data
130  * Retrieves the buffer value for the requested image property.
131  *
132  * @param image
133  * The image to query.
134  *
135  * @param _4cc
136  * The 4cc of the desired image property.
137  *
138  * @param storage
139  * A pointer to storage for a buffer value.
140  *
141  * @result
142  * If the property is present for the image, a pointer to the storage provided
143  * in {@link storage}. If the property is not present in the image or its value
144  * is not a data, NULL is returned.
145  */
146 #if !XNU_KERNEL_PRIVATE
147 IMG4_API_AVAILABLE_20200508
148 OS_EXPORT OS_WARN_RESULT OS_NONNULL1 OS_NONNULL3
149 const img4_buff_t *
150 img4_image_get_property_data(img4_image_t image,
151 		img4_4cc_t _4cc,
152 		img4_buff_t *storage);
153 #else
154 #define img4_image_get_property_data(...) \
155 		(img4if->i4if_v7.image_get_property_data(__VA_ARGS__))
156 #endif
157 
158 OS_ASSUME_NONNULL_END
159 
160 #endif // __IMG4_IMAGE_H
161