xref: /xnu-11417.140.69/EXTERNAL_HEADERS/image4/restricted/environment.h (revision 43a90889846e00bfb5cf1d255cdc0a701a1e05a4)
1 /*
2  * Copyright © 2017-2024 Apple Inc. All rights reserved.
3  *
4  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. The rights granted to you under the License
10  * may not be used to create, or enable the creation or redistribution of,
11  * unlawful or unlicensed copies of an Apple operating system, or to
12  * circumvent, violate, or enable the circumvention or violation of, any
13  * terms of an Apple operating system software license agreement.
14  *
15  * Please obtain a copy of the License at
16  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17  *
18  * The Original Code and all software distributed under the License are
19  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23  * Please see the License for the specific language governing rights and
24  * limitations under the License.
25  *
26  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27  */
28 /*!
29  * @header
30  * Restricted environment interfaces.
31  */
32 #ifndef __IMAGE4_API_RESTRICTED_ENVIRONMENT_H
33 #define __IMAGE4_API_RESTRICTED_ENVIRONMENT_H
34 
35 #include <image4/image4.h>
36 #include <image4/environment.h>
37 
38 __BEGIN_DECLS
39 OS_ASSUME_NONNULL_BEGIN
40 OS_ASSUME_PTR_ABI_SINGLE_BEGIN
41 
42 #pragma mark Restricted API
43 /*!
44  * @function image4_environment_get_firmware_chip
45  * Returns the legacy chip pointer corresponding to an environment.
46  *
47  * @param nv
48  * The environment to query.
49  *
50  * @result
51  * Upon success, a pointer to an object which can be safely cast to an
52  * `const img4_chip_t *` is returned. If the environment does not support
53  * returning a legacy chip, NULL is returned.
54  *
55  * @availability
56  * This API is restricted and should only be called via the
57  * {@link image4_restricted_call} macro.
58  *
59  * This function first became available in restricted API version 1000; it will
60  * be functionally neutered in version 2000.
61  */
62 OS_EXPORT OS_WARN_RESULT OS_NONNULL2
63 const void *_Nullable
64 image4_environment_get_firmware_chip(
65 	uint32_t v,
66 	const image4_environment_t *nv);
67 #define image4_environment_get_firmware_chip(...) \
68 	image4_call_restricted(environment_get_firmware_chip, ## __VA_ARGS__)
69 
70 OS_ASSUME_PTR_ABI_SINGLE_END
71 OS_ASSUME_NONNULL_END
72 __END_DECLS
73 
74 #endif // __IMAGE4_API_RESTRICTED_ENVIRONMENT_H
75