]> git.ipfire.org Git - thirdparty/u-boot.git/blame - include/cpu.h
remoteproc: Allow for individual remoteproc initialization
[thirdparty/u-boot.git] / include / cpu.h
CommitLineData
83d290c5 1/* SPDX-License-Identifier: GPL-2.0+ */
11f4dc15
SG
2/*
3 * Copyright (c) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
11f4dc15
SG
5 */
6
7#ifndef __CPU_H
8#define __CPU_H
9
10/**
11 * struct cpu_platdata - platform data for a CPU
12 *
13 * This can be accessed with dev_get_parent_platdata() for any UCLASS_CPU
14 * device.
15 *
16 * @cpu_id: Platform-specific way of identifying the CPU.
740d5d34 17 * @ucode_version: Microcode version, if CPU_FEAT_UCODE is set
11f4dc15
SG
18 */
19struct cpu_platdata {
20 int cpu_id;
740d5d34
SG
21 int ucode_version;
22 ulong device_id;
6f192ddc
AG
23 u16 family; /* DMTF CPU Family */
24 u32 id[2]; /* DMTF CPU Processor IDs */
11f4dc15
SG
25};
26
27/* CPU features - mostly just a placeholder for now */
28enum {
29 CPU_FEAT_L1_CACHE = 0, /* Supports level 1 cache */
30 CPU_FEAT_MMU = 1, /* Supports virtual memory */
740d5d34
SG
31 CPU_FEAT_UCODE = 2, /* Requires/uses microcode */
32 CPU_FEAT_DEVICE_ID = 3, /* Provides a device ID */
11f4dc15
SG
33
34 CPU_FEAT_COUNT,
35};
36
37/**
38 * struct cpu_info - Information about a CPU
39 *
40 * @cpu_freq: Current CPU frequency in Hz
41 * @features: Flags for supported CPU features
42 */
43struct cpu_info {
44 ulong cpu_freq;
45 ulong features;
46};
47
48struct cpu_ops {
49 /**
50 * get_desc() - Get a description string for a CPU
51 *
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
56 */
57 int (*get_desc)(struct udevice *dev, char *buf, int size);
58
59 /**
60 * get_info() - Get information about a CPU
61 *
62 * @dev: Device to check (UCLASS_CPU)
63 * @info: Returns CPU info
64 * @return 0 if OK, -ve on error
65 */
66 int (*get_info)(struct udevice *dev, struct cpu_info *info);
780bfdd3
BM
67
68 /**
69 * get_count() - Get number of CPUs
70 *
71 * @dev: Device to check (UCLASS_CPU)
72 * @return CPU count if OK, -ve on error
73 */
74 int (*get_count)(struct udevice *dev);
94eaa79c
AG
75
76 /**
77 * get_vendor() - Get vendor name of a CPU
78 *
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
83 */
84 int (*get_vendor)(struct udevice *dev, char *buf, int size);
11f4dc15
SG
85};
86
87#define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
88
89/**
90 * cpu_get_desc() - Get a description string for a CPU
91 *
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
96 */
97int cpu_get_desc(struct udevice *dev, char *buf, int size);
98
99/**
100 * cpu_get_info() - Get information about a CPU
101 *
102 * @dev: Device to check (UCLASS_CPU)
103 * @info: Returns CPU info
104 * @return 0 if OK, -ve on error
105 */
106int cpu_get_info(struct udevice *dev, struct cpu_info *info);
107
780bfdd3
BM
108/**
109 * cpu_get_count() - Get number of CPUs
110 *
111 * @dev: Device to check (UCLASS_CPU)
112 * @return CPU count if OK, -ve on error
113 */
114int cpu_get_count(struct udevice *dev);
115
94eaa79c
AG
116/**
117 * cpu_get_vendor() - Get vendor name of a CPU
118 *
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
123 */
124int cpu_get_vendor(struct udevice *dev, char *buf, int size);
125
11f4dc15 126#endif