mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-10-31 12:08:19 +00:00 
			
		
		
		
	As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
		
			
				
	
	
		
			56 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| // SPDX-License-Identifier: GPL-2.0+
 | |
| /*
 | |
|  * Bootdev for sandbox host
 | |
|  *
 | |
|  * Copyright 2021 Google LLC
 | |
|  * Written by Simon Glass <sjg@chromium.org>
 | |
|  */
 | |
| 
 | |
| #include <bootdev.h>
 | |
| #include <bootflow.h>
 | |
| #include <bootmeth.h>
 | |
| #include <dm.h>
 | |
| #include <fs.h>
 | |
| 
 | |
| static int host_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
 | |
| 			     struct bootflow *bflow)
 | |
| {
 | |
| 	int ret;
 | |
| 
 | |
| 	if (iter->part)
 | |
| 		return log_msg_ret("max", -ESHUTDOWN);
 | |
| 
 | |
| 	bflow->name = strdup(dev->name);
 | |
| 	if (!bflow->name)
 | |
| 		return log_msg_ret("name", -ENOMEM);
 | |
| 
 | |
| 	ret = bootmeth_check(bflow->method, iter);
 | |
| 	if (ret)
 | |
| 		return log_msg_ret("check", ret);
 | |
| 
 | |
| 	bflow->state = BOOTFLOWST_MEDIA;
 | |
| 	bflow->fs_type = FS_TYPE_SANDBOX;
 | |
| 
 | |
| 	ret = bootmeth_read_bootflow(bflow->method, bflow);
 | |
| 	if (ret)
 | |
| 		return log_msg_ret("method", ret);
 | |
| 
 | |
| 	return 0;
 | |
| }
 | |
| 
 | |
| struct bootdev_ops host_bootdev_ops = {
 | |
| 	.get_bootflow	= host_get_bootflow,
 | |
| };
 | |
| 
 | |
| static const struct udevice_id host_bootdev_ids[] = {
 | |
| 	{ .compatible = "sandbox,bootdev-host" },
 | |
| 	{ }
 | |
| };
 | |
| 
 | |
| U_BOOT_DRIVER(host_bootdev) = {
 | |
| 	.name		= "host_bootdev",
 | |
| 	.id		= UCLASS_BOOTDEV,
 | |
| 	.ops		= &host_bootdev_ops,
 | |
| 	.of_match	= host_bootdev_ids,
 | |
| };
 |