2 * Copyright (c) 2015 Google, Inc
3 * Written by Simon Glass <sjg@chromium.org>
5 * SPDX-License-Identifier: GPL-2.0+
12 * struct cpu_platdata - platform data for a CPU
14 * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
17 * @cpu_id: Platform-specific way of identifying the CPU.
18 * @ucode_version: Microcode version, if CPU_FEAT_UCODE is set
26 /* CPU features - mostly just a placeholder for now */
28 CPU_FEAT_L1_CACHE = 0, /* Supports level 1 cache */
29 CPU_FEAT_MMU = 1, /* Supports virtual memory */
30 CPU_FEAT_UCODE = 2, /* Requires/uses microcode */
31 CPU_FEAT_DEVICE_ID = 3, /* Provides a device ID */
37 * struct cpu_info - Information about a CPU
39 * @cpu_freq: Current CPU frequency in Hz
40 * @features: Flags for supported CPU features
49 * get_desc() - Get a description string for a CPU
51 * @dev: Device to check (UCLASS_CPU)
52 * @buf: Buffer to place string
53 * @size: Size of string space
54 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
56 int (*get_desc)(struct udevice *dev, char *buf, int size);
59 * get_info() - Get information about a CPU
61 * @dev: Device to check (UCLASS_CPU)
62 * @info: Returns CPU info
63 * @return 0 if OK, -ve on error
65 int (*get_info)(struct udevice *dev, struct cpu_info *info);
68 * get_count() - Get number of CPUs
70 * @dev: Device to check (UCLASS_CPU)
71 * @return CPU count if OK, -ve on error
73 int (*get_count)(struct udevice *dev);
76 #define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
79 * cpu_get_desc() - Get a description string for a CPU
81 * @dev: Device to check (UCLASS_CPU)
82 * @buf: Buffer to place string
83 * @size: Size of string space
84 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
86 int cpu_get_desc(struct udevice *dev, char *buf, int size);
89 * cpu_get_info() - Get information about a CPU
91 * @dev: Device to check (UCLASS_CPU)
92 * @info: Returns CPU info
93 * @return 0 if OK, -ve on error
95 int cpu_get_info(struct udevice *dev, struct cpu_info *info);
98 * cpu_get_count() - Get number of CPUs
100 * @dev: Device to check (UCLASS_CPU)
101 * @return CPU count if OK, -ve on error
103 int cpu_get_count(struct udevice *dev);