soc/intel/braswell/chip.h: Use `bool` type
[coreboot.git] / src / lib / boot_device.c
blobee8ba759605fbee9832b9d177dae22086e283365
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <boot_device.h>
5 void __weak boot_device_init(void)
7 /* Provide weak do-nothing init. */
10 int __weak boot_device_wp_region(const struct region_device *rd,
11 const enum bootdev_prot_type type)
13 /* return a failure, make aware WP is not implemented */
14 return -1;
17 static int boot_device_subregion(const struct region *sub,
18 struct region_device *subrd,
19 const struct region_device *parent)
21 if (parent == NULL)
22 return -1;
24 return rdev_chain(subrd, parent, region_offset(sub), region_sz(sub));
27 int boot_device_ro_subregion(const struct region *sub,
28 struct region_device *subrd)
30 /* Ensure boot device has been initialized at least once. */
31 boot_device_init();
33 return boot_device_subregion(sub, subrd, boot_device_ro());
36 int boot_device_rw_subregion(const struct region *sub,
37 struct region_device *subrd)
39 /* Ensure boot device has been initialized at least once. */
40 boot_device_init();
42 return boot_device_subregion(sub, subrd, boot_device_rw());