| 1 |
|
| 2 |
|
| 3 |
#include <boot_device.h> |
| 4 |
|
| 5 |
void __weak boot_device_init(void) |
| 6 |
{ |
| 7 |
|
| 8 |
} |
| 9 |
|
| 10 |
int __weak boot_device_wp_region(const struct region_device *rd, |
| 11 |
const enum bootdev_prot_type type) |
| 12 |
{ |
| 13 |
|
| 14 |
return -1; |
| 15 |
} |
| 16 |
|
| 17 |
static int boot_device_subregion(const struct region *sub, |
| 18 |
struct region_device *subrd, |
| 19 |
const struct region_device *parent) |
| 20 |
{ |
| 21 |
if (parent == NULL) |
| 22 |
return -1; |
| 23 |
|
| 24 |
return rdev_chain(subrd, parent, region_offset(sub), region_sz(sub)); |
| 25 |
} |
| 26 |
|
| 27 |
int boot_device_ro_subregion(const struct region *sub, |
| 28 |
struct region_device *subrd) |
| 29 |
{ |
| 30 |
|
| 31 |
boot_device_init(); |
| 32 |
|
| 33 |
return boot_device_subregion(sub, subrd, boot_device_ro()); |
| 34 |
} |
| 35 |
|
| 36 |
int boot_device_rw_subregion(const struct region *sub, |
| 37 |
struct region_device *subrd) |
| 38 |
{ |
| 39 |
|
| 40 |
boot_device_init(); |
| 41 |
|
| 42 |
return boot_device_subregion(sub, subrd, boot_device_rw()); |
| 43 |
} |