1/* $NetBSD: common_baco.h,v 1.2 2021/12/18 23:45:26 riastradh Exp $ */ 2 3/* 4 * Copyright 2018 Advanced Micro Devices, Inc. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * and/or sell copies of the Software, and to permit persons to whom the 11 * Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in 14 * all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 * OTHER DEALINGS IN THE SOFTWARE. 23 * 24 */ 25#ifndef __COMMON_BOCO_H__ 26#define __COMMON_BOCO_H__ 27#include "hwmgr.h" 28 29 30enum baco_cmd_type { 31 CMD_WRITE = 0, 32 CMD_READMODIFYWRITE, 33 CMD_WAITFOR, 34 CMD_DELAY_MS, 35 CMD_DELAY_US, 36}; 37 38struct baco_cmd_entry { 39 enum baco_cmd_type cmd; 40 uint32_t reg_offset; 41 uint32_t mask; 42 uint32_t shift; 43 uint32_t timeout; 44 uint32_t val; 45}; 46 47struct soc15_baco_cmd_entry { 48 enum baco_cmd_type cmd; 49 uint32_t hwip; 50 uint32_t inst; 51 uint32_t seg; 52 uint32_t reg_offset; 53 uint32_t mask; 54 uint32_t shift; 55 uint32_t timeout; 56 uint32_t val; 57}; 58 59extern bool baco_program_registers(struct pp_hwmgr *hwmgr, 60 const struct baco_cmd_entry *entry, 61 const u32 array_size); 62extern bool soc15_baco_program_registers(struct pp_hwmgr *hwmgr, 63 const struct soc15_baco_cmd_entry *entry, 64 const u32 array_size); 65#endif 66