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