mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 23:41:23 +01:00
lib: sbi: Implement SBI CPPC extension
Implement SBI CPPC extension. This extension is only available when OpenSBI platform provides a CPPC device to generic library. Signed-off-by: Sunil V L <sunilvl@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
35
include/sbi/sbi_cppc.h
Normal file
35
include/sbi/sbi_cppc.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2023 Ventana Micro Systems Inc.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SBI_CPPC_H__
|
||||
#define __SBI_CPPC_H__
|
||||
|
||||
#include <sbi/sbi_types.h>
|
||||
|
||||
/** CPPC device */
|
||||
struct sbi_cppc_device {
|
||||
/** Name of the CPPC device */
|
||||
char name[32];
|
||||
|
||||
/** probe - returns register width if implemented, 0 otherwise */
|
||||
int (*cppc_probe)(unsigned long reg);
|
||||
|
||||
/** read the cppc register*/
|
||||
int (*cppc_read)(unsigned long reg, uint64_t *val);
|
||||
|
||||
/** write to the cppc register*/
|
||||
int (*cppc_write)(unsigned long reg, uint64_t val);
|
||||
};
|
||||
|
||||
int sbi_cppc_probe(unsigned long reg);
|
||||
int sbi_cppc_read(unsigned long reg, uint64_t *val);
|
||||
int sbi_cppc_write(unsigned long reg, uint64_t val);
|
||||
|
||||
const struct sbi_cppc_device *sbi_cppc_get_device(void);
|
||||
void sbi_cppc_set_device(const struct sbi_cppc_device *dev);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user