Exemplo n.º 1
0
int cbfs_boot_locate(struct cbfsf *fh, const char *name, uint32_t *type)
{
	struct region_device rdev;
	const struct region_device *boot_dev;
	struct cbfs_props props;

	if (cbfs_boot_region_properties(&props))
		return -1;

	/* All boot CBFS operations are performed using the RO devie. */
	boot_dev = boot_device_ro();

	if (boot_dev == NULL)
		return -1;

	if (rdev_chain(&rdev, boot_dev, props.offset, props.size))
		return -1;

	return cbfs_locate(fh, &rdev, name, type);
}
Exemplo n.º 2
0
static void *cbfs_locate_file_in_region(const char *region_name, const char *file_name,
                                        uint32_t file_type, uint32_t *file_size)
{
    struct region_device rdev;
    struct cbfsf fh;

    if (file_size != NULL)
        *file_size = 0;

    if (fmap_locate_area_as_rdev(region_name, &rdev) == 0) {
        if (cbfs_locate(&fh, &rdev, file_name, &file_type) == 0) {
            if (file_size != NULL)
                *file_size = region_device_sz(&fh.data);
            return rdev_mmap_full(&fh.data);
        } else
            printk(BIOS_DEBUG, "%s file not found in %s region\n",
                   file_name, region_name);
    } else
        printk(BIOS_DEBUG,"%s region not found while looking for %s\n", region_name,
               file_name);

    return NULL;
}