1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
11 * struct cpu_platdata - platform data for a CPU
12 * @cpu_id: Platform-specific way of identifying the CPU.
13 * @ucode_version: Microcode version, if CPU_FEAT_UCODE is set
14 * @device_id: Driver-defined device identifier
15 * @family: DMTF CPU Family identifier
16 * @id: DMTF CPU Processor identifier
18 * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
29 /* CPU features - mostly just a placeholder for now */
31 CPU_FEAT_L1_CACHE = 0, /* Supports level 1 cache */
32 CPU_FEAT_MMU = 1, /* Supports virtual memory */
33 CPU_FEAT_UCODE = 2, /* Requires/uses microcode */
34 CPU_FEAT_DEVICE_ID = 3, /* Provides a device ID */
40 * struct cpu_info - Information about a CPU
42 * @cpu_freq: Current CPU frequency in Hz
43 * @features: Flags for supported CPU features
52 * get_desc() - Get a description string for a CPU
54 * @dev: Device to check (UCLASS_CPU)
55 * @buf: Buffer to place string
56 * @size: Size of string space
57 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
59 int (*get_desc)(struct udevice *dev, char *buf, int size);
62 * get_info() - Get information about a CPU
64 * @dev: Device to check (UCLASS_CPU)
65 * @info: Returns CPU info
66 * @return 0 if OK, -ve on error
68 int (*get_info)(struct udevice *dev, struct cpu_info *info);
71 * get_count() - Get number of CPUs
73 * @dev: Device to check (UCLASS_CPU)
74 * @return CPU count if OK, -ve on error
76 int (*get_count)(struct udevice *dev);
79 * get_vendor() - Get vendor name of 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 (*get_vendor)(struct udevice *dev, char *buf, int size);
89 #define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
92 * cpu_get_desc() - Get a description string for a CPU
93 * @dev: Device to check (UCLASS_CPU)
94 * @buf: Buffer to place string
95 * @size: Size of string space
97 * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
99 int cpu_get_desc(struct udevice *dev, char *buf, int size);
102 * cpu_get_info() - Get information about a CPU
103 * @dev: Device to check (UCLASS_CPU)
104 * @info: Returns CPU info
106 * Return: 0 if OK, -ve on error
108 int cpu_get_info(struct udevice *dev, struct cpu_info *info);
111 * cpu_get_count() - Get number of CPUs
112 * @dev: Device to check (UCLASS_CPU)
114 * Return: CPU count if OK, -ve on error
116 int cpu_get_count(struct udevice *dev);
119 * cpu_get_vendor() - Get vendor name of a CPU
120 * @dev: Device to check (UCLASS_CPU)
121 * @buf: Buffer to place string
122 * @size: Size of string space
124 * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
126 int cpu_get_vendor(struct udevice *dev, char *buf, int size);
129 * cpu_probe_all() - Probe all available CPUs
131 * Return: 0 if OK, -ve on error
133 int cpu_probe_all(void);