mirror of
https://gitlab.com/qemu-project/opensbi.git
synced 2025-11-10 05:37:55 +08:00
lib: utils: Add FDT cache library
Add the FDT cache library so we can build up the cache topology via the 'next-level-cache' DT property. Co-developed-by: Vincent Chen <vincent.chen@sifive.com> Signed-off-by: Vincent Chen <vincent.chen@sifive.com> Co-developed-by: Andy Chiu <andy.chiu@sifive.com> Signed-off-by: Andy Chiu <andy.chiu@sifive.com> Signed-off-by: Nick Hu <nick.hu@sifive.com> Reviewed-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20251020-cache-upstream-v7-2-69a132447d8a@sifive.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
34
include/sbi_utils/cache/fdt_cache.h
vendored
Normal file
34
include/sbi_utils/cache/fdt_cache.h
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2025 SiFive Inc.
|
||||
*/
|
||||
|
||||
#ifndef __FDT_CACHE_H__
|
||||
#define __FDT_CACHE_H__
|
||||
|
||||
#include <sbi_utils/cache/cache.h>
|
||||
|
||||
/**
|
||||
* Register a cache device using information from the DT
|
||||
*
|
||||
* @param fdt devicetree blob
|
||||
* @param noff offset of a node in the devicetree blob
|
||||
* @param dev cache device to register for this devicetree node
|
||||
*
|
||||
* @return 0 on success, or a negative error code on failure
|
||||
*/
|
||||
int fdt_cache_add(const void *fdt, int noff, struct cache_device *dev);
|
||||
|
||||
/**
|
||||
* Get the cache device referencd by the "next-level-cache" property of a DT node
|
||||
*
|
||||
* @param fdt devicetree blob
|
||||
* @param noff offset of a node in the devicetree blob
|
||||
* @param out_dev location to return the cache device
|
||||
*
|
||||
* @return 0 on success, or a negative error code on failure
|
||||
*/
|
||||
int fdt_next_cache_get(const void *fdt, int noff, struct cache_device **out_dev);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user