1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 /* 3 * 4 * (C) COPYRIGHT 2020-2022 ARM Limited. All rights reserved. 5 * 6 * This program is free software and is provided to you under the terms of the 7 * GNU General Public License version 2 as published by the Free Software 8 * Foundation, and any use by you of this program is subject to the terms 9 * of such GNU license. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, you can access it online at 18 * http://www.gnu.org/licenses/gpl-2.0.html. 19 * 20 */ 21 22 #ifndef _KBASE_CSF_FIRMWARE_CFG_H_ 23 #define _KBASE_CSF_FIRMWARE_CFG_H_ 24 25 #include <mali_kbase.h> 26 #include "mali_kbase_csf_firmware.h" 27 #include <linux/firmware.h> 28 29 #define CONFIGURATION_ENTRY_NAME_OFFSET (0xC) 30 31 /** 32 * kbase_csf_firmware_cfg_init - Create the sysfs directory for configuration 33 * options present in firmware image. 34 * 35 * @kbdev: Pointer to the Kbase device 36 * 37 * This function would create a sysfs directory and populate it with a 38 * sub-directory, that would contain a file per attribute, for every 39 * configuration option parsed from firmware image. 40 * 41 * Return: The initialization error code. 42 */ 43 int kbase_csf_firmware_cfg_init(struct kbase_device *kbdev); 44 45 /** 46 * kbase_csf_firmware_cfg_term - Delete the sysfs directory that was created 47 * for firmware configuration options. 48 * 49 * @kbdev: Pointer to the Kbase device 50 * 51 */ 52 void kbase_csf_firmware_cfg_term(struct kbase_device *kbdev); 53 54 /** 55 * kbase_csf_firmware_cfg_option_entry_parse() - Process a 56 * "configuration option" section. 57 * 58 * @kbdev: Kbase device structure 59 * @fw: Firmware image containing the section 60 * @entry: Pointer to the section 61 * @size: Size (in bytes) of the section 62 * @updatable: Indicates if entry can be updated with FIRMWARE_CONFIG_UPDATE 63 * 64 * Read a "configuration option" section adding it to the 65 * kbase_device:csf.firmware_config list. 66 * 67 * Return: 0 if successful, negative error code on failure 68 */ 69 int kbase_csf_firmware_cfg_option_entry_parse(struct kbase_device *kbdev, 70 const struct kbase_csf_mcu_fw *const fw, 71 const u32 *entry, unsigned int size, bool updatable); 72 #endif /* _KBASE_CSF_FIRMWARE_CFG_H_ */ 73