1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2015 Google, Inc
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
47 * @address_width: Width of the CPU address space in bits (e.g. 32)
57 * get_desc() - Get a description string for a CPU
59 * @dev: Device to check (UCLASS_CPU)
60 * @buf: Buffer to place string
61 * @size: Size of string space
62 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
64 int (*get_desc)(struct udevice *dev, char *buf, int size);
67 * get_info() - Get information about a CPU
69 * @dev: Device to check (UCLASS_CPU)
70 * @info: Returns CPU info
71 * @return 0 if OK, -ve on error
73 int (*get_info)(struct udevice *dev, struct cpu_info *info);
76 * get_count() - Get number of CPUs
78 * @dev: Device to check (UCLASS_CPU)
79 * @return CPU count if OK, -ve on error
81 int (*get_count)(struct udevice *dev);
84 * get_vendor() - Get vendor name of a CPU
86 * @dev: Device to check (UCLASS_CPU)
87 * @buf: Buffer to place string
88 * @size: Size of string space
89 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
91 int (*get_vendor)(struct udevice *dev, char *buf, int size);
94 #define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
97 * cpu_get_desc() - Get a description string for a CPU
98 * @dev: Device to check (UCLASS_CPU)
99 * @buf: Buffer to place string
100 * @size: Size of string space
102 * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
104 int cpu_get_desc(struct udevice *dev, char *buf, int size);
107 * cpu_get_info() - Get information about a CPU
108 * @dev: Device to check (UCLASS_CPU)
109 * @info: Returns CPU info
111 * Return: 0 if OK, -ve on error
113 int cpu_get_info(struct udevice *dev, struct cpu_info *info);
116 * cpu_get_count() - Get number of CPUs
117 * @dev: Device to check (UCLASS_CPU)
119 * Return: CPU count if OK, -ve on error
121 int cpu_get_count(struct udevice *dev);
124 * cpu_get_vendor() - Get vendor name of a CPU
125 * @dev: Device to check (UCLASS_CPU)
126 * @buf: Buffer to place string
127 * @size: Size of string space
129 * Return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
131 int cpu_get_vendor(struct udevice *dev, char *buf, int size);
134 * cpu_probe_all() - Probe all available CPUs
136 * Return: 0 if OK, -ve on error
138 int cpu_probe_all(void);