blob: d32ba6614eebea18e6d230b194fb58d9e556a359 [file] [log] [blame]
Bin Mengbe3f06b2015-06-12 14:52:20 +08001/*
2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <cpu.h>
9#include <dm.h>
10#include <errno.h>
11#include <asm/cpu.h>
12
13int cpu_x86_bind(struct udevice *dev)
14{
15 struct cpu_platdata *plat = dev_get_parent_platdata(dev);
16
17 plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
18 "intel,apic-id", -1);
19
20 return 0;
21}
22
23int cpu_x86_get_desc(struct udevice *dev, char *buf, int size)
24{
25 if (size < CPU_MAX_NAME_LEN)
26 return -ENOSPC;
27
28 cpu_get_name(buf);
29
30 return 0;
31}
32
33static const struct cpu_ops cpu_x86_ops = {
34 .get_desc = cpu_x86_get_desc,
35};
36
37static const struct udevice_id cpu_x86_ids[] = {
38 { .compatible = "cpu-x86" },
39 { }
40};
41
42U_BOOT_DRIVER(cpu_x86_drv) = {
43 .name = "cpu_x86",
44 .id = UCLASS_CPU,
45 .of_match = cpu_x86_ids,
46 .bind = cpu_x86_bind,
47 .ops = &cpu_x86_ops,
48};