File: prog_boot.c

package info (click to toggle)
u-boot 2025.01-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie, trixie-proposed-updates
  • size: 330,740 kB
  • sloc: ansic: 2,627,855; python: 60,773; sh: 41,641; asm: 21,854; makefile: 15,048; perl: 12,447; cs: 6,763; cpp: 1,868; yacc: 1,100; lex: 747; awk: 57; tcl: 32; sed: 24
file content (51 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright 2021 Google LLC
 * Written by Simon Glass <sjg@chromium.org>
 */

#define LOG_CATEGORY UCLASS_BOOTSTD

#include <bootflow.h>
#include <bootstd.h>
#include <command.h>
#include <dm.h>

/*
 * show_bootmeths() - List available bootmeths
 *
 * We could refactor this to use do_bootmeth_list() if more detail (or ordering)
 * are needed
 */
static void show_bootmeths(void)
{
	struct udevice *dev;
	struct uclass *uc;

	printf("Bootmeths: ");
	uclass_id_foreach_dev(UCLASS_BOOTMETH, dev, uc)
		printf(" %s", dev->name);
	printf("\n");
}

int bootstd_prog_boot(void)
{
	struct bootflow_iter iter;
	struct bootflow bflow;
	int ret, flags, i;

	printf("Programmatic boot starting\n");
	show_bootmeths();
	flags = BOOTFLOWIF_HUNT | BOOTFLOWIF_SHOW | BOOTFLOWIF_SKIP_GLOBAL;

	bootstd_clear_glob();
	for (i = 0, ret = bootflow_scan_first(NULL, NULL, &iter, flags, &bflow);
	     i < 1000 && ret != -ENODEV;
	     i++, ret = bootflow_scan_next(&iter, &bflow)) {
		if (!bflow.err)
			bootflow_run_boot(&iter, &bflow);
		bootflow_free(&bflow);
	}

	return -EFAULT;
}