1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2015 Google, Inc
11 * struct cpu_platdata - platform data for a CPU
13 * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
16 * @cpu_id: Platform-specific way of identifying the CPU.
17 * @ucode_version: Microcode version, if CPU_FEAT_UCODE is set
23 u16 family; /* DMTF CPU Family */
24 u32 id[2]; /* DMTF CPU Processor IDs */
27 /* CPU features - mostly just a placeholder for now */
29 CPU_FEAT_L1_CACHE = 0, /* Supports level 1 cache */
30 CPU_FEAT_MMU = 1, /* Supports virtual memory */
31 CPU_FEAT_UCODE = 2, /* Requires/uses microcode */
32 CPU_FEAT_DEVICE_ID = 3, /* Provides a device ID */
38 * struct cpu_info - Information about a CPU
40 * @cpu_freq: Current CPU frequency in Hz
41 * @features: Flags for supported CPU features
50 * get_desc() - Get a description string for a CPU
52 * @dev: Device to check (UCLASS_CPU)
53 * @buf: Buffer to place string
54 * @size: Size of string space
55 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
57 int (*get_desc)(struct udevice *dev, char *buf, int size);
60 * get_info() - Get information about a CPU
62 * @dev: Device to check (UCLASS_CPU)
63 * @info: Returns CPU info
64 * @return 0 if OK, -ve on error
66 int (*get_info)(struct udevice *dev, struct cpu_info *info);
69 * get_count() - Get number of CPUs
71 * @dev: Device to check (UCLASS_CPU)
72 * @return CPU count if OK, -ve on error
74 int (*get_count)(struct udevice *dev);
77 * get_vendor() - Get vendor name of a CPU
79 * @dev: Device to check (UCLASS_CPU)
80 * @buf: Buffer to place string
81 * @size: Size of string space
82 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
84 int (*get_vendor)(struct udevice *dev, char *buf, int size);
87 #define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
90 * cpu_get_desc() - Get a description string for a CPU
92 * @dev: Device to check (UCLASS_CPU)
93 * @buf: Buffer to place string
94 * @size: Size of string space
95 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
97 int cpu_get_desc(struct udevice *dev, char *buf, int size);
100 * cpu_get_info() - Get information about a CPU
102 * @dev: Device to check (UCLASS_CPU)
103 * @info: Returns CPU info
104 * @return 0 if OK, -ve on error
106 int cpu_get_info(struct udevice *dev, struct cpu_info *info);
109 * cpu_get_count() - Get number of CPUs
111 * @dev: Device to check (UCLASS_CPU)
112 * @return CPU count if OK, -ve on error
114 int cpu_get_count(struct udevice *dev);
117 * cpu_get_vendor() - Get vendor name of a CPU
119 * @dev: Device to check (UCLASS_CPU)
120 * @buf: Buffer to place string
121 * @size: Size of string space
122 * @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
124 int cpu_get_vendor(struct udevice *dev, char *buf, int size);