1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 /*
3  * Copyright (C) 2008 David Gibson, IBM Corporation.
4  */
5 
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <string.h>
9 #include <stdint.h>
10 
11 #include <libfdt.h>
12 
13 #include "tests.h"
14 #include "testdata.h"
15 
main(int argc,char * argv[])16 int main(int argc, char *argv[])
17 {
18 	void *fdt;
19 	uint32_t cpuid;
20 
21 	test_init(argc, argv);
22 
23 	if (argc != 3)
24 		CONFIG("Usage: %s <dtb file> <cpuid>", argv[0]);
25 
26 	fdt = load_blob(argv[1]);
27 	cpuid = strtoul(argv[2], NULL, 0);
28 
29 	if (fdt_boot_cpuid_phys(fdt) != cpuid)
30 		FAIL("Incorrect boot_cpuid_phys (0x%x instead of 0x%x)",
31 		     fdt_boot_cpuid_phys(fdt), cpuid);
32 
33 	PASS();
34 }
35