1 // SPDX-License-Identifier: GPL-2.0+
12 DECLARE_GLOBAL_DATA_PTR;
14 int cpu_x86_bind(struct udevice *dev)
16 struct cpu_plat *plat = dev_get_parent_plat(dev);
17 struct cpuid_result res;
19 plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
21 plat->family = gd->arch.x86;
23 plat->id[0] = res.eax;
24 plat->id[1] = res.edx;
29 int cpu_x86_get_vendor(const struct udevice *dev, char *buf, int size)
31 const char *vendor = cpu_vendor_name(gd->arch.x86_vendor);
33 if (size < (strlen(vendor) + 1))
41 int cpu_x86_get_desc(const struct udevice *dev, char *buf, int size)
45 if (size < CPU_MAX_NAME_LEN)
48 ptr = cpu_get_name(buf);
55 int cpu_x86_get_count(const struct udevice *dev)
60 node = fdt_path_offset(gd->fdt_blob, "/cpus");
64 for (cpu = fdt_first_subnode(gd->fdt_blob, node);
66 cpu = fdt_next_subnode(gd->fdt_blob, cpu)) {
67 const char *device_type;
69 device_type = fdt_getprop(gd->fdt_blob, cpu,
73 if (strcmp(device_type, "cpu") == 0)
80 static const struct cpu_ops cpu_x86_ops = {
81 .get_desc = cpu_x86_get_desc,
82 .get_count = cpu_x86_get_count,
83 .get_vendor = cpu_x86_get_vendor,
86 static const struct udevice_id cpu_x86_ids[] = {
87 { .compatible = "cpu-x86" },
91 U_BOOT_DRIVER(cpu_x86_drv) = {
94 .of_match = cpu_x86_ids,
97 .flags = DM_FLAG_PRE_RELOC,