2 * This file is part of the coreboot project.
4 * Copyright 2015 Google Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <boot_device.h>
18 void __attribute__((weak
)) boot_device_init(void)
20 /* Provide weak do-nothing init. */
23 static int boot_device_subregion(const struct region
*sub
,
24 struct region_device
*subrd
,
25 const struct region_device
*parent
)
30 return rdev_chain(subrd
, parent
, region_offset(sub
), region_sz(sub
));
33 int boot_device_ro_subregion(const struct region
*sub
,
34 struct region_device
*subrd
)
36 /* Ensure boot device has been initialized at least once. */
39 return boot_device_subregion(sub
, subrd
, boot_device_ro());
42 int boot_device_rw_subregion(const struct region
*sub
,
43 struct region_device
*subrd
)
45 /* Ensure boot device has been initialized at least once. */
48 return boot_device_subregion(sub
, subrd
, boot_device_rw());