]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/x86/cpu/cpu_x86.c
157f3de6d81e00dbd2f2e3651157fd84d389dbe1
2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
13 DECLARE_GLOBAL_DATA_PTR
;
15 int cpu_x86_bind(struct udevice
*dev
)
17 struct cpu_platdata
*plat
= dev_get_parent_platdata(dev
);
18 struct cpuid_result res
;
20 plat
->cpu_id
= fdtdec_get_int(gd
->fdt_blob
, dev
->of_offset
,
22 plat
->family
= gd
->arch
.x86
;
24 plat
->id
[0] = res
.eax
;
25 plat
->id
[1] = res
.edx
;
30 int cpu_x86_get_vendor(struct udevice
*dev
, char *buf
, int size
)
32 const char *vendor
= cpu_vendor_name(gd
->arch
.x86_vendor
);
34 if (size
< (strlen(vendor
) + 1))
42 int cpu_x86_get_desc(struct udevice
*dev
, char *buf
, int size
)
44 if (size
< CPU_MAX_NAME_LEN
)
52 static int cpu_x86_get_count(struct udevice
*dev
)
57 node
= fdt_path_offset(gd
->fdt_blob
, "/cpus");
61 for (cpu
= fdt_first_subnode(gd
->fdt_blob
, node
);
63 cpu
= fdt_next_subnode(gd
->fdt_blob
, cpu
)) {
64 const char *device_type
;
66 device_type
= fdt_getprop(gd
->fdt_blob
, cpu
,
70 if (strcmp(device_type
, "cpu") == 0)
77 static const struct cpu_ops cpu_x86_ops
= {
78 .get_desc
= cpu_x86_get_desc
,
79 .get_count
= cpu_x86_get_count
,
80 .get_vendor
= cpu_x86_get_vendor
,
83 static const struct udevice_id cpu_x86_ids
[] = {
84 { .compatible
= "cpu-x86" },
88 U_BOOT_DRIVER(cpu_x86_drv
) = {
91 .of_match
= cpu_x86_ids
,