coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
boot_device.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <boot_device.h>
4 
6 {
7  /* Provide weak do-nothing init. */
8 }
9 
11  const enum bootdev_prot_type type)
12 {
13  /* return a failure, make aware WP is not implemented */
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  /* Ensure boot device has been initialized at least once. */
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  /* Ensure boot device has been initialized at least once. */
41 
42  return boot_device_subregion(sub, subrd, boot_device_rw());
43 }
const struct region_device * boot_device_ro(void)
Definition: rom_media.c:9
void __weak boot_device_init(void)
Definition: boot_device.c:5
static int boot_device_subregion(const struct region *sub, struct region_device *subrd, const struct region_device *parent)
Definition: boot_device.c:17
int boot_device_rw_subregion(const struct region *sub, struct region_device *subrd)
Definition: boot_device.c:36
int boot_device_ro_subregion(const struct region *sub, struct region_device *subrd)
Definition: boot_device.c:27
int __weak boot_device_wp_region(const struct region_device *rd, const enum bootdev_prot_type type)
Definition: boot_device.c:10
bootdev_prot_type
Definition: boot_device.h:18
const struct region_device * boot_device_rw(void)
unsigned int type
Definition: edid.c:57
static size_t region_sz(const struct region *r)
Definition: region.h:110
int rdev_chain(struct region_device *child, const struct region_device *parent, size_t offset, size_t size)
Definition: region.c:136
static size_t region_offset(const struct region *r)
Definition: region.h:105
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8
#define NULL
Definition: stddef.h:19
Definition: region.h:76