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
17 * @timebase_freq: the current frequency at which the cpu timer timebase
18 * registers are updated (in Hz)
20 * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
32 /* CPU features - mostly just a placeholder for now */
34 CPU_FEAT_L1_CACHE = 0, /* Supports level 1 cache */
35 CPU_FEAT_MMU = 1, /* Supports virtual memory */
36 CPU_FEAT_UCODE = 2, /* Requires/uses microcode */
37 CPU_FEAT_DEVICE_ID = 3, /* Provides a device ID */
43 * struct cpu_info - Information about a CPU
45 * @cpu_freq: Current CPU frequency in Hz
46 * @features: Flags for supported CPU features
55 * get_desc() - Get a description string for a CPU
57 * @dev: Device to check (UCLASS_CPU)
58 * @buf: Buffer to place string
59 * @size: Size of string space
60 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
62 int (*get_desc)(struct udevice *dev, char *buf, int size);
65 * get_info() - Get information about a CPU
67 * @dev: Device to check (UCLASS_CPU)
68 * @info: Returns CPU info
69 * @return 0 if OK, -ve on error
71 int (*get_info)(struct udevice *dev, struct cpu_info *info);
74 * get_count() - Get number of CPUs
76 * @dev: Device to check (UCLASS_CPU)
77 * @return CPU count if OK, -ve on error
79 int (*get_count)(struct udevice *dev);
82 * get_vendor() - Get vendor name of a CPU
84 * @dev: Device to check (UCLASS_CPU)
85 * @buf: Buffer to place string
86 * @size: Size of string space
87 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
89 int (*get_vendor)(struct udevice *dev, char *buf, int size);
92 #define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
95 * cpu_get_desc() - Get a description string for a CPU
96 * @dev: Device to check (UCLASS_CPU)
97 * @buf: Buffer to place string
98 * @size: Size of string space
100 * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
102 int cpu_get_desc(struct udevice *dev, char *buf, int size);
105 * cpu_get_info() - Get information about a CPU
106 * @dev: Device to check (UCLASS_CPU)
107 * @info: Returns CPU info
109 * Return: 0 if OK, -ve on error
111 int cpu_get_info(struct udevice *dev, struct cpu_info *info);
114 * cpu_get_count() - Get number of CPUs
115 * @dev: Device to check (UCLASS_CPU)
117 * Return: CPU count if OK, -ve on error
119 int cpu_get_count(struct udevice *dev);
122 * cpu_get_vendor() - Get vendor name of a CPU
123 * @dev: Device to check (UCLASS_CPU)
124 * @buf: Buffer to place string
125 * @size: Size of string space
127 * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
129 int cpu_get_vendor(struct udevice *dev, char *buf, int size);
132 * cpu_probe_all() - Probe all available CPUs
134 * Return: 0 if OK, -ve on error
136 int cpu_probe_all(void);