162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * Copyright 2011 Advanced Micro Devices, Inc. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 562306a36Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 662306a36Sopenharmony_ci * to deal in the Software without restriction, including without limitation 762306a36Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 862306a36Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 962306a36Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * The above copyright notice and this permission notice shall be included in 1262306a36Sopenharmony_ci * all copies or substantial portions of the Software. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1562306a36Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 1662306a36Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 1762306a36Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 1862306a36Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 1962306a36Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 2062306a36Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 2162306a36Sopenharmony_ci * 2262306a36Sopenharmony_ci * Authors: Alex Deucher 2362306a36Sopenharmony_ci */ 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci#include <linux/pci.h> 2662306a36Sopenharmony_ci#include <linux/seq_file.h> 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci#include "atom.h" 2962306a36Sopenharmony_ci#include "btc_dpm.h" 3062306a36Sopenharmony_ci#include "btcd.h" 3162306a36Sopenharmony_ci#include "cypress_dpm.h" 3262306a36Sopenharmony_ci#include "evergreen.h" 3362306a36Sopenharmony_ci#include "r600_dpm.h" 3462306a36Sopenharmony_ci#include "rv770.h" 3562306a36Sopenharmony_ci#include "radeon.h" 3662306a36Sopenharmony_ci#include "radeon_asic.h" 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci#define MC_CG_ARB_FREQ_F0 0x0a 3962306a36Sopenharmony_ci#define MC_CG_ARB_FREQ_F1 0x0b 4062306a36Sopenharmony_ci#define MC_CG_ARB_FREQ_F2 0x0c 4162306a36Sopenharmony_ci#define MC_CG_ARB_FREQ_F3 0x0d 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci#define MC_CG_SEQ_DRAMCONF_S0 0x05 4462306a36Sopenharmony_ci#define MC_CG_SEQ_DRAMCONF_S1 0x06 4562306a36Sopenharmony_ci#define MC_CG_SEQ_YCLK_SUSPEND 0x04 4662306a36Sopenharmony_ci#define MC_CG_SEQ_YCLK_RESUME 0x0a 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci#define SMC_RAM_END 0x8000 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci#ifndef BTC_MGCG_SEQUENCE 5162306a36Sopenharmony_ci#define BTC_MGCG_SEQUENCE 300 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ciextern int ni_mc_load_microcode(struct radeon_device *rdev); 5462306a36Sopenharmony_ci 5562306a36Sopenharmony_ci//********* BARTS **************// 5662306a36Sopenharmony_cistatic const u32 barts_cgcg_cgls_default[] = 5762306a36Sopenharmony_ci{ 5862306a36Sopenharmony_ci /* Register, Value, Mask bits */ 5962306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 6062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 6162306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 6262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 6362306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 6462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 6562306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 6662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 6762306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 6862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 6962306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 7062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 7162306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 7262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 7362306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 7462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 7562306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 7662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 7762306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 7862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 7962306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 8062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 8162306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 8262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 8362306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 8462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 8562306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 8662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 8762306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 8862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 8962306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 9062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 9162306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 9262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 9362306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 9462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 9562306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 9662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 9762306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 9862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 9962306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 10062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 10162306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 10262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 10362306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 10462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 10562306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 10662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff 10762306a36Sopenharmony_ci}; 10862306a36Sopenharmony_ci#define BARTS_CGCG_CGLS_DEFAULT_LENGTH sizeof(barts_cgcg_cgls_default) / (3 * sizeof(u32)) 10962306a36Sopenharmony_ci 11062306a36Sopenharmony_cistatic const u32 barts_cgcg_cgls_disable[] = 11162306a36Sopenharmony_ci{ 11262306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 11362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 11462306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 11562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 11662306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 11762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 11862306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 11962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 12062306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 12162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 12262306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 12362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 12462306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 12562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 12662306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 12762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 12862306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 12962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 13062306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 13162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 13262306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 13362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 13462306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 13562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 13662306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 13762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 13862306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 13962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 14062306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 14162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 14262306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 14362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 14462306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 14562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 14662306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 14762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 14862306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 14962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 15062306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 15162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 15262306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 15362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 15462306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 15562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 15662306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 15762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 15862306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 15962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 16062306a36Sopenharmony_ci 0x00000644, 0x000f7912, 0x001f4180, 16162306a36Sopenharmony_ci 0x00000644, 0x000f3812, 0x001f4180 16262306a36Sopenharmony_ci}; 16362306a36Sopenharmony_ci#define BARTS_CGCG_CGLS_DISABLE_LENGTH sizeof(barts_cgcg_cgls_disable) / (3 * sizeof(u32)) 16462306a36Sopenharmony_ci 16562306a36Sopenharmony_cistatic const u32 barts_cgcg_cgls_enable[] = 16662306a36Sopenharmony_ci{ 16762306a36Sopenharmony_ci /* 0x0000c124, 0x84180000, 0x00180000, */ 16862306a36Sopenharmony_ci 0x00000644, 0x000f7892, 0x001f4080, 16962306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 17062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 17162306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 17262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 17362306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 17462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 17562306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 17662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 17762306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 17862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 17962306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 18062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 18162306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 18262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 18362306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 18462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 18562306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 18662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 18762306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 18862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 18962306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 19062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 19162306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 19262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 19362306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 19462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 19562306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 19662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 19762306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 19862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 19962306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 20062306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 20162306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 20262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 20362306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 20462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 20562306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 20662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 20762306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 20862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 20962306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 21062306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 21162306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 21262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 21362306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 21462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 21562306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 21662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff 21762306a36Sopenharmony_ci}; 21862306a36Sopenharmony_ci#define BARTS_CGCG_CGLS_ENABLE_LENGTH sizeof(barts_cgcg_cgls_enable) / (3 * sizeof(u32)) 21962306a36Sopenharmony_ci 22062306a36Sopenharmony_cistatic const u32 barts_mgcg_default[] = 22162306a36Sopenharmony_ci{ 22262306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 22362306a36Sopenharmony_ci 0x00005448, 0x00000100, 0xffffffff, 22462306a36Sopenharmony_ci 0x000055e4, 0x00600100, 0xffffffff, 22562306a36Sopenharmony_ci 0x0000160c, 0x00000100, 0xffffffff, 22662306a36Sopenharmony_ci 0x0000c164, 0x00000100, 0xffffffff, 22762306a36Sopenharmony_ci 0x00008a18, 0x00000100, 0xffffffff, 22862306a36Sopenharmony_ci 0x0000897c, 0x06000100, 0xffffffff, 22962306a36Sopenharmony_ci 0x00008b28, 0x00000100, 0xffffffff, 23062306a36Sopenharmony_ci 0x00009144, 0x00000100, 0xffffffff, 23162306a36Sopenharmony_ci 0x00009a60, 0x00000100, 0xffffffff, 23262306a36Sopenharmony_ci 0x00009868, 0x00000100, 0xffffffff, 23362306a36Sopenharmony_ci 0x00008d58, 0x00000100, 0xffffffff, 23462306a36Sopenharmony_ci 0x00009510, 0x00000100, 0xffffffff, 23562306a36Sopenharmony_ci 0x0000949c, 0x00000100, 0xffffffff, 23662306a36Sopenharmony_ci 0x00009654, 0x00000100, 0xffffffff, 23762306a36Sopenharmony_ci 0x00009030, 0x00000100, 0xffffffff, 23862306a36Sopenharmony_ci 0x00009034, 0x00000100, 0xffffffff, 23962306a36Sopenharmony_ci 0x00009038, 0x00000100, 0xffffffff, 24062306a36Sopenharmony_ci 0x0000903c, 0x00000100, 0xffffffff, 24162306a36Sopenharmony_ci 0x00009040, 0x00000100, 0xffffffff, 24262306a36Sopenharmony_ci 0x0000a200, 0x00000100, 0xffffffff, 24362306a36Sopenharmony_ci 0x0000a204, 0x00000100, 0xffffffff, 24462306a36Sopenharmony_ci 0x0000a208, 0x00000100, 0xffffffff, 24562306a36Sopenharmony_ci 0x0000a20c, 0x00000100, 0xffffffff, 24662306a36Sopenharmony_ci 0x0000977c, 0x00000100, 0xffffffff, 24762306a36Sopenharmony_ci 0x00003f80, 0x00000100, 0xffffffff, 24862306a36Sopenharmony_ci 0x0000a210, 0x00000100, 0xffffffff, 24962306a36Sopenharmony_ci 0x0000a214, 0x00000100, 0xffffffff, 25062306a36Sopenharmony_ci 0x000004d8, 0x00000100, 0xffffffff, 25162306a36Sopenharmony_ci 0x00009784, 0x00000100, 0xffffffff, 25262306a36Sopenharmony_ci 0x00009698, 0x00000100, 0xffffffff, 25362306a36Sopenharmony_ci 0x000004d4, 0x00000200, 0xffffffff, 25462306a36Sopenharmony_ci 0x000004d0, 0x00000000, 0xffffffff, 25562306a36Sopenharmony_ci 0x000030cc, 0x00000100, 0xffffffff, 25662306a36Sopenharmony_ci 0x0000d0c0, 0xff000100, 0xffffffff, 25762306a36Sopenharmony_ci 0x0000802c, 0x40000000, 0xffffffff, 25862306a36Sopenharmony_ci 0x0000915c, 0x00010000, 0xffffffff, 25962306a36Sopenharmony_ci 0x00009160, 0x00030002, 0xffffffff, 26062306a36Sopenharmony_ci 0x00009164, 0x00050004, 0xffffffff, 26162306a36Sopenharmony_ci 0x00009168, 0x00070006, 0xffffffff, 26262306a36Sopenharmony_ci 0x00009178, 0x00070000, 0xffffffff, 26362306a36Sopenharmony_ci 0x0000917c, 0x00030002, 0xffffffff, 26462306a36Sopenharmony_ci 0x00009180, 0x00050004, 0xffffffff, 26562306a36Sopenharmony_ci 0x0000918c, 0x00010006, 0xffffffff, 26662306a36Sopenharmony_ci 0x00009190, 0x00090008, 0xffffffff, 26762306a36Sopenharmony_ci 0x00009194, 0x00070000, 0xffffffff, 26862306a36Sopenharmony_ci 0x00009198, 0x00030002, 0xffffffff, 26962306a36Sopenharmony_ci 0x0000919c, 0x00050004, 0xffffffff, 27062306a36Sopenharmony_ci 0x000091a8, 0x00010006, 0xffffffff, 27162306a36Sopenharmony_ci 0x000091ac, 0x00090008, 0xffffffff, 27262306a36Sopenharmony_ci 0x000091b0, 0x00070000, 0xffffffff, 27362306a36Sopenharmony_ci 0x000091b4, 0x00030002, 0xffffffff, 27462306a36Sopenharmony_ci 0x000091b8, 0x00050004, 0xffffffff, 27562306a36Sopenharmony_ci 0x000091c4, 0x00010006, 0xffffffff, 27662306a36Sopenharmony_ci 0x000091c8, 0x00090008, 0xffffffff, 27762306a36Sopenharmony_ci 0x000091cc, 0x00070000, 0xffffffff, 27862306a36Sopenharmony_ci 0x000091d0, 0x00030002, 0xffffffff, 27962306a36Sopenharmony_ci 0x000091d4, 0x00050004, 0xffffffff, 28062306a36Sopenharmony_ci 0x000091e0, 0x00010006, 0xffffffff, 28162306a36Sopenharmony_ci 0x000091e4, 0x00090008, 0xffffffff, 28262306a36Sopenharmony_ci 0x000091e8, 0x00000000, 0xffffffff, 28362306a36Sopenharmony_ci 0x000091ec, 0x00070000, 0xffffffff, 28462306a36Sopenharmony_ci 0x000091f0, 0x00030002, 0xffffffff, 28562306a36Sopenharmony_ci 0x000091f4, 0x00050004, 0xffffffff, 28662306a36Sopenharmony_ci 0x00009200, 0x00010006, 0xffffffff, 28762306a36Sopenharmony_ci 0x00009204, 0x00090008, 0xffffffff, 28862306a36Sopenharmony_ci 0x00009208, 0x00070000, 0xffffffff, 28962306a36Sopenharmony_ci 0x0000920c, 0x00030002, 0xffffffff, 29062306a36Sopenharmony_ci 0x00009210, 0x00050004, 0xffffffff, 29162306a36Sopenharmony_ci 0x0000921c, 0x00010006, 0xffffffff, 29262306a36Sopenharmony_ci 0x00009220, 0x00090008, 0xffffffff, 29362306a36Sopenharmony_ci 0x00009224, 0x00070000, 0xffffffff, 29462306a36Sopenharmony_ci 0x00009228, 0x00030002, 0xffffffff, 29562306a36Sopenharmony_ci 0x0000922c, 0x00050004, 0xffffffff, 29662306a36Sopenharmony_ci 0x00009238, 0x00010006, 0xffffffff, 29762306a36Sopenharmony_ci 0x0000923c, 0x00090008, 0xffffffff, 29862306a36Sopenharmony_ci 0x00009294, 0x00000000, 0xffffffff, 29962306a36Sopenharmony_ci 0x0000802c, 0x40010000, 0xffffffff, 30062306a36Sopenharmony_ci 0x0000915c, 0x00010000, 0xffffffff, 30162306a36Sopenharmony_ci 0x00009160, 0x00030002, 0xffffffff, 30262306a36Sopenharmony_ci 0x00009164, 0x00050004, 0xffffffff, 30362306a36Sopenharmony_ci 0x00009168, 0x00070006, 0xffffffff, 30462306a36Sopenharmony_ci 0x00009178, 0x00070000, 0xffffffff, 30562306a36Sopenharmony_ci 0x0000917c, 0x00030002, 0xffffffff, 30662306a36Sopenharmony_ci 0x00009180, 0x00050004, 0xffffffff, 30762306a36Sopenharmony_ci 0x0000918c, 0x00010006, 0xffffffff, 30862306a36Sopenharmony_ci 0x00009190, 0x00090008, 0xffffffff, 30962306a36Sopenharmony_ci 0x00009194, 0x00070000, 0xffffffff, 31062306a36Sopenharmony_ci 0x00009198, 0x00030002, 0xffffffff, 31162306a36Sopenharmony_ci 0x0000919c, 0x00050004, 0xffffffff, 31262306a36Sopenharmony_ci 0x000091a8, 0x00010006, 0xffffffff, 31362306a36Sopenharmony_ci 0x000091ac, 0x00090008, 0xffffffff, 31462306a36Sopenharmony_ci 0x000091b0, 0x00070000, 0xffffffff, 31562306a36Sopenharmony_ci 0x000091b4, 0x00030002, 0xffffffff, 31662306a36Sopenharmony_ci 0x000091b8, 0x00050004, 0xffffffff, 31762306a36Sopenharmony_ci 0x000091c4, 0x00010006, 0xffffffff, 31862306a36Sopenharmony_ci 0x000091c8, 0x00090008, 0xffffffff, 31962306a36Sopenharmony_ci 0x000091cc, 0x00070000, 0xffffffff, 32062306a36Sopenharmony_ci 0x000091d0, 0x00030002, 0xffffffff, 32162306a36Sopenharmony_ci 0x000091d4, 0x00050004, 0xffffffff, 32262306a36Sopenharmony_ci 0x000091e0, 0x00010006, 0xffffffff, 32362306a36Sopenharmony_ci 0x000091e4, 0x00090008, 0xffffffff, 32462306a36Sopenharmony_ci 0x000091e8, 0x00000000, 0xffffffff, 32562306a36Sopenharmony_ci 0x000091ec, 0x00070000, 0xffffffff, 32662306a36Sopenharmony_ci 0x000091f0, 0x00030002, 0xffffffff, 32762306a36Sopenharmony_ci 0x000091f4, 0x00050004, 0xffffffff, 32862306a36Sopenharmony_ci 0x00009200, 0x00010006, 0xffffffff, 32962306a36Sopenharmony_ci 0x00009204, 0x00090008, 0xffffffff, 33062306a36Sopenharmony_ci 0x00009208, 0x00070000, 0xffffffff, 33162306a36Sopenharmony_ci 0x0000920c, 0x00030002, 0xffffffff, 33262306a36Sopenharmony_ci 0x00009210, 0x00050004, 0xffffffff, 33362306a36Sopenharmony_ci 0x0000921c, 0x00010006, 0xffffffff, 33462306a36Sopenharmony_ci 0x00009220, 0x00090008, 0xffffffff, 33562306a36Sopenharmony_ci 0x00009224, 0x00070000, 0xffffffff, 33662306a36Sopenharmony_ci 0x00009228, 0x00030002, 0xffffffff, 33762306a36Sopenharmony_ci 0x0000922c, 0x00050004, 0xffffffff, 33862306a36Sopenharmony_ci 0x00009238, 0x00010006, 0xffffffff, 33962306a36Sopenharmony_ci 0x0000923c, 0x00090008, 0xffffffff, 34062306a36Sopenharmony_ci 0x00009294, 0x00000000, 0xffffffff, 34162306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 34262306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 34362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 34462306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 34562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 34662306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 34762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 34862306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 34962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 35062306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 35162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 35262306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 35362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 35462306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 35562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 35662306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 35762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 35862306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 35962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 36062306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 36162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 36262306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 36362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 36462306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 36562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff 36662306a36Sopenharmony_ci}; 36762306a36Sopenharmony_ci#define BARTS_MGCG_DEFAULT_LENGTH sizeof(barts_mgcg_default) / (3 * sizeof(u32)) 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_cistatic const u32 barts_mgcg_disable[] = 37062306a36Sopenharmony_ci{ 37162306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 37262306a36Sopenharmony_ci 0x000008f8, 0x00000000, 0xffffffff, 37362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 37462306a36Sopenharmony_ci 0x000008f8, 0x00000001, 0xffffffff, 37562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 37662306a36Sopenharmony_ci 0x000008f8, 0x00000002, 0xffffffff, 37762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 37862306a36Sopenharmony_ci 0x000008f8, 0x00000003, 0xffffffff, 37962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 38062306a36Sopenharmony_ci 0x00009150, 0x00600000, 0xffffffff 38162306a36Sopenharmony_ci}; 38262306a36Sopenharmony_ci#define BARTS_MGCG_DISABLE_LENGTH sizeof(barts_mgcg_disable) / (3 * sizeof(u32)) 38362306a36Sopenharmony_ci 38462306a36Sopenharmony_cistatic const u32 barts_mgcg_enable[] = 38562306a36Sopenharmony_ci{ 38662306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 38762306a36Sopenharmony_ci 0x000008f8, 0x00000000, 0xffffffff, 38862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 38962306a36Sopenharmony_ci 0x000008f8, 0x00000001, 0xffffffff, 39062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 39162306a36Sopenharmony_ci 0x000008f8, 0x00000002, 0xffffffff, 39262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 39362306a36Sopenharmony_ci 0x000008f8, 0x00000003, 0xffffffff, 39462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 39562306a36Sopenharmony_ci 0x00009150, 0x81944000, 0xffffffff 39662306a36Sopenharmony_ci}; 39762306a36Sopenharmony_ci#define BARTS_MGCG_ENABLE_LENGTH sizeof(barts_mgcg_enable) / (3 * sizeof(u32)) 39862306a36Sopenharmony_ci 39962306a36Sopenharmony_ci//********* CAICOS **************// 40062306a36Sopenharmony_cistatic const u32 caicos_cgcg_cgls_default[] = 40162306a36Sopenharmony_ci{ 40262306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 40362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 40462306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 40562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 40662306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 40762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 40862306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 40962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 41062306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 41162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 41262306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 41362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 41462306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 41562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 41662306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 41762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 41862306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 41962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 42062306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 42162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 42262306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 42362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 42462306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 42562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 42662306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 42762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 42862306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 42962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 43062306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 43162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 43262306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 43362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 43462306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 43562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 43662306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 43762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 43862306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 43962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 44062306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 44162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 44262306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 44362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 44462306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 44562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 44662306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 44762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 44862306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 44962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff 45062306a36Sopenharmony_ci}; 45162306a36Sopenharmony_ci#define CAICOS_CGCG_CGLS_DEFAULT_LENGTH sizeof(caicos_cgcg_cgls_default) / (3 * sizeof(u32)) 45262306a36Sopenharmony_ci 45362306a36Sopenharmony_cistatic const u32 caicos_cgcg_cgls_disable[] = 45462306a36Sopenharmony_ci{ 45562306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 45662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 45762306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 45862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 45962306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 46062306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 46162306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 46262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 46362306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 46462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 46562306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 46662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 46762306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 46862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 46962306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 47062306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 47162306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 47262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 47362306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 47462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 47562306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 47662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 47762306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 47862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 47962306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 48062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 48162306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 48262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 48362306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 48462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 48562306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 48662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 48762306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 48862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 48962306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 49062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 49162306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 49262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 49362306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 49462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 49562306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 49662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 49762306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 49862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 49962306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 50062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 50162306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 50262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 50362306a36Sopenharmony_ci 0x00000644, 0x000f7912, 0x001f4180, 50462306a36Sopenharmony_ci 0x00000644, 0x000f3812, 0x001f4180 50562306a36Sopenharmony_ci}; 50662306a36Sopenharmony_ci#define CAICOS_CGCG_CGLS_DISABLE_LENGTH sizeof(caicos_cgcg_cgls_disable) / (3 * sizeof(u32)) 50762306a36Sopenharmony_ci 50862306a36Sopenharmony_cistatic const u32 caicos_cgcg_cgls_enable[] = 50962306a36Sopenharmony_ci{ 51062306a36Sopenharmony_ci /* 0x0000c124, 0x84180000, 0x00180000, */ 51162306a36Sopenharmony_ci 0x00000644, 0x000f7892, 0x001f4080, 51262306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 51362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 51462306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 51562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 51662306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 51762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 51862306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 51962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 52062306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 52162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 52262306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 52362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 52462306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 52562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 52662306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 52762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 52862306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 52962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 53062306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 53162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 53262306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 53362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 53462306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 53562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 53662306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 53762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 53862306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 53962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 54062306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 54162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 54262306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 54362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 54462306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 54562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 54662306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 54762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 54862306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 54962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 55062306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 55162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 55262306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 55362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 55462306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 55562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 55662306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 55762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 55862306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 55962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff 56062306a36Sopenharmony_ci}; 56162306a36Sopenharmony_ci#define CAICOS_CGCG_CGLS_ENABLE_LENGTH sizeof(caicos_cgcg_cgls_enable) / (3 * sizeof(u32)) 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_cistatic const u32 caicos_mgcg_default[] = 56462306a36Sopenharmony_ci{ 56562306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 56662306a36Sopenharmony_ci 0x00005448, 0x00000100, 0xffffffff, 56762306a36Sopenharmony_ci 0x000055e4, 0x00600100, 0xffffffff, 56862306a36Sopenharmony_ci 0x0000160c, 0x00000100, 0xffffffff, 56962306a36Sopenharmony_ci 0x0000c164, 0x00000100, 0xffffffff, 57062306a36Sopenharmony_ci 0x00008a18, 0x00000100, 0xffffffff, 57162306a36Sopenharmony_ci 0x0000897c, 0x06000100, 0xffffffff, 57262306a36Sopenharmony_ci 0x00008b28, 0x00000100, 0xffffffff, 57362306a36Sopenharmony_ci 0x00009144, 0x00000100, 0xffffffff, 57462306a36Sopenharmony_ci 0x00009a60, 0x00000100, 0xffffffff, 57562306a36Sopenharmony_ci 0x00009868, 0x00000100, 0xffffffff, 57662306a36Sopenharmony_ci 0x00008d58, 0x00000100, 0xffffffff, 57762306a36Sopenharmony_ci 0x00009510, 0x00000100, 0xffffffff, 57862306a36Sopenharmony_ci 0x0000949c, 0x00000100, 0xffffffff, 57962306a36Sopenharmony_ci 0x00009654, 0x00000100, 0xffffffff, 58062306a36Sopenharmony_ci 0x00009030, 0x00000100, 0xffffffff, 58162306a36Sopenharmony_ci 0x00009034, 0x00000100, 0xffffffff, 58262306a36Sopenharmony_ci 0x00009038, 0x00000100, 0xffffffff, 58362306a36Sopenharmony_ci 0x0000903c, 0x00000100, 0xffffffff, 58462306a36Sopenharmony_ci 0x00009040, 0x00000100, 0xffffffff, 58562306a36Sopenharmony_ci 0x0000a200, 0x00000100, 0xffffffff, 58662306a36Sopenharmony_ci 0x0000a204, 0x00000100, 0xffffffff, 58762306a36Sopenharmony_ci 0x0000a208, 0x00000100, 0xffffffff, 58862306a36Sopenharmony_ci 0x0000a20c, 0x00000100, 0xffffffff, 58962306a36Sopenharmony_ci 0x0000977c, 0x00000100, 0xffffffff, 59062306a36Sopenharmony_ci 0x00003f80, 0x00000100, 0xffffffff, 59162306a36Sopenharmony_ci 0x0000a210, 0x00000100, 0xffffffff, 59262306a36Sopenharmony_ci 0x0000a214, 0x00000100, 0xffffffff, 59362306a36Sopenharmony_ci 0x000004d8, 0x00000100, 0xffffffff, 59462306a36Sopenharmony_ci 0x00009784, 0x00000100, 0xffffffff, 59562306a36Sopenharmony_ci 0x00009698, 0x00000100, 0xffffffff, 59662306a36Sopenharmony_ci 0x000004d4, 0x00000200, 0xffffffff, 59762306a36Sopenharmony_ci 0x000004d0, 0x00000000, 0xffffffff, 59862306a36Sopenharmony_ci 0x000030cc, 0x00000100, 0xffffffff, 59962306a36Sopenharmony_ci 0x0000d0c0, 0xff000100, 0xffffffff, 60062306a36Sopenharmony_ci 0x0000915c, 0x00010000, 0xffffffff, 60162306a36Sopenharmony_ci 0x00009160, 0x00030002, 0xffffffff, 60262306a36Sopenharmony_ci 0x00009164, 0x00050004, 0xffffffff, 60362306a36Sopenharmony_ci 0x00009168, 0x00070006, 0xffffffff, 60462306a36Sopenharmony_ci 0x00009178, 0x00070000, 0xffffffff, 60562306a36Sopenharmony_ci 0x0000917c, 0x00030002, 0xffffffff, 60662306a36Sopenharmony_ci 0x00009180, 0x00050004, 0xffffffff, 60762306a36Sopenharmony_ci 0x0000918c, 0x00010006, 0xffffffff, 60862306a36Sopenharmony_ci 0x00009190, 0x00090008, 0xffffffff, 60962306a36Sopenharmony_ci 0x00009194, 0x00070000, 0xffffffff, 61062306a36Sopenharmony_ci 0x00009198, 0x00030002, 0xffffffff, 61162306a36Sopenharmony_ci 0x0000919c, 0x00050004, 0xffffffff, 61262306a36Sopenharmony_ci 0x000091a8, 0x00010006, 0xffffffff, 61362306a36Sopenharmony_ci 0x000091ac, 0x00090008, 0xffffffff, 61462306a36Sopenharmony_ci 0x000091e8, 0x00000000, 0xffffffff, 61562306a36Sopenharmony_ci 0x00009294, 0x00000000, 0xffffffff, 61662306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 61762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 61862306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 61962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 62062306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 62162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 62262306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 62362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 62462306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 62562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 62662306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 62762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 62862306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 62962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 63062306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 63162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 63262306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 63362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 63462306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 63562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 63662306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 63762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 63862306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 63962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff 64062306a36Sopenharmony_ci}; 64162306a36Sopenharmony_ci#define CAICOS_MGCG_DEFAULT_LENGTH sizeof(caicos_mgcg_default) / (3 * sizeof(u32)) 64262306a36Sopenharmony_ci 64362306a36Sopenharmony_cistatic const u32 caicos_mgcg_disable[] = 64462306a36Sopenharmony_ci{ 64562306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 64662306a36Sopenharmony_ci 0x000008f8, 0x00000000, 0xffffffff, 64762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 64862306a36Sopenharmony_ci 0x000008f8, 0x00000001, 0xffffffff, 64962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 65062306a36Sopenharmony_ci 0x000008f8, 0x00000002, 0xffffffff, 65162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 65262306a36Sopenharmony_ci 0x000008f8, 0x00000003, 0xffffffff, 65362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 65462306a36Sopenharmony_ci 0x00009150, 0x00600000, 0xffffffff 65562306a36Sopenharmony_ci}; 65662306a36Sopenharmony_ci#define CAICOS_MGCG_DISABLE_LENGTH sizeof(caicos_mgcg_disable) / (3 * sizeof(u32)) 65762306a36Sopenharmony_ci 65862306a36Sopenharmony_cistatic const u32 caicos_mgcg_enable[] = 65962306a36Sopenharmony_ci{ 66062306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 66162306a36Sopenharmony_ci 0x000008f8, 0x00000000, 0xffffffff, 66262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 66362306a36Sopenharmony_ci 0x000008f8, 0x00000001, 0xffffffff, 66462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 66562306a36Sopenharmony_ci 0x000008f8, 0x00000002, 0xffffffff, 66662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 66762306a36Sopenharmony_ci 0x000008f8, 0x00000003, 0xffffffff, 66862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 66962306a36Sopenharmony_ci 0x00009150, 0x46944040, 0xffffffff 67062306a36Sopenharmony_ci}; 67162306a36Sopenharmony_ci#define CAICOS_MGCG_ENABLE_LENGTH sizeof(caicos_mgcg_enable) / (3 * sizeof(u32)) 67262306a36Sopenharmony_ci 67362306a36Sopenharmony_ci//********* TURKS **************// 67462306a36Sopenharmony_cistatic const u32 turks_cgcg_cgls_default[] = 67562306a36Sopenharmony_ci{ 67662306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 67762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 67862306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 67962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 68062306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 68162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 68262306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 68362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 68462306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 68562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 68662306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 68762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 68862306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 68962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 69062306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 69162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 69262306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 69362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 69462306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 69562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 69662306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 69762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 69862306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 69962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 70062306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 70162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 70262306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 70362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 70462306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 70562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 70662306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 70762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 70862306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 70962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 71062306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 71162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 71262306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 71362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 71462306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 71562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 71662306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 71762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 71862306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 71962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 72062306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 72162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 72262306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 72362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff 72462306a36Sopenharmony_ci}; 72562306a36Sopenharmony_ci#define TURKS_CGCG_CGLS_DEFAULT_LENGTH sizeof(turks_cgcg_cgls_default) / (3 * sizeof(u32)) 72662306a36Sopenharmony_ci 72762306a36Sopenharmony_cistatic const u32 turks_cgcg_cgls_disable[] = 72862306a36Sopenharmony_ci{ 72962306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 73062306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 73162306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 73262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 73362306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 73462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 73562306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 73662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 73762306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 73862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 73962306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 74062306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 74162306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 74262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 74362306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 74462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 74562306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 74662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 74762306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 74862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 74962306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 75062306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 75162306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 75262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 75362306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 75462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 75562306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 75662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 75762306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 75862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 75962306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 76062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 76162306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 76262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 76362306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 76462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 76562306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 76662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 76762306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 76862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 76962306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 77062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 77162306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 77262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 77362306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 77462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 77562306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 77662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 77762306a36Sopenharmony_ci 0x00000644, 0x000f7912, 0x001f4180, 77862306a36Sopenharmony_ci 0x00000644, 0x000f3812, 0x001f4180 77962306a36Sopenharmony_ci}; 78062306a36Sopenharmony_ci#define TURKS_CGCG_CGLS_DISABLE_LENGTH sizeof(turks_cgcg_cgls_disable) / (3 * sizeof(u32)) 78162306a36Sopenharmony_ci 78262306a36Sopenharmony_cistatic const u32 turks_cgcg_cgls_enable[] = 78362306a36Sopenharmony_ci{ 78462306a36Sopenharmony_ci /* 0x0000c124, 0x84180000, 0x00180000, */ 78562306a36Sopenharmony_ci 0x00000644, 0x000f7892, 0x001f4080, 78662306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 78762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 78862306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 78962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 79062306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 79162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 79262306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 79362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 79462306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 79562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 79662306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 79762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 79862306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 79962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 80062306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 80162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 80262306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 80362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 80462306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 80562306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 80662306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 80762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 80862306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 80962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 81062306a36Sopenharmony_ci 0x000008f8, 0x00000020, 0xffffffff, 81162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 81262306a36Sopenharmony_ci 0x000008f8, 0x00000021, 0xffffffff, 81362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 81462306a36Sopenharmony_ci 0x000008f8, 0x00000022, 0xffffffff, 81562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 81662306a36Sopenharmony_ci 0x000008f8, 0x00000023, 0xffffffff, 81762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 81862306a36Sopenharmony_ci 0x000008f8, 0x00000024, 0xffffffff, 81962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 82062306a36Sopenharmony_ci 0x000008f8, 0x00000025, 0xffffffff, 82162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 82262306a36Sopenharmony_ci 0x000008f8, 0x00000026, 0xffffffff, 82362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 82462306a36Sopenharmony_ci 0x000008f8, 0x00000027, 0xffffffff, 82562306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 82662306a36Sopenharmony_ci 0x000008f8, 0x00000028, 0xffffffff, 82762306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 82862306a36Sopenharmony_ci 0x000008f8, 0x00000029, 0xffffffff, 82962306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 83062306a36Sopenharmony_ci 0x000008f8, 0x0000002a, 0xffffffff, 83162306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 83262306a36Sopenharmony_ci 0x000008f8, 0x0000002b, 0xffffffff, 83362306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff 83462306a36Sopenharmony_ci}; 83562306a36Sopenharmony_ci#define TURKS_CGCG_CGLS_ENABLE_LENGTH sizeof(turks_cgcg_cgls_enable) / (3 * sizeof(u32)) 83662306a36Sopenharmony_ci 83762306a36Sopenharmony_ci// These are the sequences for turks_mgcg_shls 83862306a36Sopenharmony_cistatic const u32 turks_mgcg_default[] = 83962306a36Sopenharmony_ci{ 84062306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 84162306a36Sopenharmony_ci 0x00005448, 0x00000100, 0xffffffff, 84262306a36Sopenharmony_ci 0x000055e4, 0x00600100, 0xffffffff, 84362306a36Sopenharmony_ci 0x0000160c, 0x00000100, 0xffffffff, 84462306a36Sopenharmony_ci 0x0000c164, 0x00000100, 0xffffffff, 84562306a36Sopenharmony_ci 0x00008a18, 0x00000100, 0xffffffff, 84662306a36Sopenharmony_ci 0x0000897c, 0x06000100, 0xffffffff, 84762306a36Sopenharmony_ci 0x00008b28, 0x00000100, 0xffffffff, 84862306a36Sopenharmony_ci 0x00009144, 0x00000100, 0xffffffff, 84962306a36Sopenharmony_ci 0x00009a60, 0x00000100, 0xffffffff, 85062306a36Sopenharmony_ci 0x00009868, 0x00000100, 0xffffffff, 85162306a36Sopenharmony_ci 0x00008d58, 0x00000100, 0xffffffff, 85262306a36Sopenharmony_ci 0x00009510, 0x00000100, 0xffffffff, 85362306a36Sopenharmony_ci 0x0000949c, 0x00000100, 0xffffffff, 85462306a36Sopenharmony_ci 0x00009654, 0x00000100, 0xffffffff, 85562306a36Sopenharmony_ci 0x00009030, 0x00000100, 0xffffffff, 85662306a36Sopenharmony_ci 0x00009034, 0x00000100, 0xffffffff, 85762306a36Sopenharmony_ci 0x00009038, 0x00000100, 0xffffffff, 85862306a36Sopenharmony_ci 0x0000903c, 0x00000100, 0xffffffff, 85962306a36Sopenharmony_ci 0x00009040, 0x00000100, 0xffffffff, 86062306a36Sopenharmony_ci 0x0000a200, 0x00000100, 0xffffffff, 86162306a36Sopenharmony_ci 0x0000a204, 0x00000100, 0xffffffff, 86262306a36Sopenharmony_ci 0x0000a208, 0x00000100, 0xffffffff, 86362306a36Sopenharmony_ci 0x0000a20c, 0x00000100, 0xffffffff, 86462306a36Sopenharmony_ci 0x0000977c, 0x00000100, 0xffffffff, 86562306a36Sopenharmony_ci 0x00003f80, 0x00000100, 0xffffffff, 86662306a36Sopenharmony_ci 0x0000a210, 0x00000100, 0xffffffff, 86762306a36Sopenharmony_ci 0x0000a214, 0x00000100, 0xffffffff, 86862306a36Sopenharmony_ci 0x000004d8, 0x00000100, 0xffffffff, 86962306a36Sopenharmony_ci 0x00009784, 0x00000100, 0xffffffff, 87062306a36Sopenharmony_ci 0x00009698, 0x00000100, 0xffffffff, 87162306a36Sopenharmony_ci 0x000004d4, 0x00000200, 0xffffffff, 87262306a36Sopenharmony_ci 0x000004d0, 0x00000000, 0xffffffff, 87362306a36Sopenharmony_ci 0x000030cc, 0x00000100, 0xffffffff, 87462306a36Sopenharmony_ci 0x0000d0c0, 0x00000100, 0xffffffff, 87562306a36Sopenharmony_ci 0x0000915c, 0x00010000, 0xffffffff, 87662306a36Sopenharmony_ci 0x00009160, 0x00030002, 0xffffffff, 87762306a36Sopenharmony_ci 0x00009164, 0x00050004, 0xffffffff, 87862306a36Sopenharmony_ci 0x00009168, 0x00070006, 0xffffffff, 87962306a36Sopenharmony_ci 0x00009178, 0x00070000, 0xffffffff, 88062306a36Sopenharmony_ci 0x0000917c, 0x00030002, 0xffffffff, 88162306a36Sopenharmony_ci 0x00009180, 0x00050004, 0xffffffff, 88262306a36Sopenharmony_ci 0x0000918c, 0x00010006, 0xffffffff, 88362306a36Sopenharmony_ci 0x00009190, 0x00090008, 0xffffffff, 88462306a36Sopenharmony_ci 0x00009194, 0x00070000, 0xffffffff, 88562306a36Sopenharmony_ci 0x00009198, 0x00030002, 0xffffffff, 88662306a36Sopenharmony_ci 0x0000919c, 0x00050004, 0xffffffff, 88762306a36Sopenharmony_ci 0x000091a8, 0x00010006, 0xffffffff, 88862306a36Sopenharmony_ci 0x000091ac, 0x00090008, 0xffffffff, 88962306a36Sopenharmony_ci 0x000091b0, 0x00070000, 0xffffffff, 89062306a36Sopenharmony_ci 0x000091b4, 0x00030002, 0xffffffff, 89162306a36Sopenharmony_ci 0x000091b8, 0x00050004, 0xffffffff, 89262306a36Sopenharmony_ci 0x000091c4, 0x00010006, 0xffffffff, 89362306a36Sopenharmony_ci 0x000091c8, 0x00090008, 0xffffffff, 89462306a36Sopenharmony_ci 0x000091cc, 0x00070000, 0xffffffff, 89562306a36Sopenharmony_ci 0x000091d0, 0x00030002, 0xffffffff, 89662306a36Sopenharmony_ci 0x000091d4, 0x00050004, 0xffffffff, 89762306a36Sopenharmony_ci 0x000091e0, 0x00010006, 0xffffffff, 89862306a36Sopenharmony_ci 0x000091e4, 0x00090008, 0xffffffff, 89962306a36Sopenharmony_ci 0x000091e8, 0x00000000, 0xffffffff, 90062306a36Sopenharmony_ci 0x000091ec, 0x00070000, 0xffffffff, 90162306a36Sopenharmony_ci 0x000091f0, 0x00030002, 0xffffffff, 90262306a36Sopenharmony_ci 0x000091f4, 0x00050004, 0xffffffff, 90362306a36Sopenharmony_ci 0x00009200, 0x00010006, 0xffffffff, 90462306a36Sopenharmony_ci 0x00009204, 0x00090008, 0xffffffff, 90562306a36Sopenharmony_ci 0x00009208, 0x00070000, 0xffffffff, 90662306a36Sopenharmony_ci 0x0000920c, 0x00030002, 0xffffffff, 90762306a36Sopenharmony_ci 0x00009210, 0x00050004, 0xffffffff, 90862306a36Sopenharmony_ci 0x0000921c, 0x00010006, 0xffffffff, 90962306a36Sopenharmony_ci 0x00009220, 0x00090008, 0xffffffff, 91062306a36Sopenharmony_ci 0x00009294, 0x00000000, 0xffffffff, 91162306a36Sopenharmony_ci 0x000008f8, 0x00000010, 0xffffffff, 91262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 91362306a36Sopenharmony_ci 0x000008f8, 0x00000011, 0xffffffff, 91462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 91562306a36Sopenharmony_ci 0x000008f8, 0x00000012, 0xffffffff, 91662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 91762306a36Sopenharmony_ci 0x000008f8, 0x00000013, 0xffffffff, 91862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 91962306a36Sopenharmony_ci 0x000008f8, 0x00000014, 0xffffffff, 92062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 92162306a36Sopenharmony_ci 0x000008f8, 0x00000015, 0xffffffff, 92262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 92362306a36Sopenharmony_ci 0x000008f8, 0x00000016, 0xffffffff, 92462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 92562306a36Sopenharmony_ci 0x000008f8, 0x00000017, 0xffffffff, 92662306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 92762306a36Sopenharmony_ci 0x000008f8, 0x00000018, 0xffffffff, 92862306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 92962306a36Sopenharmony_ci 0x000008f8, 0x00000019, 0xffffffff, 93062306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 93162306a36Sopenharmony_ci 0x000008f8, 0x0000001a, 0xffffffff, 93262306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 93362306a36Sopenharmony_ci 0x000008f8, 0x0000001b, 0xffffffff, 93462306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff 93562306a36Sopenharmony_ci}; 93662306a36Sopenharmony_ci#define TURKS_MGCG_DEFAULT_LENGTH sizeof(turks_mgcg_default) / (3 * sizeof(u32)) 93762306a36Sopenharmony_ci 93862306a36Sopenharmony_cistatic const u32 turks_mgcg_disable[] = 93962306a36Sopenharmony_ci{ 94062306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 94162306a36Sopenharmony_ci 0x000008f8, 0x00000000, 0xffffffff, 94262306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 94362306a36Sopenharmony_ci 0x000008f8, 0x00000001, 0xffffffff, 94462306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 94562306a36Sopenharmony_ci 0x000008f8, 0x00000002, 0xffffffff, 94662306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 94762306a36Sopenharmony_ci 0x000008f8, 0x00000003, 0xffffffff, 94862306a36Sopenharmony_ci 0x000008fc, 0xffffffff, 0xffffffff, 94962306a36Sopenharmony_ci 0x00009150, 0x00600000, 0xffffffff 95062306a36Sopenharmony_ci}; 95162306a36Sopenharmony_ci#define TURKS_MGCG_DISABLE_LENGTH sizeof(turks_mgcg_disable) / (3 * sizeof(u32)) 95262306a36Sopenharmony_ci 95362306a36Sopenharmony_cistatic const u32 turks_mgcg_enable[] = 95462306a36Sopenharmony_ci{ 95562306a36Sopenharmony_ci 0x0000802c, 0xc0000000, 0xffffffff, 95662306a36Sopenharmony_ci 0x000008f8, 0x00000000, 0xffffffff, 95762306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 95862306a36Sopenharmony_ci 0x000008f8, 0x00000001, 0xffffffff, 95962306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 96062306a36Sopenharmony_ci 0x000008f8, 0x00000002, 0xffffffff, 96162306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 96262306a36Sopenharmony_ci 0x000008f8, 0x00000003, 0xffffffff, 96362306a36Sopenharmony_ci 0x000008fc, 0x00000000, 0xffffffff, 96462306a36Sopenharmony_ci 0x00009150, 0x6e944000, 0xffffffff 96562306a36Sopenharmony_ci}; 96662306a36Sopenharmony_ci#define TURKS_MGCG_ENABLE_LENGTH sizeof(turks_mgcg_enable) / (3 * sizeof(u32)) 96762306a36Sopenharmony_ci 96862306a36Sopenharmony_ci#endif 96962306a36Sopenharmony_ci 97062306a36Sopenharmony_ci#ifndef BTC_SYSLS_SEQUENCE 97162306a36Sopenharmony_ci#define BTC_SYSLS_SEQUENCE 100 97262306a36Sopenharmony_ci 97362306a36Sopenharmony_ci 97462306a36Sopenharmony_ci//********* BARTS **************// 97562306a36Sopenharmony_cistatic const u32 barts_sysls_default[] = 97662306a36Sopenharmony_ci{ 97762306a36Sopenharmony_ci /* Register, Value, Mask bits */ 97862306a36Sopenharmony_ci 0x000055e8, 0x00000000, 0xffffffff, 97962306a36Sopenharmony_ci 0x0000d0bc, 0x00000000, 0xffffffff, 98062306a36Sopenharmony_ci 0x000015c0, 0x000c1401, 0xffffffff, 98162306a36Sopenharmony_ci 0x0000264c, 0x000c0400, 0xffffffff, 98262306a36Sopenharmony_ci 0x00002648, 0x000c0400, 0xffffffff, 98362306a36Sopenharmony_ci 0x00002650, 0x000c0400, 0xffffffff, 98462306a36Sopenharmony_ci 0x000020b8, 0x000c0400, 0xffffffff, 98562306a36Sopenharmony_ci 0x000020bc, 0x000c0400, 0xffffffff, 98662306a36Sopenharmony_ci 0x000020c0, 0x000c0c80, 0xffffffff, 98762306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 98862306a36Sopenharmony_ci 0x0000f4a4, 0x00680fff, 0xffffffff, 98962306a36Sopenharmony_ci 0x000004c8, 0x00000001, 0xffffffff, 99062306a36Sopenharmony_ci 0x000064ec, 0x00000000, 0xffffffff, 99162306a36Sopenharmony_ci 0x00000c7c, 0x00000000, 0xffffffff, 99262306a36Sopenharmony_ci 0x00006dfc, 0x00000000, 0xffffffff 99362306a36Sopenharmony_ci}; 99462306a36Sopenharmony_ci#define BARTS_SYSLS_DEFAULT_LENGTH sizeof(barts_sysls_default) / (3 * sizeof(u32)) 99562306a36Sopenharmony_ci 99662306a36Sopenharmony_cistatic const u32 barts_sysls_disable[] = 99762306a36Sopenharmony_ci{ 99862306a36Sopenharmony_ci 0x000055e8, 0x00000000, 0xffffffff, 99962306a36Sopenharmony_ci 0x0000d0bc, 0x00000000, 0xffffffff, 100062306a36Sopenharmony_ci 0x000015c0, 0x00041401, 0xffffffff, 100162306a36Sopenharmony_ci 0x0000264c, 0x00040400, 0xffffffff, 100262306a36Sopenharmony_ci 0x00002648, 0x00040400, 0xffffffff, 100362306a36Sopenharmony_ci 0x00002650, 0x00040400, 0xffffffff, 100462306a36Sopenharmony_ci 0x000020b8, 0x00040400, 0xffffffff, 100562306a36Sopenharmony_ci 0x000020bc, 0x00040400, 0xffffffff, 100662306a36Sopenharmony_ci 0x000020c0, 0x00040c80, 0xffffffff, 100762306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 100862306a36Sopenharmony_ci 0x0000f4a4, 0x00680000, 0xffffffff, 100962306a36Sopenharmony_ci 0x000004c8, 0x00000001, 0xffffffff, 101062306a36Sopenharmony_ci 0x000064ec, 0x00007ffd, 0xffffffff, 101162306a36Sopenharmony_ci 0x00000c7c, 0x0000ff00, 0xffffffff, 101262306a36Sopenharmony_ci 0x00006dfc, 0x0000007f, 0xffffffff 101362306a36Sopenharmony_ci}; 101462306a36Sopenharmony_ci#define BARTS_SYSLS_DISABLE_LENGTH sizeof(barts_sysls_disable) / (3 * sizeof(u32)) 101562306a36Sopenharmony_ci 101662306a36Sopenharmony_cistatic const u32 barts_sysls_enable[] = 101762306a36Sopenharmony_ci{ 101862306a36Sopenharmony_ci 0x000055e8, 0x00000001, 0xffffffff, 101962306a36Sopenharmony_ci 0x0000d0bc, 0x00000100, 0xffffffff, 102062306a36Sopenharmony_ci 0x000015c0, 0x000c1401, 0xffffffff, 102162306a36Sopenharmony_ci 0x0000264c, 0x000c0400, 0xffffffff, 102262306a36Sopenharmony_ci 0x00002648, 0x000c0400, 0xffffffff, 102362306a36Sopenharmony_ci 0x00002650, 0x000c0400, 0xffffffff, 102462306a36Sopenharmony_ci 0x000020b8, 0x000c0400, 0xffffffff, 102562306a36Sopenharmony_ci 0x000020bc, 0x000c0400, 0xffffffff, 102662306a36Sopenharmony_ci 0x000020c0, 0x000c0c80, 0xffffffff, 102762306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 102862306a36Sopenharmony_ci 0x0000f4a4, 0x00680fff, 0xffffffff, 102962306a36Sopenharmony_ci 0x000004c8, 0x00000000, 0xffffffff, 103062306a36Sopenharmony_ci 0x000064ec, 0x00000000, 0xffffffff, 103162306a36Sopenharmony_ci 0x00000c7c, 0x00000000, 0xffffffff, 103262306a36Sopenharmony_ci 0x00006dfc, 0x00000000, 0xffffffff 103362306a36Sopenharmony_ci}; 103462306a36Sopenharmony_ci#define BARTS_SYSLS_ENABLE_LENGTH sizeof(barts_sysls_enable) / (3 * sizeof(u32)) 103562306a36Sopenharmony_ci 103662306a36Sopenharmony_ci//********* CAICOS **************// 103762306a36Sopenharmony_cistatic const u32 caicos_sysls_default[] = 103862306a36Sopenharmony_ci{ 103962306a36Sopenharmony_ci 0x000055e8, 0x00000000, 0xffffffff, 104062306a36Sopenharmony_ci 0x0000d0bc, 0x00000000, 0xffffffff, 104162306a36Sopenharmony_ci 0x000015c0, 0x000c1401, 0xffffffff, 104262306a36Sopenharmony_ci 0x0000264c, 0x000c0400, 0xffffffff, 104362306a36Sopenharmony_ci 0x00002648, 0x000c0400, 0xffffffff, 104462306a36Sopenharmony_ci 0x00002650, 0x000c0400, 0xffffffff, 104562306a36Sopenharmony_ci 0x000020b8, 0x000c0400, 0xffffffff, 104662306a36Sopenharmony_ci 0x000020bc, 0x000c0400, 0xffffffff, 104762306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 104862306a36Sopenharmony_ci 0x0000f4a4, 0x00680fff, 0xffffffff, 104962306a36Sopenharmony_ci 0x000004c8, 0x00000001, 0xffffffff, 105062306a36Sopenharmony_ci 0x000064ec, 0x00000000, 0xffffffff, 105162306a36Sopenharmony_ci 0x00000c7c, 0x00000000, 0xffffffff, 105262306a36Sopenharmony_ci 0x00006dfc, 0x00000000, 0xffffffff 105362306a36Sopenharmony_ci}; 105462306a36Sopenharmony_ci#define CAICOS_SYSLS_DEFAULT_LENGTH sizeof(caicos_sysls_default) / (3 * sizeof(u32)) 105562306a36Sopenharmony_ci 105662306a36Sopenharmony_cistatic const u32 caicos_sysls_disable[] = 105762306a36Sopenharmony_ci{ 105862306a36Sopenharmony_ci 0x000055e8, 0x00000000, 0xffffffff, 105962306a36Sopenharmony_ci 0x0000d0bc, 0x00000000, 0xffffffff, 106062306a36Sopenharmony_ci 0x000015c0, 0x00041401, 0xffffffff, 106162306a36Sopenharmony_ci 0x0000264c, 0x00040400, 0xffffffff, 106262306a36Sopenharmony_ci 0x00002648, 0x00040400, 0xffffffff, 106362306a36Sopenharmony_ci 0x00002650, 0x00040400, 0xffffffff, 106462306a36Sopenharmony_ci 0x000020b8, 0x00040400, 0xffffffff, 106562306a36Sopenharmony_ci 0x000020bc, 0x00040400, 0xffffffff, 106662306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 106762306a36Sopenharmony_ci 0x0000f4a4, 0x00680000, 0xffffffff, 106862306a36Sopenharmony_ci 0x000004c8, 0x00000001, 0xffffffff, 106962306a36Sopenharmony_ci 0x000064ec, 0x00007ffd, 0xffffffff, 107062306a36Sopenharmony_ci 0x00000c7c, 0x0000ff00, 0xffffffff, 107162306a36Sopenharmony_ci 0x00006dfc, 0x0000007f, 0xffffffff 107262306a36Sopenharmony_ci}; 107362306a36Sopenharmony_ci#define CAICOS_SYSLS_DISABLE_LENGTH sizeof(caicos_sysls_disable) / (3 * sizeof(u32)) 107462306a36Sopenharmony_ci 107562306a36Sopenharmony_cistatic const u32 caicos_sysls_enable[] = 107662306a36Sopenharmony_ci{ 107762306a36Sopenharmony_ci 0x000055e8, 0x00000001, 0xffffffff, 107862306a36Sopenharmony_ci 0x0000d0bc, 0x00000100, 0xffffffff, 107962306a36Sopenharmony_ci 0x000015c0, 0x000c1401, 0xffffffff, 108062306a36Sopenharmony_ci 0x0000264c, 0x000c0400, 0xffffffff, 108162306a36Sopenharmony_ci 0x00002648, 0x000c0400, 0xffffffff, 108262306a36Sopenharmony_ci 0x00002650, 0x000c0400, 0xffffffff, 108362306a36Sopenharmony_ci 0x000020b8, 0x000c0400, 0xffffffff, 108462306a36Sopenharmony_ci 0x000020bc, 0x000c0400, 0xffffffff, 108562306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 108662306a36Sopenharmony_ci 0x0000f4a4, 0x00680fff, 0xffffffff, 108762306a36Sopenharmony_ci 0x000064ec, 0x00000000, 0xffffffff, 108862306a36Sopenharmony_ci 0x00000c7c, 0x00000000, 0xffffffff, 108962306a36Sopenharmony_ci 0x00006dfc, 0x00000000, 0xffffffff, 109062306a36Sopenharmony_ci 0x000004c8, 0x00000000, 0xffffffff 109162306a36Sopenharmony_ci}; 109262306a36Sopenharmony_ci#define CAICOS_SYSLS_ENABLE_LENGTH sizeof(caicos_sysls_enable) / (3 * sizeof(u32)) 109362306a36Sopenharmony_ci 109462306a36Sopenharmony_ci//********* TURKS **************// 109562306a36Sopenharmony_cistatic const u32 turks_sysls_default[] = 109662306a36Sopenharmony_ci{ 109762306a36Sopenharmony_ci 0x000055e8, 0x00000000, 0xffffffff, 109862306a36Sopenharmony_ci 0x0000d0bc, 0x00000000, 0xffffffff, 109962306a36Sopenharmony_ci 0x000015c0, 0x000c1401, 0xffffffff, 110062306a36Sopenharmony_ci 0x0000264c, 0x000c0400, 0xffffffff, 110162306a36Sopenharmony_ci 0x00002648, 0x000c0400, 0xffffffff, 110262306a36Sopenharmony_ci 0x00002650, 0x000c0400, 0xffffffff, 110362306a36Sopenharmony_ci 0x000020b8, 0x000c0400, 0xffffffff, 110462306a36Sopenharmony_ci 0x000020bc, 0x000c0400, 0xffffffff, 110562306a36Sopenharmony_ci 0x000020c0, 0x000c0c80, 0xffffffff, 110662306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 110762306a36Sopenharmony_ci 0x0000f4a4, 0x00680fff, 0xffffffff, 110862306a36Sopenharmony_ci 0x000004c8, 0x00000001, 0xffffffff, 110962306a36Sopenharmony_ci 0x000064ec, 0x00000000, 0xffffffff, 111062306a36Sopenharmony_ci 0x00000c7c, 0x00000000, 0xffffffff, 111162306a36Sopenharmony_ci 0x00006dfc, 0x00000000, 0xffffffff 111262306a36Sopenharmony_ci}; 111362306a36Sopenharmony_ci#define TURKS_SYSLS_DEFAULT_LENGTH sizeof(turks_sysls_default) / (3 * sizeof(u32)) 111462306a36Sopenharmony_ci 111562306a36Sopenharmony_cistatic const u32 turks_sysls_disable[] = 111662306a36Sopenharmony_ci{ 111762306a36Sopenharmony_ci 0x000055e8, 0x00000000, 0xffffffff, 111862306a36Sopenharmony_ci 0x0000d0bc, 0x00000000, 0xffffffff, 111962306a36Sopenharmony_ci 0x000015c0, 0x00041401, 0xffffffff, 112062306a36Sopenharmony_ci 0x0000264c, 0x00040400, 0xffffffff, 112162306a36Sopenharmony_ci 0x00002648, 0x00040400, 0xffffffff, 112262306a36Sopenharmony_ci 0x00002650, 0x00040400, 0xffffffff, 112362306a36Sopenharmony_ci 0x000020b8, 0x00040400, 0xffffffff, 112462306a36Sopenharmony_ci 0x000020bc, 0x00040400, 0xffffffff, 112562306a36Sopenharmony_ci 0x000020c0, 0x00040c80, 0xffffffff, 112662306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 112762306a36Sopenharmony_ci 0x0000f4a4, 0x00680000, 0xffffffff, 112862306a36Sopenharmony_ci 0x000004c8, 0x00000001, 0xffffffff, 112962306a36Sopenharmony_ci 0x000064ec, 0x00007ffd, 0xffffffff, 113062306a36Sopenharmony_ci 0x00000c7c, 0x0000ff00, 0xffffffff, 113162306a36Sopenharmony_ci 0x00006dfc, 0x0000007f, 0xffffffff 113262306a36Sopenharmony_ci}; 113362306a36Sopenharmony_ci#define TURKS_SYSLS_DISABLE_LENGTH sizeof(turks_sysls_disable) / (3 * sizeof(u32)) 113462306a36Sopenharmony_ci 113562306a36Sopenharmony_cistatic const u32 turks_sysls_enable[] = 113662306a36Sopenharmony_ci{ 113762306a36Sopenharmony_ci 0x000055e8, 0x00000001, 0xffffffff, 113862306a36Sopenharmony_ci 0x0000d0bc, 0x00000100, 0xffffffff, 113962306a36Sopenharmony_ci 0x000015c0, 0x000c1401, 0xffffffff, 114062306a36Sopenharmony_ci 0x0000264c, 0x000c0400, 0xffffffff, 114162306a36Sopenharmony_ci 0x00002648, 0x000c0400, 0xffffffff, 114262306a36Sopenharmony_ci 0x00002650, 0x000c0400, 0xffffffff, 114362306a36Sopenharmony_ci 0x000020b8, 0x000c0400, 0xffffffff, 114462306a36Sopenharmony_ci 0x000020bc, 0x000c0400, 0xffffffff, 114562306a36Sopenharmony_ci 0x000020c0, 0x000c0c80, 0xffffffff, 114662306a36Sopenharmony_ci 0x0000f4a0, 0x000000c0, 0xffffffff, 114762306a36Sopenharmony_ci 0x0000f4a4, 0x00680fff, 0xffffffff, 114862306a36Sopenharmony_ci 0x000004c8, 0x00000000, 0xffffffff, 114962306a36Sopenharmony_ci 0x000064ec, 0x00000000, 0xffffffff, 115062306a36Sopenharmony_ci 0x00000c7c, 0x00000000, 0xffffffff, 115162306a36Sopenharmony_ci 0x00006dfc, 0x00000000, 0xffffffff 115262306a36Sopenharmony_ci}; 115362306a36Sopenharmony_ci#define TURKS_SYSLS_ENABLE_LENGTH sizeof(turks_sysls_enable) / (3 * sizeof(u32)) 115462306a36Sopenharmony_ci 115562306a36Sopenharmony_ci#endif 115662306a36Sopenharmony_ci 115762306a36Sopenharmony_ciu32 btc_valid_sclk[40] = 115862306a36Sopenharmony_ci{ 115962306a36Sopenharmony_ci 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000, 116062306a36Sopenharmony_ci 55000, 60000, 65000, 70000, 75000, 80000, 85000, 90000, 95000, 100000, 116162306a36Sopenharmony_ci 105000, 110000, 11500, 120000, 125000, 130000, 135000, 140000, 145000, 150000, 116262306a36Sopenharmony_ci 155000, 160000, 165000, 170000, 175000, 180000, 185000, 190000, 195000, 200000 116362306a36Sopenharmony_ci}; 116462306a36Sopenharmony_ci 116562306a36Sopenharmony_cistatic const struct radeon_blacklist_clocks btc_blacklist_clocks[] = { 116662306a36Sopenharmony_ci { 10000, 30000, RADEON_SCLK_UP }, 116762306a36Sopenharmony_ci { 15000, 30000, RADEON_SCLK_UP }, 116862306a36Sopenharmony_ci { 20000, 30000, RADEON_SCLK_UP }, 116962306a36Sopenharmony_ci { 25000, 30000, RADEON_SCLK_UP } 117062306a36Sopenharmony_ci}; 117162306a36Sopenharmony_ci 117262306a36Sopenharmony_civoid btc_get_max_clock_from_voltage_dependency_table(struct radeon_clock_voltage_dependency_table *table, 117362306a36Sopenharmony_ci u32 *max_clock) 117462306a36Sopenharmony_ci{ 117562306a36Sopenharmony_ci u32 i, clock = 0; 117662306a36Sopenharmony_ci 117762306a36Sopenharmony_ci if ((table == NULL) || (table->count == 0)) { 117862306a36Sopenharmony_ci *max_clock = clock; 117962306a36Sopenharmony_ci return; 118062306a36Sopenharmony_ci } 118162306a36Sopenharmony_ci 118262306a36Sopenharmony_ci for (i = 0; i < table->count; i++) { 118362306a36Sopenharmony_ci if (clock < table->entries[i].clk) 118462306a36Sopenharmony_ci clock = table->entries[i].clk; 118562306a36Sopenharmony_ci } 118662306a36Sopenharmony_ci *max_clock = clock; 118762306a36Sopenharmony_ci} 118862306a36Sopenharmony_ci 118962306a36Sopenharmony_civoid btc_apply_voltage_dependency_rules(struct radeon_clock_voltage_dependency_table *table, 119062306a36Sopenharmony_ci u32 clock, u16 max_voltage, u16 *voltage) 119162306a36Sopenharmony_ci{ 119262306a36Sopenharmony_ci u32 i; 119362306a36Sopenharmony_ci 119462306a36Sopenharmony_ci if ((table == NULL) || (table->count == 0)) 119562306a36Sopenharmony_ci return; 119662306a36Sopenharmony_ci 119762306a36Sopenharmony_ci for (i= 0; i < table->count; i++) { 119862306a36Sopenharmony_ci if (clock <= table->entries[i].clk) { 119962306a36Sopenharmony_ci if (*voltage < table->entries[i].v) 120062306a36Sopenharmony_ci *voltage = (u16)((table->entries[i].v < max_voltage) ? 120162306a36Sopenharmony_ci table->entries[i].v : max_voltage); 120262306a36Sopenharmony_ci return; 120362306a36Sopenharmony_ci } 120462306a36Sopenharmony_ci } 120562306a36Sopenharmony_ci 120662306a36Sopenharmony_ci *voltage = (*voltage > max_voltage) ? *voltage : max_voltage; 120762306a36Sopenharmony_ci} 120862306a36Sopenharmony_ci 120962306a36Sopenharmony_cistatic u32 btc_find_valid_clock(struct radeon_clock_array *clocks, 121062306a36Sopenharmony_ci u32 max_clock, u32 requested_clock) 121162306a36Sopenharmony_ci{ 121262306a36Sopenharmony_ci unsigned int i; 121362306a36Sopenharmony_ci 121462306a36Sopenharmony_ci if ((clocks == NULL) || (clocks->count == 0)) 121562306a36Sopenharmony_ci return (requested_clock < max_clock) ? requested_clock : max_clock; 121662306a36Sopenharmony_ci 121762306a36Sopenharmony_ci for (i = 0; i < clocks->count; i++) { 121862306a36Sopenharmony_ci if (clocks->values[i] >= requested_clock) 121962306a36Sopenharmony_ci return (clocks->values[i] < max_clock) ? clocks->values[i] : max_clock; 122062306a36Sopenharmony_ci } 122162306a36Sopenharmony_ci 122262306a36Sopenharmony_ci return (clocks->values[clocks->count - 1] < max_clock) ? 122362306a36Sopenharmony_ci clocks->values[clocks->count - 1] : max_clock; 122462306a36Sopenharmony_ci} 122562306a36Sopenharmony_ci 122662306a36Sopenharmony_cistatic u32 btc_get_valid_mclk(struct radeon_device *rdev, 122762306a36Sopenharmony_ci u32 max_mclk, u32 requested_mclk) 122862306a36Sopenharmony_ci{ 122962306a36Sopenharmony_ci return btc_find_valid_clock(&rdev->pm.dpm.dyn_state.valid_mclk_values, 123062306a36Sopenharmony_ci max_mclk, requested_mclk); 123162306a36Sopenharmony_ci} 123262306a36Sopenharmony_ci 123362306a36Sopenharmony_cistatic u32 btc_get_valid_sclk(struct radeon_device *rdev, 123462306a36Sopenharmony_ci u32 max_sclk, u32 requested_sclk) 123562306a36Sopenharmony_ci{ 123662306a36Sopenharmony_ci return btc_find_valid_clock(&rdev->pm.dpm.dyn_state.valid_sclk_values, 123762306a36Sopenharmony_ci max_sclk, requested_sclk); 123862306a36Sopenharmony_ci} 123962306a36Sopenharmony_ci 124062306a36Sopenharmony_civoid btc_skip_blacklist_clocks(struct radeon_device *rdev, 124162306a36Sopenharmony_ci const u32 max_sclk, const u32 max_mclk, 124262306a36Sopenharmony_ci u32 *sclk, u32 *mclk) 124362306a36Sopenharmony_ci{ 124462306a36Sopenharmony_ci int i, num_blacklist_clocks; 124562306a36Sopenharmony_ci 124662306a36Sopenharmony_ci if ((sclk == NULL) || (mclk == NULL)) 124762306a36Sopenharmony_ci return; 124862306a36Sopenharmony_ci 124962306a36Sopenharmony_ci num_blacklist_clocks = ARRAY_SIZE(btc_blacklist_clocks); 125062306a36Sopenharmony_ci 125162306a36Sopenharmony_ci for (i = 0; i < num_blacklist_clocks; i++) { 125262306a36Sopenharmony_ci if ((btc_blacklist_clocks[i].sclk == *sclk) && 125362306a36Sopenharmony_ci (btc_blacklist_clocks[i].mclk == *mclk)) 125462306a36Sopenharmony_ci break; 125562306a36Sopenharmony_ci } 125662306a36Sopenharmony_ci 125762306a36Sopenharmony_ci if (i < num_blacklist_clocks) { 125862306a36Sopenharmony_ci if (btc_blacklist_clocks[i].action == RADEON_SCLK_UP) { 125962306a36Sopenharmony_ci *sclk = btc_get_valid_sclk(rdev, max_sclk, *sclk + 1); 126062306a36Sopenharmony_ci 126162306a36Sopenharmony_ci if (*sclk < max_sclk) 126262306a36Sopenharmony_ci btc_skip_blacklist_clocks(rdev, max_sclk, max_mclk, sclk, mclk); 126362306a36Sopenharmony_ci } 126462306a36Sopenharmony_ci } 126562306a36Sopenharmony_ci} 126662306a36Sopenharmony_ci 126762306a36Sopenharmony_civoid btc_adjust_clock_combinations(struct radeon_device *rdev, 126862306a36Sopenharmony_ci const struct radeon_clock_and_voltage_limits *max_limits, 126962306a36Sopenharmony_ci struct rv7xx_pl *pl) 127062306a36Sopenharmony_ci{ 127162306a36Sopenharmony_ci 127262306a36Sopenharmony_ci if ((pl->mclk == 0) || (pl->sclk == 0)) 127362306a36Sopenharmony_ci return; 127462306a36Sopenharmony_ci 127562306a36Sopenharmony_ci if (pl->mclk == pl->sclk) 127662306a36Sopenharmony_ci return; 127762306a36Sopenharmony_ci 127862306a36Sopenharmony_ci if (pl->mclk > pl->sclk) { 127962306a36Sopenharmony_ci if (((pl->mclk + (pl->sclk - 1)) / pl->sclk) > rdev->pm.dpm.dyn_state.mclk_sclk_ratio) 128062306a36Sopenharmony_ci pl->sclk = btc_get_valid_sclk(rdev, 128162306a36Sopenharmony_ci max_limits->sclk, 128262306a36Sopenharmony_ci (pl->mclk + 128362306a36Sopenharmony_ci (rdev->pm.dpm.dyn_state.mclk_sclk_ratio - 1)) / 128462306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.mclk_sclk_ratio); 128562306a36Sopenharmony_ci } else { 128662306a36Sopenharmony_ci if ((pl->sclk - pl->mclk) > rdev->pm.dpm.dyn_state.sclk_mclk_delta) 128762306a36Sopenharmony_ci pl->mclk = btc_get_valid_mclk(rdev, 128862306a36Sopenharmony_ci max_limits->mclk, 128962306a36Sopenharmony_ci pl->sclk - 129062306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.sclk_mclk_delta); 129162306a36Sopenharmony_ci } 129262306a36Sopenharmony_ci} 129362306a36Sopenharmony_ci 129462306a36Sopenharmony_cistatic u16 btc_find_voltage(struct atom_voltage_table *table, u16 voltage) 129562306a36Sopenharmony_ci{ 129662306a36Sopenharmony_ci unsigned int i; 129762306a36Sopenharmony_ci 129862306a36Sopenharmony_ci for (i = 0; i < table->count; i++) { 129962306a36Sopenharmony_ci if (voltage <= table->entries[i].value) 130062306a36Sopenharmony_ci return table->entries[i].value; 130162306a36Sopenharmony_ci } 130262306a36Sopenharmony_ci 130362306a36Sopenharmony_ci return table->entries[table->count - 1].value; 130462306a36Sopenharmony_ci} 130562306a36Sopenharmony_ci 130662306a36Sopenharmony_civoid btc_apply_voltage_delta_rules(struct radeon_device *rdev, 130762306a36Sopenharmony_ci u16 max_vddc, u16 max_vddci, 130862306a36Sopenharmony_ci u16 *vddc, u16 *vddci) 130962306a36Sopenharmony_ci{ 131062306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 131162306a36Sopenharmony_ci u16 new_voltage; 131262306a36Sopenharmony_ci 131362306a36Sopenharmony_ci if ((0 == *vddc) || (0 == *vddci)) 131462306a36Sopenharmony_ci return; 131562306a36Sopenharmony_ci 131662306a36Sopenharmony_ci if (*vddc > *vddci) { 131762306a36Sopenharmony_ci if ((*vddc - *vddci) > rdev->pm.dpm.dyn_state.vddc_vddci_delta) { 131862306a36Sopenharmony_ci new_voltage = btc_find_voltage(&eg_pi->vddci_voltage_table, 131962306a36Sopenharmony_ci (*vddc - rdev->pm.dpm.dyn_state.vddc_vddci_delta)); 132062306a36Sopenharmony_ci *vddci = (new_voltage < max_vddci) ? new_voltage : max_vddci; 132162306a36Sopenharmony_ci } 132262306a36Sopenharmony_ci } else { 132362306a36Sopenharmony_ci if ((*vddci - *vddc) > rdev->pm.dpm.dyn_state.vddc_vddci_delta) { 132462306a36Sopenharmony_ci new_voltage = btc_find_voltage(&eg_pi->vddc_voltage_table, 132562306a36Sopenharmony_ci (*vddci - rdev->pm.dpm.dyn_state.vddc_vddci_delta)); 132662306a36Sopenharmony_ci *vddc = (new_voltage < max_vddc) ? new_voltage : max_vddc; 132762306a36Sopenharmony_ci } 132862306a36Sopenharmony_ci } 132962306a36Sopenharmony_ci} 133062306a36Sopenharmony_ci 133162306a36Sopenharmony_cistatic void btc_enable_bif_dynamic_pcie_gen2(struct radeon_device *rdev, 133262306a36Sopenharmony_ci bool enable) 133362306a36Sopenharmony_ci{ 133462306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 133562306a36Sopenharmony_ci u32 tmp, bif; 133662306a36Sopenharmony_ci 133762306a36Sopenharmony_ci tmp = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL); 133862306a36Sopenharmony_ci if (enable) { 133962306a36Sopenharmony_ci if ((tmp & LC_OTHER_SIDE_EVER_SENT_GEN2) && 134062306a36Sopenharmony_ci (tmp & LC_OTHER_SIDE_SUPPORTS_GEN2)) { 134162306a36Sopenharmony_ci if (!pi->boot_in_gen2) { 134262306a36Sopenharmony_ci bif = RREG32(CG_BIF_REQ_AND_RSP) & ~CG_CLIENT_REQ_MASK; 134362306a36Sopenharmony_ci bif |= CG_CLIENT_REQ(0xd); 134462306a36Sopenharmony_ci WREG32(CG_BIF_REQ_AND_RSP, bif); 134562306a36Sopenharmony_ci 134662306a36Sopenharmony_ci tmp &= ~LC_HW_VOLTAGE_IF_CONTROL_MASK; 134762306a36Sopenharmony_ci tmp |= LC_HW_VOLTAGE_IF_CONTROL(1); 134862306a36Sopenharmony_ci tmp |= LC_GEN2_EN_STRAP; 134962306a36Sopenharmony_ci 135062306a36Sopenharmony_ci tmp |= LC_CLR_FAILED_SPD_CHANGE_CNT; 135162306a36Sopenharmony_ci WREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL, tmp); 135262306a36Sopenharmony_ci udelay(10); 135362306a36Sopenharmony_ci tmp &= ~LC_CLR_FAILED_SPD_CHANGE_CNT; 135462306a36Sopenharmony_ci WREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL, tmp); 135562306a36Sopenharmony_ci } 135662306a36Sopenharmony_ci } 135762306a36Sopenharmony_ci } else { 135862306a36Sopenharmony_ci if ((tmp & LC_OTHER_SIDE_EVER_SENT_GEN2) || 135962306a36Sopenharmony_ci (tmp & LC_OTHER_SIDE_SUPPORTS_GEN2)) { 136062306a36Sopenharmony_ci if (!pi->boot_in_gen2) { 136162306a36Sopenharmony_ci bif = RREG32(CG_BIF_REQ_AND_RSP) & ~CG_CLIENT_REQ_MASK; 136262306a36Sopenharmony_ci bif |= CG_CLIENT_REQ(0xd); 136362306a36Sopenharmony_ci WREG32(CG_BIF_REQ_AND_RSP, bif); 136462306a36Sopenharmony_ci 136562306a36Sopenharmony_ci tmp &= ~LC_HW_VOLTAGE_IF_CONTROL_MASK; 136662306a36Sopenharmony_ci tmp &= ~LC_GEN2_EN_STRAP; 136762306a36Sopenharmony_ci } 136862306a36Sopenharmony_ci WREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL, tmp); 136962306a36Sopenharmony_ci } 137062306a36Sopenharmony_ci } 137162306a36Sopenharmony_ci} 137262306a36Sopenharmony_ci 137362306a36Sopenharmony_cistatic void btc_enable_dynamic_pcie_gen2(struct radeon_device *rdev, 137462306a36Sopenharmony_ci bool enable) 137562306a36Sopenharmony_ci{ 137662306a36Sopenharmony_ci btc_enable_bif_dynamic_pcie_gen2(rdev, enable); 137762306a36Sopenharmony_ci 137862306a36Sopenharmony_ci if (enable) 137962306a36Sopenharmony_ci WREG32_P(GENERAL_PWRMGT, ENABLE_GEN2PCIE, ~ENABLE_GEN2PCIE); 138062306a36Sopenharmony_ci else 138162306a36Sopenharmony_ci WREG32_P(GENERAL_PWRMGT, 0, ~ENABLE_GEN2PCIE); 138262306a36Sopenharmony_ci} 138362306a36Sopenharmony_ci 138462306a36Sopenharmony_cistatic int btc_disable_ulv(struct radeon_device *rdev) 138562306a36Sopenharmony_ci{ 138662306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 138762306a36Sopenharmony_ci 138862306a36Sopenharmony_ci if (eg_pi->ulv.supported) { 138962306a36Sopenharmony_ci if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_DisableULV) != PPSMC_Result_OK) 139062306a36Sopenharmony_ci return -EINVAL; 139162306a36Sopenharmony_ci } 139262306a36Sopenharmony_ci return 0; 139362306a36Sopenharmony_ci} 139462306a36Sopenharmony_ci 139562306a36Sopenharmony_cistatic int btc_populate_ulv_state(struct radeon_device *rdev, 139662306a36Sopenharmony_ci RV770_SMC_STATETABLE *table) 139762306a36Sopenharmony_ci{ 139862306a36Sopenharmony_ci int ret = -EINVAL; 139962306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 140062306a36Sopenharmony_ci struct rv7xx_pl *ulv_pl = eg_pi->ulv.pl; 140162306a36Sopenharmony_ci 140262306a36Sopenharmony_ci if (ulv_pl->vddc) { 140362306a36Sopenharmony_ci ret = cypress_convert_power_level_to_smc(rdev, 140462306a36Sopenharmony_ci ulv_pl, 140562306a36Sopenharmony_ci &table->ULVState.levels[0], 140662306a36Sopenharmony_ci PPSMC_DISPLAY_WATERMARK_LOW); 140762306a36Sopenharmony_ci if (ret == 0) { 140862306a36Sopenharmony_ci table->ULVState.levels[0].arbValue = MC_CG_ARB_FREQ_F0; 140962306a36Sopenharmony_ci table->ULVState.levels[0].ACIndex = 1; 141062306a36Sopenharmony_ci 141162306a36Sopenharmony_ci table->ULVState.levels[1] = table->ULVState.levels[0]; 141262306a36Sopenharmony_ci table->ULVState.levels[2] = table->ULVState.levels[0]; 141362306a36Sopenharmony_ci 141462306a36Sopenharmony_ci table->ULVState.flags |= PPSMC_SWSTATE_FLAG_DC; 141562306a36Sopenharmony_ci 141662306a36Sopenharmony_ci WREG32(CG_ULV_CONTROL, BTC_CGULVCONTROL_DFLT); 141762306a36Sopenharmony_ci WREG32(CG_ULV_PARAMETER, BTC_CGULVPARAMETER_DFLT); 141862306a36Sopenharmony_ci } 141962306a36Sopenharmony_ci } 142062306a36Sopenharmony_ci 142162306a36Sopenharmony_ci return ret; 142262306a36Sopenharmony_ci} 142362306a36Sopenharmony_ci 142462306a36Sopenharmony_cistatic int btc_populate_smc_acpi_state(struct radeon_device *rdev, 142562306a36Sopenharmony_ci RV770_SMC_STATETABLE *table) 142662306a36Sopenharmony_ci{ 142762306a36Sopenharmony_ci int ret = cypress_populate_smc_acpi_state(rdev, table); 142862306a36Sopenharmony_ci 142962306a36Sopenharmony_ci if (ret == 0) { 143062306a36Sopenharmony_ci table->ACPIState.levels[0].ACIndex = 0; 143162306a36Sopenharmony_ci table->ACPIState.levels[1].ACIndex = 0; 143262306a36Sopenharmony_ci table->ACPIState.levels[2].ACIndex = 0; 143362306a36Sopenharmony_ci } 143462306a36Sopenharmony_ci 143562306a36Sopenharmony_ci return ret; 143662306a36Sopenharmony_ci} 143762306a36Sopenharmony_ci 143862306a36Sopenharmony_civoid btc_program_mgcg_hw_sequence(struct radeon_device *rdev, 143962306a36Sopenharmony_ci const u32 *sequence, u32 count) 144062306a36Sopenharmony_ci{ 144162306a36Sopenharmony_ci u32 i, length = count * 3; 144262306a36Sopenharmony_ci u32 tmp; 144362306a36Sopenharmony_ci 144462306a36Sopenharmony_ci for (i = 0; i < length; i+=3) { 144562306a36Sopenharmony_ci tmp = RREG32(sequence[i]); 144662306a36Sopenharmony_ci tmp &= ~sequence[i+2]; 144762306a36Sopenharmony_ci tmp |= sequence[i+1] & sequence[i+2]; 144862306a36Sopenharmony_ci WREG32(sequence[i], tmp); 144962306a36Sopenharmony_ci } 145062306a36Sopenharmony_ci} 145162306a36Sopenharmony_ci 145262306a36Sopenharmony_cistatic void btc_cg_clock_gating_default(struct radeon_device *rdev) 145362306a36Sopenharmony_ci{ 145462306a36Sopenharmony_ci u32 count; 145562306a36Sopenharmony_ci const u32 *p = NULL; 145662306a36Sopenharmony_ci 145762306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 145862306a36Sopenharmony_ci p = (const u32 *)&barts_cgcg_cgls_default; 145962306a36Sopenharmony_ci count = BARTS_CGCG_CGLS_DEFAULT_LENGTH; 146062306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 146162306a36Sopenharmony_ci p = (const u32 *)&turks_cgcg_cgls_default; 146262306a36Sopenharmony_ci count = TURKS_CGCG_CGLS_DEFAULT_LENGTH; 146362306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 146462306a36Sopenharmony_ci p = (const u32 *)&caicos_cgcg_cgls_default; 146562306a36Sopenharmony_ci count = CAICOS_CGCG_CGLS_DEFAULT_LENGTH; 146662306a36Sopenharmony_ci } else 146762306a36Sopenharmony_ci return; 146862306a36Sopenharmony_ci 146962306a36Sopenharmony_ci btc_program_mgcg_hw_sequence(rdev, p, count); 147062306a36Sopenharmony_ci} 147162306a36Sopenharmony_ci 147262306a36Sopenharmony_cistatic void btc_cg_clock_gating_enable(struct radeon_device *rdev, 147362306a36Sopenharmony_ci bool enable) 147462306a36Sopenharmony_ci{ 147562306a36Sopenharmony_ci u32 count; 147662306a36Sopenharmony_ci const u32 *p = NULL; 147762306a36Sopenharmony_ci 147862306a36Sopenharmony_ci if (enable) { 147962306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 148062306a36Sopenharmony_ci p = (const u32 *)&barts_cgcg_cgls_enable; 148162306a36Sopenharmony_ci count = BARTS_CGCG_CGLS_ENABLE_LENGTH; 148262306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 148362306a36Sopenharmony_ci p = (const u32 *)&turks_cgcg_cgls_enable; 148462306a36Sopenharmony_ci count = TURKS_CGCG_CGLS_ENABLE_LENGTH; 148562306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 148662306a36Sopenharmony_ci p = (const u32 *)&caicos_cgcg_cgls_enable; 148762306a36Sopenharmony_ci count = CAICOS_CGCG_CGLS_ENABLE_LENGTH; 148862306a36Sopenharmony_ci } else 148962306a36Sopenharmony_ci return; 149062306a36Sopenharmony_ci } else { 149162306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 149262306a36Sopenharmony_ci p = (const u32 *)&barts_cgcg_cgls_disable; 149362306a36Sopenharmony_ci count = BARTS_CGCG_CGLS_DISABLE_LENGTH; 149462306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 149562306a36Sopenharmony_ci p = (const u32 *)&turks_cgcg_cgls_disable; 149662306a36Sopenharmony_ci count = TURKS_CGCG_CGLS_DISABLE_LENGTH; 149762306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 149862306a36Sopenharmony_ci p = (const u32 *)&caicos_cgcg_cgls_disable; 149962306a36Sopenharmony_ci count = CAICOS_CGCG_CGLS_DISABLE_LENGTH; 150062306a36Sopenharmony_ci } else 150162306a36Sopenharmony_ci return; 150262306a36Sopenharmony_ci } 150362306a36Sopenharmony_ci 150462306a36Sopenharmony_ci btc_program_mgcg_hw_sequence(rdev, p, count); 150562306a36Sopenharmony_ci} 150662306a36Sopenharmony_ci 150762306a36Sopenharmony_cistatic void btc_mg_clock_gating_default(struct radeon_device *rdev) 150862306a36Sopenharmony_ci{ 150962306a36Sopenharmony_ci u32 count; 151062306a36Sopenharmony_ci const u32 *p = NULL; 151162306a36Sopenharmony_ci 151262306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 151362306a36Sopenharmony_ci p = (const u32 *)&barts_mgcg_default; 151462306a36Sopenharmony_ci count = BARTS_MGCG_DEFAULT_LENGTH; 151562306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 151662306a36Sopenharmony_ci p = (const u32 *)&turks_mgcg_default; 151762306a36Sopenharmony_ci count = TURKS_MGCG_DEFAULT_LENGTH; 151862306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 151962306a36Sopenharmony_ci p = (const u32 *)&caicos_mgcg_default; 152062306a36Sopenharmony_ci count = CAICOS_MGCG_DEFAULT_LENGTH; 152162306a36Sopenharmony_ci } else 152262306a36Sopenharmony_ci return; 152362306a36Sopenharmony_ci 152462306a36Sopenharmony_ci btc_program_mgcg_hw_sequence(rdev, p, count); 152562306a36Sopenharmony_ci} 152662306a36Sopenharmony_ci 152762306a36Sopenharmony_cistatic void btc_mg_clock_gating_enable(struct radeon_device *rdev, 152862306a36Sopenharmony_ci bool enable) 152962306a36Sopenharmony_ci{ 153062306a36Sopenharmony_ci u32 count; 153162306a36Sopenharmony_ci const u32 *p = NULL; 153262306a36Sopenharmony_ci 153362306a36Sopenharmony_ci if (enable) { 153462306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 153562306a36Sopenharmony_ci p = (const u32 *)&barts_mgcg_enable; 153662306a36Sopenharmony_ci count = BARTS_MGCG_ENABLE_LENGTH; 153762306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 153862306a36Sopenharmony_ci p = (const u32 *)&turks_mgcg_enable; 153962306a36Sopenharmony_ci count = TURKS_MGCG_ENABLE_LENGTH; 154062306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 154162306a36Sopenharmony_ci p = (const u32 *)&caicos_mgcg_enable; 154262306a36Sopenharmony_ci count = CAICOS_MGCG_ENABLE_LENGTH; 154362306a36Sopenharmony_ci } else 154462306a36Sopenharmony_ci return; 154562306a36Sopenharmony_ci } else { 154662306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 154762306a36Sopenharmony_ci p = (const u32 *)&barts_mgcg_disable[0]; 154862306a36Sopenharmony_ci count = BARTS_MGCG_DISABLE_LENGTH; 154962306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 155062306a36Sopenharmony_ci p = (const u32 *)&turks_mgcg_disable[0]; 155162306a36Sopenharmony_ci count = TURKS_MGCG_DISABLE_LENGTH; 155262306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 155362306a36Sopenharmony_ci p = (const u32 *)&caicos_mgcg_disable[0]; 155462306a36Sopenharmony_ci count = CAICOS_MGCG_DISABLE_LENGTH; 155562306a36Sopenharmony_ci } else 155662306a36Sopenharmony_ci return; 155762306a36Sopenharmony_ci } 155862306a36Sopenharmony_ci 155962306a36Sopenharmony_ci btc_program_mgcg_hw_sequence(rdev, p, count); 156062306a36Sopenharmony_ci} 156162306a36Sopenharmony_ci 156262306a36Sopenharmony_cistatic void btc_ls_clock_gating_default(struct radeon_device *rdev) 156362306a36Sopenharmony_ci{ 156462306a36Sopenharmony_ci u32 count; 156562306a36Sopenharmony_ci const u32 *p = NULL; 156662306a36Sopenharmony_ci 156762306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 156862306a36Sopenharmony_ci p = (const u32 *)&barts_sysls_default; 156962306a36Sopenharmony_ci count = BARTS_SYSLS_DEFAULT_LENGTH; 157062306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 157162306a36Sopenharmony_ci p = (const u32 *)&turks_sysls_default; 157262306a36Sopenharmony_ci count = TURKS_SYSLS_DEFAULT_LENGTH; 157362306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 157462306a36Sopenharmony_ci p = (const u32 *)&caicos_sysls_default; 157562306a36Sopenharmony_ci count = CAICOS_SYSLS_DEFAULT_LENGTH; 157662306a36Sopenharmony_ci } else 157762306a36Sopenharmony_ci return; 157862306a36Sopenharmony_ci 157962306a36Sopenharmony_ci btc_program_mgcg_hw_sequence(rdev, p, count); 158062306a36Sopenharmony_ci} 158162306a36Sopenharmony_ci 158262306a36Sopenharmony_cistatic void btc_ls_clock_gating_enable(struct radeon_device *rdev, 158362306a36Sopenharmony_ci bool enable) 158462306a36Sopenharmony_ci{ 158562306a36Sopenharmony_ci u32 count; 158662306a36Sopenharmony_ci const u32 *p = NULL; 158762306a36Sopenharmony_ci 158862306a36Sopenharmony_ci if (enable) { 158962306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 159062306a36Sopenharmony_ci p = (const u32 *)&barts_sysls_enable; 159162306a36Sopenharmony_ci count = BARTS_SYSLS_ENABLE_LENGTH; 159262306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 159362306a36Sopenharmony_ci p = (const u32 *)&turks_sysls_enable; 159462306a36Sopenharmony_ci count = TURKS_SYSLS_ENABLE_LENGTH; 159562306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 159662306a36Sopenharmony_ci p = (const u32 *)&caicos_sysls_enable; 159762306a36Sopenharmony_ci count = CAICOS_SYSLS_ENABLE_LENGTH; 159862306a36Sopenharmony_ci } else 159962306a36Sopenharmony_ci return; 160062306a36Sopenharmony_ci } else { 160162306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) { 160262306a36Sopenharmony_ci p = (const u32 *)&barts_sysls_disable; 160362306a36Sopenharmony_ci count = BARTS_SYSLS_DISABLE_LENGTH; 160462306a36Sopenharmony_ci } else if (rdev->family == CHIP_TURKS) { 160562306a36Sopenharmony_ci p = (const u32 *)&turks_sysls_disable; 160662306a36Sopenharmony_ci count = TURKS_SYSLS_DISABLE_LENGTH; 160762306a36Sopenharmony_ci } else if (rdev->family == CHIP_CAICOS) { 160862306a36Sopenharmony_ci p = (const u32 *)&caicos_sysls_disable; 160962306a36Sopenharmony_ci count = CAICOS_SYSLS_DISABLE_LENGTH; 161062306a36Sopenharmony_ci } else 161162306a36Sopenharmony_ci return; 161262306a36Sopenharmony_ci } 161362306a36Sopenharmony_ci 161462306a36Sopenharmony_ci btc_program_mgcg_hw_sequence(rdev, p, count); 161562306a36Sopenharmony_ci} 161662306a36Sopenharmony_ci 161762306a36Sopenharmony_cibool btc_dpm_enabled(struct radeon_device *rdev) 161862306a36Sopenharmony_ci{ 161962306a36Sopenharmony_ci if (rv770_is_smc_running(rdev)) 162062306a36Sopenharmony_ci return true; 162162306a36Sopenharmony_ci else 162262306a36Sopenharmony_ci return false; 162362306a36Sopenharmony_ci} 162462306a36Sopenharmony_ci 162562306a36Sopenharmony_cistatic int btc_init_smc_table(struct radeon_device *rdev, 162662306a36Sopenharmony_ci struct radeon_ps *radeon_boot_state) 162762306a36Sopenharmony_ci{ 162862306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 162962306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 163062306a36Sopenharmony_ci RV770_SMC_STATETABLE *table = &pi->smc_statetable; 163162306a36Sopenharmony_ci int ret; 163262306a36Sopenharmony_ci 163362306a36Sopenharmony_ci memset(table, 0, sizeof(RV770_SMC_STATETABLE)); 163462306a36Sopenharmony_ci 163562306a36Sopenharmony_ci cypress_populate_smc_voltage_tables(rdev, table); 163662306a36Sopenharmony_ci 163762306a36Sopenharmony_ci switch (rdev->pm.int_thermal_type) { 163862306a36Sopenharmony_ci case THERMAL_TYPE_EVERGREEN: 163962306a36Sopenharmony_ci case THERMAL_TYPE_EMC2103_WITH_INTERNAL: 164062306a36Sopenharmony_ci table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; 164162306a36Sopenharmony_ci break; 164262306a36Sopenharmony_ci case THERMAL_TYPE_NONE: 164362306a36Sopenharmony_ci table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; 164462306a36Sopenharmony_ci break; 164562306a36Sopenharmony_ci default: 164662306a36Sopenharmony_ci table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; 164762306a36Sopenharmony_ci break; 164862306a36Sopenharmony_ci } 164962306a36Sopenharmony_ci 165062306a36Sopenharmony_ci if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_HARDWAREDC) 165162306a36Sopenharmony_ci table->systemFlags |= PPSMC_SYSTEMFLAG_GPIO_DC; 165262306a36Sopenharmony_ci 165362306a36Sopenharmony_ci if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_REGULATOR_HOT) 165462306a36Sopenharmony_ci table->systemFlags |= PPSMC_SYSTEMFLAG_REGULATOR_HOT; 165562306a36Sopenharmony_ci 165662306a36Sopenharmony_ci if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_STEPVDDC) 165762306a36Sopenharmony_ci table->systemFlags |= PPSMC_SYSTEMFLAG_STEPVDDC; 165862306a36Sopenharmony_ci 165962306a36Sopenharmony_ci if (pi->mem_gddr5) 166062306a36Sopenharmony_ci table->systemFlags |= PPSMC_SYSTEMFLAG_GDDR5; 166162306a36Sopenharmony_ci 166262306a36Sopenharmony_ci ret = cypress_populate_smc_initial_state(rdev, radeon_boot_state, table); 166362306a36Sopenharmony_ci if (ret) 166462306a36Sopenharmony_ci return ret; 166562306a36Sopenharmony_ci 166662306a36Sopenharmony_ci if (eg_pi->sclk_deep_sleep) 166762306a36Sopenharmony_ci WREG32_P(SCLK_PSKIP_CNTL, PSKIP_ON_ALLOW_STOP_HI(32), 166862306a36Sopenharmony_ci ~PSKIP_ON_ALLOW_STOP_HI_MASK); 166962306a36Sopenharmony_ci 167062306a36Sopenharmony_ci ret = btc_populate_smc_acpi_state(rdev, table); 167162306a36Sopenharmony_ci if (ret) 167262306a36Sopenharmony_ci return ret; 167362306a36Sopenharmony_ci 167462306a36Sopenharmony_ci if (eg_pi->ulv.supported) { 167562306a36Sopenharmony_ci ret = btc_populate_ulv_state(rdev, table); 167662306a36Sopenharmony_ci if (ret) 167762306a36Sopenharmony_ci eg_pi->ulv.supported = false; 167862306a36Sopenharmony_ci } 167962306a36Sopenharmony_ci 168062306a36Sopenharmony_ci table->driverState = table->initialState; 168162306a36Sopenharmony_ci 168262306a36Sopenharmony_ci return rv770_copy_bytes_to_smc(rdev, 168362306a36Sopenharmony_ci pi->state_table_start, 168462306a36Sopenharmony_ci (u8 *)table, 168562306a36Sopenharmony_ci sizeof(RV770_SMC_STATETABLE), 168662306a36Sopenharmony_ci pi->sram_end); 168762306a36Sopenharmony_ci} 168862306a36Sopenharmony_ci 168962306a36Sopenharmony_cistatic void btc_set_at_for_uvd(struct radeon_device *rdev, 169062306a36Sopenharmony_ci struct radeon_ps *radeon_new_state) 169162306a36Sopenharmony_ci{ 169262306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 169362306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 169462306a36Sopenharmony_ci int idx = 0; 169562306a36Sopenharmony_ci 169662306a36Sopenharmony_ci if (r600_is_uvd_state(radeon_new_state->class, radeon_new_state->class2)) 169762306a36Sopenharmony_ci idx = 1; 169862306a36Sopenharmony_ci 169962306a36Sopenharmony_ci if ((idx == 1) && !eg_pi->smu_uvd_hs) { 170062306a36Sopenharmony_ci pi->rlp = 10; 170162306a36Sopenharmony_ci pi->rmp = 100; 170262306a36Sopenharmony_ci pi->lhp = 100; 170362306a36Sopenharmony_ci pi->lmp = 10; 170462306a36Sopenharmony_ci } else { 170562306a36Sopenharmony_ci pi->rlp = eg_pi->ats[idx].rlp; 170662306a36Sopenharmony_ci pi->rmp = eg_pi->ats[idx].rmp; 170762306a36Sopenharmony_ci pi->lhp = eg_pi->ats[idx].lhp; 170862306a36Sopenharmony_ci pi->lmp = eg_pi->ats[idx].lmp; 170962306a36Sopenharmony_ci } 171062306a36Sopenharmony_ci 171162306a36Sopenharmony_ci} 171262306a36Sopenharmony_ci 171362306a36Sopenharmony_civoid btc_notify_uvd_to_smc(struct radeon_device *rdev, 171462306a36Sopenharmony_ci struct radeon_ps *radeon_new_state) 171562306a36Sopenharmony_ci{ 171662306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 171762306a36Sopenharmony_ci 171862306a36Sopenharmony_ci if (r600_is_uvd_state(radeon_new_state->class, radeon_new_state->class2)) { 171962306a36Sopenharmony_ci rv770_write_smc_soft_register(rdev, 172062306a36Sopenharmony_ci RV770_SMC_SOFT_REGISTER_uvd_enabled, 1); 172162306a36Sopenharmony_ci eg_pi->uvd_enabled = true; 172262306a36Sopenharmony_ci } else { 172362306a36Sopenharmony_ci rv770_write_smc_soft_register(rdev, 172462306a36Sopenharmony_ci RV770_SMC_SOFT_REGISTER_uvd_enabled, 0); 172562306a36Sopenharmony_ci eg_pi->uvd_enabled = false; 172662306a36Sopenharmony_ci } 172762306a36Sopenharmony_ci} 172862306a36Sopenharmony_ci 172962306a36Sopenharmony_ciint btc_reset_to_default(struct radeon_device *rdev) 173062306a36Sopenharmony_ci{ 173162306a36Sopenharmony_ci if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_ResetToDefaults) != PPSMC_Result_OK) 173262306a36Sopenharmony_ci return -EINVAL; 173362306a36Sopenharmony_ci 173462306a36Sopenharmony_ci return 0; 173562306a36Sopenharmony_ci} 173662306a36Sopenharmony_ci 173762306a36Sopenharmony_cistatic void btc_stop_smc(struct radeon_device *rdev) 173862306a36Sopenharmony_ci{ 173962306a36Sopenharmony_ci int i; 174062306a36Sopenharmony_ci 174162306a36Sopenharmony_ci for (i = 0; i < rdev->usec_timeout; i++) { 174262306a36Sopenharmony_ci if (((RREG32(LB_SYNC_RESET_SEL) & LB_SYNC_RESET_SEL_MASK) >> LB_SYNC_RESET_SEL_SHIFT) != 1) 174362306a36Sopenharmony_ci break; 174462306a36Sopenharmony_ci udelay(1); 174562306a36Sopenharmony_ci } 174662306a36Sopenharmony_ci udelay(100); 174762306a36Sopenharmony_ci 174862306a36Sopenharmony_ci r7xx_stop_smc(rdev); 174962306a36Sopenharmony_ci} 175062306a36Sopenharmony_ci 175162306a36Sopenharmony_civoid btc_read_arb_registers(struct radeon_device *rdev) 175262306a36Sopenharmony_ci{ 175362306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 175462306a36Sopenharmony_ci struct evergreen_arb_registers *arb_registers = 175562306a36Sopenharmony_ci &eg_pi->bootup_arb_registers; 175662306a36Sopenharmony_ci 175762306a36Sopenharmony_ci arb_registers->mc_arb_dram_timing = RREG32(MC_ARB_DRAM_TIMING); 175862306a36Sopenharmony_ci arb_registers->mc_arb_dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); 175962306a36Sopenharmony_ci arb_registers->mc_arb_rfsh_rate = RREG32(MC_ARB_RFSH_RATE); 176062306a36Sopenharmony_ci arb_registers->mc_arb_burst_time = RREG32(MC_ARB_BURST_TIME); 176162306a36Sopenharmony_ci} 176262306a36Sopenharmony_ci 176362306a36Sopenharmony_ci 176462306a36Sopenharmony_cistatic void btc_set_arb0_registers(struct radeon_device *rdev, 176562306a36Sopenharmony_ci struct evergreen_arb_registers *arb_registers) 176662306a36Sopenharmony_ci{ 176762306a36Sopenharmony_ci u32 val; 176862306a36Sopenharmony_ci 176962306a36Sopenharmony_ci WREG32(MC_ARB_DRAM_TIMING, arb_registers->mc_arb_dram_timing); 177062306a36Sopenharmony_ci WREG32(MC_ARB_DRAM_TIMING2, arb_registers->mc_arb_dram_timing2); 177162306a36Sopenharmony_ci 177262306a36Sopenharmony_ci val = (arb_registers->mc_arb_rfsh_rate & POWERMODE0_MASK) >> 177362306a36Sopenharmony_ci POWERMODE0_SHIFT; 177462306a36Sopenharmony_ci WREG32_P(MC_ARB_RFSH_RATE, POWERMODE0(val), ~POWERMODE0_MASK); 177562306a36Sopenharmony_ci 177662306a36Sopenharmony_ci val = (arb_registers->mc_arb_burst_time & STATE0_MASK) >> 177762306a36Sopenharmony_ci STATE0_SHIFT; 177862306a36Sopenharmony_ci WREG32_P(MC_ARB_BURST_TIME, STATE0(val), ~STATE0_MASK); 177962306a36Sopenharmony_ci} 178062306a36Sopenharmony_ci 178162306a36Sopenharmony_cistatic void btc_set_boot_state_timing(struct radeon_device *rdev) 178262306a36Sopenharmony_ci{ 178362306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 178462306a36Sopenharmony_ci 178562306a36Sopenharmony_ci if (eg_pi->ulv.supported) 178662306a36Sopenharmony_ci btc_set_arb0_registers(rdev, &eg_pi->bootup_arb_registers); 178762306a36Sopenharmony_ci} 178862306a36Sopenharmony_ci 178962306a36Sopenharmony_cistatic bool btc_is_state_ulv_compatible(struct radeon_device *rdev, 179062306a36Sopenharmony_ci struct radeon_ps *radeon_state) 179162306a36Sopenharmony_ci{ 179262306a36Sopenharmony_ci struct rv7xx_ps *state = rv770_get_ps(radeon_state); 179362306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 179462306a36Sopenharmony_ci struct rv7xx_pl *ulv_pl = eg_pi->ulv.pl; 179562306a36Sopenharmony_ci 179662306a36Sopenharmony_ci if (state->low.mclk != ulv_pl->mclk) 179762306a36Sopenharmony_ci return false; 179862306a36Sopenharmony_ci 179962306a36Sopenharmony_ci if (state->low.vddci != ulv_pl->vddci) 180062306a36Sopenharmony_ci return false; 180162306a36Sopenharmony_ci 180262306a36Sopenharmony_ci /* XXX check minclocks, etc. */ 180362306a36Sopenharmony_ci 180462306a36Sopenharmony_ci return true; 180562306a36Sopenharmony_ci} 180662306a36Sopenharmony_ci 180762306a36Sopenharmony_ci 180862306a36Sopenharmony_cistatic int btc_set_ulv_dram_timing(struct radeon_device *rdev) 180962306a36Sopenharmony_ci{ 181062306a36Sopenharmony_ci u32 val; 181162306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 181262306a36Sopenharmony_ci struct rv7xx_pl *ulv_pl = eg_pi->ulv.pl; 181362306a36Sopenharmony_ci 181462306a36Sopenharmony_ci radeon_atom_set_engine_dram_timings(rdev, 181562306a36Sopenharmony_ci ulv_pl->sclk, 181662306a36Sopenharmony_ci ulv_pl->mclk); 181762306a36Sopenharmony_ci 181862306a36Sopenharmony_ci val = rv770_calculate_memory_refresh_rate(rdev, ulv_pl->sclk); 181962306a36Sopenharmony_ci WREG32_P(MC_ARB_RFSH_RATE, POWERMODE0(val), ~POWERMODE0_MASK); 182062306a36Sopenharmony_ci 182162306a36Sopenharmony_ci val = cypress_calculate_burst_time(rdev, ulv_pl->sclk, ulv_pl->mclk); 182262306a36Sopenharmony_ci WREG32_P(MC_ARB_BURST_TIME, STATE0(val), ~STATE0_MASK); 182362306a36Sopenharmony_ci 182462306a36Sopenharmony_ci return 0; 182562306a36Sopenharmony_ci} 182662306a36Sopenharmony_ci 182762306a36Sopenharmony_cistatic int btc_enable_ulv(struct radeon_device *rdev) 182862306a36Sopenharmony_ci{ 182962306a36Sopenharmony_ci if (rv770_send_msg_to_smc(rdev, PPSMC_MSG_EnableULV) != PPSMC_Result_OK) 183062306a36Sopenharmony_ci return -EINVAL; 183162306a36Sopenharmony_ci 183262306a36Sopenharmony_ci return 0; 183362306a36Sopenharmony_ci} 183462306a36Sopenharmony_ci 183562306a36Sopenharmony_cistatic int btc_set_power_state_conditionally_enable_ulv(struct radeon_device *rdev, 183662306a36Sopenharmony_ci struct radeon_ps *radeon_new_state) 183762306a36Sopenharmony_ci{ 183862306a36Sopenharmony_ci int ret = 0; 183962306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 184062306a36Sopenharmony_ci 184162306a36Sopenharmony_ci if (eg_pi->ulv.supported) { 184262306a36Sopenharmony_ci if (btc_is_state_ulv_compatible(rdev, radeon_new_state)) { 184362306a36Sopenharmony_ci // Set ARB[0] to reflect the DRAM timing needed for ULV. 184462306a36Sopenharmony_ci ret = btc_set_ulv_dram_timing(rdev); 184562306a36Sopenharmony_ci if (ret == 0) 184662306a36Sopenharmony_ci ret = btc_enable_ulv(rdev); 184762306a36Sopenharmony_ci } 184862306a36Sopenharmony_ci } 184962306a36Sopenharmony_ci 185062306a36Sopenharmony_ci return ret; 185162306a36Sopenharmony_ci} 185262306a36Sopenharmony_ci 185362306a36Sopenharmony_cistatic bool btc_check_s0_mc_reg_index(u16 in_reg, u16 *out_reg) 185462306a36Sopenharmony_ci{ 185562306a36Sopenharmony_ci bool result = true; 185662306a36Sopenharmony_ci 185762306a36Sopenharmony_ci switch (in_reg) { 185862306a36Sopenharmony_ci case MC_SEQ_RAS_TIMING >> 2: 185962306a36Sopenharmony_ci *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; 186062306a36Sopenharmony_ci break; 186162306a36Sopenharmony_ci case MC_SEQ_CAS_TIMING >> 2: 186262306a36Sopenharmony_ci *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; 186362306a36Sopenharmony_ci break; 186462306a36Sopenharmony_ci case MC_SEQ_MISC_TIMING >> 2: 186562306a36Sopenharmony_ci *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; 186662306a36Sopenharmony_ci break; 186762306a36Sopenharmony_ci case MC_SEQ_MISC_TIMING2 >> 2: 186862306a36Sopenharmony_ci *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; 186962306a36Sopenharmony_ci break; 187062306a36Sopenharmony_ci case MC_SEQ_RD_CTL_D0 >> 2: 187162306a36Sopenharmony_ci *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; 187262306a36Sopenharmony_ci break; 187362306a36Sopenharmony_ci case MC_SEQ_RD_CTL_D1 >> 2: 187462306a36Sopenharmony_ci *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; 187562306a36Sopenharmony_ci break; 187662306a36Sopenharmony_ci case MC_SEQ_WR_CTL_D0 >> 2: 187762306a36Sopenharmony_ci *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; 187862306a36Sopenharmony_ci break; 187962306a36Sopenharmony_ci case MC_SEQ_WR_CTL_D1 >> 2: 188062306a36Sopenharmony_ci *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; 188162306a36Sopenharmony_ci break; 188262306a36Sopenharmony_ci case MC_PMG_CMD_EMRS >> 2: 188362306a36Sopenharmony_ci *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; 188462306a36Sopenharmony_ci break; 188562306a36Sopenharmony_ci case MC_PMG_CMD_MRS >> 2: 188662306a36Sopenharmony_ci *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; 188762306a36Sopenharmony_ci break; 188862306a36Sopenharmony_ci case MC_PMG_CMD_MRS1 >> 2: 188962306a36Sopenharmony_ci *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; 189062306a36Sopenharmony_ci break; 189162306a36Sopenharmony_ci default: 189262306a36Sopenharmony_ci result = false; 189362306a36Sopenharmony_ci break; 189462306a36Sopenharmony_ci } 189562306a36Sopenharmony_ci 189662306a36Sopenharmony_ci return result; 189762306a36Sopenharmony_ci} 189862306a36Sopenharmony_ci 189962306a36Sopenharmony_cistatic void btc_set_valid_flag(struct evergreen_mc_reg_table *table) 190062306a36Sopenharmony_ci{ 190162306a36Sopenharmony_ci u8 i, j; 190262306a36Sopenharmony_ci 190362306a36Sopenharmony_ci for (i = 0; i < table->last; i++) { 190462306a36Sopenharmony_ci for (j = 1; j < table->num_entries; j++) { 190562306a36Sopenharmony_ci if (table->mc_reg_table_entry[j-1].mc_data[i] != 190662306a36Sopenharmony_ci table->mc_reg_table_entry[j].mc_data[i]) { 190762306a36Sopenharmony_ci table->valid_flag |= (1 << i); 190862306a36Sopenharmony_ci break; 190962306a36Sopenharmony_ci } 191062306a36Sopenharmony_ci } 191162306a36Sopenharmony_ci } 191262306a36Sopenharmony_ci} 191362306a36Sopenharmony_ci 191462306a36Sopenharmony_cistatic int btc_set_mc_special_registers(struct radeon_device *rdev, 191562306a36Sopenharmony_ci struct evergreen_mc_reg_table *table) 191662306a36Sopenharmony_ci{ 191762306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 191862306a36Sopenharmony_ci u8 i, j, k; 191962306a36Sopenharmony_ci u32 tmp; 192062306a36Sopenharmony_ci 192162306a36Sopenharmony_ci for (i = 0, j = table->last; i < table->last; i++) { 192262306a36Sopenharmony_ci switch (table->mc_reg_address[i].s1) { 192362306a36Sopenharmony_ci case MC_SEQ_MISC1 >> 2: 192462306a36Sopenharmony_ci tmp = RREG32(MC_PMG_CMD_EMRS); 192562306a36Sopenharmony_ci table->mc_reg_address[j].s1 = MC_PMG_CMD_EMRS >> 2; 192662306a36Sopenharmony_ci table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_EMRS_LP >> 2; 192762306a36Sopenharmony_ci for (k = 0; k < table->num_entries; k++) { 192862306a36Sopenharmony_ci table->mc_reg_table_entry[k].mc_data[j] = 192962306a36Sopenharmony_ci ((tmp & 0xffff0000)) | 193062306a36Sopenharmony_ci ((table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16); 193162306a36Sopenharmony_ci } 193262306a36Sopenharmony_ci j++; 193362306a36Sopenharmony_ci 193462306a36Sopenharmony_ci if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) 193562306a36Sopenharmony_ci return -EINVAL; 193662306a36Sopenharmony_ci 193762306a36Sopenharmony_ci tmp = RREG32(MC_PMG_CMD_MRS); 193862306a36Sopenharmony_ci table->mc_reg_address[j].s1 = MC_PMG_CMD_MRS >> 2; 193962306a36Sopenharmony_ci table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_MRS_LP >> 2; 194062306a36Sopenharmony_ci for (k = 0; k < table->num_entries; k++) { 194162306a36Sopenharmony_ci table->mc_reg_table_entry[k].mc_data[j] = 194262306a36Sopenharmony_ci (tmp & 0xffff0000) | 194362306a36Sopenharmony_ci (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); 194462306a36Sopenharmony_ci if (!pi->mem_gddr5) 194562306a36Sopenharmony_ci table->mc_reg_table_entry[k].mc_data[j] |= 0x100; 194662306a36Sopenharmony_ci } 194762306a36Sopenharmony_ci j++; 194862306a36Sopenharmony_ci 194962306a36Sopenharmony_ci if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) 195062306a36Sopenharmony_ci return -EINVAL; 195162306a36Sopenharmony_ci break; 195262306a36Sopenharmony_ci case MC_SEQ_RESERVE_M >> 2: 195362306a36Sopenharmony_ci tmp = RREG32(MC_PMG_CMD_MRS1); 195462306a36Sopenharmony_ci table->mc_reg_address[j].s1 = MC_PMG_CMD_MRS1 >> 2; 195562306a36Sopenharmony_ci table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_MRS1_LP >> 2; 195662306a36Sopenharmony_ci for (k = 0; k < table->num_entries; k++) { 195762306a36Sopenharmony_ci table->mc_reg_table_entry[k].mc_data[j] = 195862306a36Sopenharmony_ci (tmp & 0xffff0000) | 195962306a36Sopenharmony_ci (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); 196062306a36Sopenharmony_ci } 196162306a36Sopenharmony_ci j++; 196262306a36Sopenharmony_ci 196362306a36Sopenharmony_ci if (j >= SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) 196462306a36Sopenharmony_ci return -EINVAL; 196562306a36Sopenharmony_ci break; 196662306a36Sopenharmony_ci default: 196762306a36Sopenharmony_ci break; 196862306a36Sopenharmony_ci } 196962306a36Sopenharmony_ci } 197062306a36Sopenharmony_ci 197162306a36Sopenharmony_ci table->last = j; 197262306a36Sopenharmony_ci 197362306a36Sopenharmony_ci return 0; 197462306a36Sopenharmony_ci} 197562306a36Sopenharmony_ci 197662306a36Sopenharmony_cistatic void btc_set_s0_mc_reg_index(struct evergreen_mc_reg_table *table) 197762306a36Sopenharmony_ci{ 197862306a36Sopenharmony_ci u32 i; 197962306a36Sopenharmony_ci u16 address; 198062306a36Sopenharmony_ci 198162306a36Sopenharmony_ci for (i = 0; i < table->last; i++) { 198262306a36Sopenharmony_ci table->mc_reg_address[i].s0 = 198362306a36Sopenharmony_ci btc_check_s0_mc_reg_index(table->mc_reg_address[i].s1, &address) ? 198462306a36Sopenharmony_ci address : table->mc_reg_address[i].s1; 198562306a36Sopenharmony_ci } 198662306a36Sopenharmony_ci} 198762306a36Sopenharmony_ci 198862306a36Sopenharmony_cistatic int btc_copy_vbios_mc_reg_table(struct atom_mc_reg_table *table, 198962306a36Sopenharmony_ci struct evergreen_mc_reg_table *eg_table) 199062306a36Sopenharmony_ci{ 199162306a36Sopenharmony_ci u8 i, j; 199262306a36Sopenharmony_ci 199362306a36Sopenharmony_ci if (table->last > SMC_EVERGREEN_MC_REGISTER_ARRAY_SIZE) 199462306a36Sopenharmony_ci return -EINVAL; 199562306a36Sopenharmony_ci 199662306a36Sopenharmony_ci if (table->num_entries > MAX_AC_TIMING_ENTRIES) 199762306a36Sopenharmony_ci return -EINVAL; 199862306a36Sopenharmony_ci 199962306a36Sopenharmony_ci for (i = 0; i < table->last; i++) 200062306a36Sopenharmony_ci eg_table->mc_reg_address[i].s1 = table->mc_reg_address[i].s1; 200162306a36Sopenharmony_ci eg_table->last = table->last; 200262306a36Sopenharmony_ci 200362306a36Sopenharmony_ci for (i = 0; i < table->num_entries; i++) { 200462306a36Sopenharmony_ci eg_table->mc_reg_table_entry[i].mclk_max = 200562306a36Sopenharmony_ci table->mc_reg_table_entry[i].mclk_max; 200662306a36Sopenharmony_ci for(j = 0; j < table->last; j++) 200762306a36Sopenharmony_ci eg_table->mc_reg_table_entry[i].mc_data[j] = 200862306a36Sopenharmony_ci table->mc_reg_table_entry[i].mc_data[j]; 200962306a36Sopenharmony_ci } 201062306a36Sopenharmony_ci eg_table->num_entries = table->num_entries; 201162306a36Sopenharmony_ci 201262306a36Sopenharmony_ci return 0; 201362306a36Sopenharmony_ci} 201462306a36Sopenharmony_ci 201562306a36Sopenharmony_cistatic int btc_initialize_mc_reg_table(struct radeon_device *rdev) 201662306a36Sopenharmony_ci{ 201762306a36Sopenharmony_ci int ret; 201862306a36Sopenharmony_ci struct atom_mc_reg_table *table; 201962306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 202062306a36Sopenharmony_ci struct evergreen_mc_reg_table *eg_table = &eg_pi->mc_reg_table; 202162306a36Sopenharmony_ci u8 module_index = rv770_get_memory_module_index(rdev); 202262306a36Sopenharmony_ci 202362306a36Sopenharmony_ci table = kzalloc(sizeof(struct atom_mc_reg_table), GFP_KERNEL); 202462306a36Sopenharmony_ci if (!table) 202562306a36Sopenharmony_ci return -ENOMEM; 202662306a36Sopenharmony_ci 202762306a36Sopenharmony_ci /* Program additional LP registers that are no longer programmed by VBIOS */ 202862306a36Sopenharmony_ci WREG32(MC_SEQ_RAS_TIMING_LP, RREG32(MC_SEQ_RAS_TIMING)); 202962306a36Sopenharmony_ci WREG32(MC_SEQ_CAS_TIMING_LP, RREG32(MC_SEQ_CAS_TIMING)); 203062306a36Sopenharmony_ci WREG32(MC_SEQ_MISC_TIMING_LP, RREG32(MC_SEQ_MISC_TIMING)); 203162306a36Sopenharmony_ci WREG32(MC_SEQ_MISC_TIMING2_LP, RREG32(MC_SEQ_MISC_TIMING2)); 203262306a36Sopenharmony_ci WREG32(MC_SEQ_RD_CTL_D0_LP, RREG32(MC_SEQ_RD_CTL_D0)); 203362306a36Sopenharmony_ci WREG32(MC_SEQ_RD_CTL_D1_LP, RREG32(MC_SEQ_RD_CTL_D1)); 203462306a36Sopenharmony_ci WREG32(MC_SEQ_WR_CTL_D0_LP, RREG32(MC_SEQ_WR_CTL_D0)); 203562306a36Sopenharmony_ci WREG32(MC_SEQ_WR_CTL_D1_LP, RREG32(MC_SEQ_WR_CTL_D1)); 203662306a36Sopenharmony_ci WREG32(MC_SEQ_PMG_CMD_EMRS_LP, RREG32(MC_PMG_CMD_EMRS)); 203762306a36Sopenharmony_ci WREG32(MC_SEQ_PMG_CMD_MRS_LP, RREG32(MC_PMG_CMD_MRS)); 203862306a36Sopenharmony_ci WREG32(MC_SEQ_PMG_CMD_MRS1_LP, RREG32(MC_PMG_CMD_MRS1)); 203962306a36Sopenharmony_ci 204062306a36Sopenharmony_ci ret = radeon_atom_init_mc_reg_table(rdev, module_index, table); 204162306a36Sopenharmony_ci 204262306a36Sopenharmony_ci if (ret) 204362306a36Sopenharmony_ci goto init_mc_done; 204462306a36Sopenharmony_ci 204562306a36Sopenharmony_ci ret = btc_copy_vbios_mc_reg_table(table, eg_table); 204662306a36Sopenharmony_ci 204762306a36Sopenharmony_ci if (ret) 204862306a36Sopenharmony_ci goto init_mc_done; 204962306a36Sopenharmony_ci 205062306a36Sopenharmony_ci btc_set_s0_mc_reg_index(eg_table); 205162306a36Sopenharmony_ci ret = btc_set_mc_special_registers(rdev, eg_table); 205262306a36Sopenharmony_ci 205362306a36Sopenharmony_ci if (ret) 205462306a36Sopenharmony_ci goto init_mc_done; 205562306a36Sopenharmony_ci 205662306a36Sopenharmony_ci btc_set_valid_flag(eg_table); 205762306a36Sopenharmony_ci 205862306a36Sopenharmony_ciinit_mc_done: 205962306a36Sopenharmony_ci kfree(table); 206062306a36Sopenharmony_ci 206162306a36Sopenharmony_ci return ret; 206262306a36Sopenharmony_ci} 206362306a36Sopenharmony_ci 206462306a36Sopenharmony_cistatic void btc_init_stutter_mode(struct radeon_device *rdev) 206562306a36Sopenharmony_ci{ 206662306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 206762306a36Sopenharmony_ci u32 tmp; 206862306a36Sopenharmony_ci 206962306a36Sopenharmony_ci if (pi->mclk_stutter_mode_threshold) { 207062306a36Sopenharmony_ci if (pi->mem_gddr5) { 207162306a36Sopenharmony_ci tmp = RREG32(MC_PMG_AUTO_CFG); 207262306a36Sopenharmony_ci if ((0x200 & tmp) == 0) { 207362306a36Sopenharmony_ci tmp = (tmp & 0xfffffc0b) | 0x204; 207462306a36Sopenharmony_ci WREG32(MC_PMG_AUTO_CFG, tmp); 207562306a36Sopenharmony_ci } 207662306a36Sopenharmony_ci } 207762306a36Sopenharmony_ci } 207862306a36Sopenharmony_ci} 207962306a36Sopenharmony_ci 208062306a36Sopenharmony_cibool btc_dpm_vblank_too_short(struct radeon_device *rdev) 208162306a36Sopenharmony_ci{ 208262306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 208362306a36Sopenharmony_ci u32 vblank_time = r600_dpm_get_vblank_time(rdev); 208462306a36Sopenharmony_ci u32 switch_limit = pi->mem_gddr5 ? 450 : 100; 208562306a36Sopenharmony_ci 208662306a36Sopenharmony_ci if (vblank_time < switch_limit) 208762306a36Sopenharmony_ci return true; 208862306a36Sopenharmony_ci else 208962306a36Sopenharmony_ci return false; 209062306a36Sopenharmony_ci 209162306a36Sopenharmony_ci} 209262306a36Sopenharmony_ci 209362306a36Sopenharmony_cistatic void btc_apply_state_adjust_rules(struct radeon_device *rdev, 209462306a36Sopenharmony_ci struct radeon_ps *rps) 209562306a36Sopenharmony_ci{ 209662306a36Sopenharmony_ci struct rv7xx_ps *ps = rv770_get_ps(rps); 209762306a36Sopenharmony_ci struct radeon_clock_and_voltage_limits *max_limits; 209862306a36Sopenharmony_ci bool disable_mclk_switching; 209962306a36Sopenharmony_ci u32 mclk, sclk; 210062306a36Sopenharmony_ci u16 vddc, vddci; 210162306a36Sopenharmony_ci 210262306a36Sopenharmony_ci if ((rdev->pm.dpm.new_active_crtc_count > 1) || 210362306a36Sopenharmony_ci btc_dpm_vblank_too_short(rdev)) 210462306a36Sopenharmony_ci disable_mclk_switching = true; 210562306a36Sopenharmony_ci else 210662306a36Sopenharmony_ci disable_mclk_switching = false; 210762306a36Sopenharmony_ci 210862306a36Sopenharmony_ci if (rdev->pm.dpm.ac_power) 210962306a36Sopenharmony_ci max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; 211062306a36Sopenharmony_ci else 211162306a36Sopenharmony_ci max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc; 211262306a36Sopenharmony_ci 211362306a36Sopenharmony_ci if (rdev->pm.dpm.ac_power == false) { 211462306a36Sopenharmony_ci if (ps->high.mclk > max_limits->mclk) 211562306a36Sopenharmony_ci ps->high.mclk = max_limits->mclk; 211662306a36Sopenharmony_ci if (ps->high.sclk > max_limits->sclk) 211762306a36Sopenharmony_ci ps->high.sclk = max_limits->sclk; 211862306a36Sopenharmony_ci if (ps->high.vddc > max_limits->vddc) 211962306a36Sopenharmony_ci ps->high.vddc = max_limits->vddc; 212062306a36Sopenharmony_ci if (ps->high.vddci > max_limits->vddci) 212162306a36Sopenharmony_ci ps->high.vddci = max_limits->vddci; 212262306a36Sopenharmony_ci 212362306a36Sopenharmony_ci if (ps->medium.mclk > max_limits->mclk) 212462306a36Sopenharmony_ci ps->medium.mclk = max_limits->mclk; 212562306a36Sopenharmony_ci if (ps->medium.sclk > max_limits->sclk) 212662306a36Sopenharmony_ci ps->medium.sclk = max_limits->sclk; 212762306a36Sopenharmony_ci if (ps->medium.vddc > max_limits->vddc) 212862306a36Sopenharmony_ci ps->medium.vddc = max_limits->vddc; 212962306a36Sopenharmony_ci if (ps->medium.vddci > max_limits->vddci) 213062306a36Sopenharmony_ci ps->medium.vddci = max_limits->vddci; 213162306a36Sopenharmony_ci 213262306a36Sopenharmony_ci if (ps->low.mclk > max_limits->mclk) 213362306a36Sopenharmony_ci ps->low.mclk = max_limits->mclk; 213462306a36Sopenharmony_ci if (ps->low.sclk > max_limits->sclk) 213562306a36Sopenharmony_ci ps->low.sclk = max_limits->sclk; 213662306a36Sopenharmony_ci if (ps->low.vddc > max_limits->vddc) 213762306a36Sopenharmony_ci ps->low.vddc = max_limits->vddc; 213862306a36Sopenharmony_ci if (ps->low.vddci > max_limits->vddci) 213962306a36Sopenharmony_ci ps->low.vddci = max_limits->vddci; 214062306a36Sopenharmony_ci } 214162306a36Sopenharmony_ci 214262306a36Sopenharmony_ci /* XXX validate the min clocks required for display */ 214362306a36Sopenharmony_ci 214462306a36Sopenharmony_ci if (disable_mclk_switching) { 214562306a36Sopenharmony_ci sclk = ps->low.sclk; 214662306a36Sopenharmony_ci mclk = ps->high.mclk; 214762306a36Sopenharmony_ci vddc = ps->low.vddc; 214862306a36Sopenharmony_ci vddci = ps->high.vddci; 214962306a36Sopenharmony_ci } else { 215062306a36Sopenharmony_ci sclk = ps->low.sclk; 215162306a36Sopenharmony_ci mclk = ps->low.mclk; 215262306a36Sopenharmony_ci vddc = ps->low.vddc; 215362306a36Sopenharmony_ci vddci = ps->low.vddci; 215462306a36Sopenharmony_ci } 215562306a36Sopenharmony_ci 215662306a36Sopenharmony_ci /* adjusted low state */ 215762306a36Sopenharmony_ci ps->low.sclk = sclk; 215862306a36Sopenharmony_ci ps->low.mclk = mclk; 215962306a36Sopenharmony_ci ps->low.vddc = vddc; 216062306a36Sopenharmony_ci ps->low.vddci = vddci; 216162306a36Sopenharmony_ci 216262306a36Sopenharmony_ci btc_skip_blacklist_clocks(rdev, max_limits->sclk, max_limits->mclk, 216362306a36Sopenharmony_ci &ps->low.sclk, &ps->low.mclk); 216462306a36Sopenharmony_ci 216562306a36Sopenharmony_ci /* adjusted medium, high states */ 216662306a36Sopenharmony_ci if (ps->medium.sclk < ps->low.sclk) 216762306a36Sopenharmony_ci ps->medium.sclk = ps->low.sclk; 216862306a36Sopenharmony_ci if (ps->medium.vddc < ps->low.vddc) 216962306a36Sopenharmony_ci ps->medium.vddc = ps->low.vddc; 217062306a36Sopenharmony_ci if (ps->high.sclk < ps->medium.sclk) 217162306a36Sopenharmony_ci ps->high.sclk = ps->medium.sclk; 217262306a36Sopenharmony_ci if (ps->high.vddc < ps->medium.vddc) 217362306a36Sopenharmony_ci ps->high.vddc = ps->medium.vddc; 217462306a36Sopenharmony_ci 217562306a36Sopenharmony_ci if (disable_mclk_switching) { 217662306a36Sopenharmony_ci mclk = ps->low.mclk; 217762306a36Sopenharmony_ci if (mclk < ps->medium.mclk) 217862306a36Sopenharmony_ci mclk = ps->medium.mclk; 217962306a36Sopenharmony_ci if (mclk < ps->high.mclk) 218062306a36Sopenharmony_ci mclk = ps->high.mclk; 218162306a36Sopenharmony_ci ps->low.mclk = mclk; 218262306a36Sopenharmony_ci ps->low.vddci = vddci; 218362306a36Sopenharmony_ci ps->medium.mclk = mclk; 218462306a36Sopenharmony_ci ps->medium.vddci = vddci; 218562306a36Sopenharmony_ci ps->high.mclk = mclk; 218662306a36Sopenharmony_ci ps->high.vddci = vddci; 218762306a36Sopenharmony_ci } else { 218862306a36Sopenharmony_ci if (ps->medium.mclk < ps->low.mclk) 218962306a36Sopenharmony_ci ps->medium.mclk = ps->low.mclk; 219062306a36Sopenharmony_ci if (ps->medium.vddci < ps->low.vddci) 219162306a36Sopenharmony_ci ps->medium.vddci = ps->low.vddci; 219262306a36Sopenharmony_ci if (ps->high.mclk < ps->medium.mclk) 219362306a36Sopenharmony_ci ps->high.mclk = ps->medium.mclk; 219462306a36Sopenharmony_ci if (ps->high.vddci < ps->medium.vddci) 219562306a36Sopenharmony_ci ps->high.vddci = ps->medium.vddci; 219662306a36Sopenharmony_ci } 219762306a36Sopenharmony_ci 219862306a36Sopenharmony_ci btc_skip_blacklist_clocks(rdev, max_limits->sclk, max_limits->mclk, 219962306a36Sopenharmony_ci &ps->medium.sclk, &ps->medium.mclk); 220062306a36Sopenharmony_ci btc_skip_blacklist_clocks(rdev, max_limits->sclk, max_limits->mclk, 220162306a36Sopenharmony_ci &ps->high.sclk, &ps->high.mclk); 220262306a36Sopenharmony_ci 220362306a36Sopenharmony_ci btc_adjust_clock_combinations(rdev, max_limits, &ps->low); 220462306a36Sopenharmony_ci btc_adjust_clock_combinations(rdev, max_limits, &ps->medium); 220562306a36Sopenharmony_ci btc_adjust_clock_combinations(rdev, max_limits, &ps->high); 220662306a36Sopenharmony_ci 220762306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk, 220862306a36Sopenharmony_ci ps->low.sclk, max_limits->vddc, &ps->low.vddc); 220962306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk, 221062306a36Sopenharmony_ci ps->low.mclk, max_limits->vddci, &ps->low.vddci); 221162306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk, 221262306a36Sopenharmony_ci ps->low.mclk, max_limits->vddc, &ps->low.vddc); 221362306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk, 221462306a36Sopenharmony_ci rdev->clock.current_dispclk, max_limits->vddc, &ps->low.vddc); 221562306a36Sopenharmony_ci 221662306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk, 221762306a36Sopenharmony_ci ps->medium.sclk, max_limits->vddc, &ps->medium.vddc); 221862306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk, 221962306a36Sopenharmony_ci ps->medium.mclk, max_limits->vddci, &ps->medium.vddci); 222062306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk, 222162306a36Sopenharmony_ci ps->medium.mclk, max_limits->vddc, &ps->medium.vddc); 222262306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk, 222362306a36Sopenharmony_ci rdev->clock.current_dispclk, max_limits->vddc, &ps->medium.vddc); 222462306a36Sopenharmony_ci 222562306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk, 222662306a36Sopenharmony_ci ps->high.sclk, max_limits->vddc, &ps->high.vddc); 222762306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk, 222862306a36Sopenharmony_ci ps->high.mclk, max_limits->vddci, &ps->high.vddci); 222962306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk, 223062306a36Sopenharmony_ci ps->high.mclk, max_limits->vddc, &ps->high.vddc); 223162306a36Sopenharmony_ci btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk, 223262306a36Sopenharmony_ci rdev->clock.current_dispclk, max_limits->vddc, &ps->high.vddc); 223362306a36Sopenharmony_ci 223462306a36Sopenharmony_ci btc_apply_voltage_delta_rules(rdev, max_limits->vddc, max_limits->vddci, 223562306a36Sopenharmony_ci &ps->low.vddc, &ps->low.vddci); 223662306a36Sopenharmony_ci btc_apply_voltage_delta_rules(rdev, max_limits->vddc, max_limits->vddci, 223762306a36Sopenharmony_ci &ps->medium.vddc, &ps->medium.vddci); 223862306a36Sopenharmony_ci btc_apply_voltage_delta_rules(rdev, max_limits->vddc, max_limits->vddci, 223962306a36Sopenharmony_ci &ps->high.vddc, &ps->high.vddci); 224062306a36Sopenharmony_ci 224162306a36Sopenharmony_ci if ((ps->high.vddc <= rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.vddc) && 224262306a36Sopenharmony_ci (ps->medium.vddc <= rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.vddc) && 224362306a36Sopenharmony_ci (ps->low.vddc <= rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.vddc)) 224462306a36Sopenharmony_ci ps->dc_compatible = true; 224562306a36Sopenharmony_ci else 224662306a36Sopenharmony_ci ps->dc_compatible = false; 224762306a36Sopenharmony_ci 224862306a36Sopenharmony_ci if (ps->low.vddc < rdev->pm.dpm.dyn_state.min_vddc_for_pcie_gen2) 224962306a36Sopenharmony_ci ps->low.flags &= ~ATOM_PPLIB_R600_FLAGS_PCIEGEN2; 225062306a36Sopenharmony_ci if (ps->medium.vddc < rdev->pm.dpm.dyn_state.min_vddc_for_pcie_gen2) 225162306a36Sopenharmony_ci ps->medium.flags &= ~ATOM_PPLIB_R600_FLAGS_PCIEGEN2; 225262306a36Sopenharmony_ci if (ps->high.vddc < rdev->pm.dpm.dyn_state.min_vddc_for_pcie_gen2) 225362306a36Sopenharmony_ci ps->high.flags &= ~ATOM_PPLIB_R600_FLAGS_PCIEGEN2; 225462306a36Sopenharmony_ci} 225562306a36Sopenharmony_ci 225662306a36Sopenharmony_cistatic void btc_update_current_ps(struct radeon_device *rdev, 225762306a36Sopenharmony_ci struct radeon_ps *rps) 225862306a36Sopenharmony_ci{ 225962306a36Sopenharmony_ci struct rv7xx_ps *new_ps = rv770_get_ps(rps); 226062306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 226162306a36Sopenharmony_ci 226262306a36Sopenharmony_ci eg_pi->current_rps = *rps; 226362306a36Sopenharmony_ci eg_pi->current_ps = *new_ps; 226462306a36Sopenharmony_ci eg_pi->current_rps.ps_priv = &eg_pi->current_ps; 226562306a36Sopenharmony_ci} 226662306a36Sopenharmony_ci 226762306a36Sopenharmony_cistatic void btc_update_requested_ps(struct radeon_device *rdev, 226862306a36Sopenharmony_ci struct radeon_ps *rps) 226962306a36Sopenharmony_ci{ 227062306a36Sopenharmony_ci struct rv7xx_ps *new_ps = rv770_get_ps(rps); 227162306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 227262306a36Sopenharmony_ci 227362306a36Sopenharmony_ci eg_pi->requested_rps = *rps; 227462306a36Sopenharmony_ci eg_pi->requested_ps = *new_ps; 227562306a36Sopenharmony_ci eg_pi->requested_rps.ps_priv = &eg_pi->requested_ps; 227662306a36Sopenharmony_ci} 227762306a36Sopenharmony_ci 227862306a36Sopenharmony_ci#if 0 227962306a36Sopenharmony_civoid btc_dpm_reset_asic(struct radeon_device *rdev) 228062306a36Sopenharmony_ci{ 228162306a36Sopenharmony_ci rv770_restrict_performance_levels_before_switch(rdev); 228262306a36Sopenharmony_ci btc_disable_ulv(rdev); 228362306a36Sopenharmony_ci btc_set_boot_state_timing(rdev); 228462306a36Sopenharmony_ci rv770_set_boot_state(rdev); 228562306a36Sopenharmony_ci} 228662306a36Sopenharmony_ci#endif 228762306a36Sopenharmony_ci 228862306a36Sopenharmony_ciint btc_dpm_pre_set_power_state(struct radeon_device *rdev) 228962306a36Sopenharmony_ci{ 229062306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 229162306a36Sopenharmony_ci struct radeon_ps requested_ps = *rdev->pm.dpm.requested_ps; 229262306a36Sopenharmony_ci struct radeon_ps *new_ps = &requested_ps; 229362306a36Sopenharmony_ci 229462306a36Sopenharmony_ci btc_update_requested_ps(rdev, new_ps); 229562306a36Sopenharmony_ci 229662306a36Sopenharmony_ci btc_apply_state_adjust_rules(rdev, &eg_pi->requested_rps); 229762306a36Sopenharmony_ci 229862306a36Sopenharmony_ci return 0; 229962306a36Sopenharmony_ci} 230062306a36Sopenharmony_ci 230162306a36Sopenharmony_ciint btc_dpm_set_power_state(struct radeon_device *rdev) 230262306a36Sopenharmony_ci{ 230362306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 230462306a36Sopenharmony_ci struct radeon_ps *new_ps = &eg_pi->requested_rps; 230562306a36Sopenharmony_ci struct radeon_ps *old_ps = &eg_pi->current_rps; 230662306a36Sopenharmony_ci int ret; 230762306a36Sopenharmony_ci 230862306a36Sopenharmony_ci ret = btc_disable_ulv(rdev); 230962306a36Sopenharmony_ci btc_set_boot_state_timing(rdev); 231062306a36Sopenharmony_ci ret = rv770_restrict_performance_levels_before_switch(rdev); 231162306a36Sopenharmony_ci if (ret) { 231262306a36Sopenharmony_ci DRM_ERROR("rv770_restrict_performance_levels_before_switch failed\n"); 231362306a36Sopenharmony_ci return ret; 231462306a36Sopenharmony_ci } 231562306a36Sopenharmony_ci if (eg_pi->pcie_performance_request) 231662306a36Sopenharmony_ci cypress_notify_link_speed_change_before_state_change(rdev, new_ps, old_ps); 231762306a36Sopenharmony_ci 231862306a36Sopenharmony_ci rv770_set_uvd_clock_before_set_eng_clock(rdev, new_ps, old_ps); 231962306a36Sopenharmony_ci ret = rv770_halt_smc(rdev); 232062306a36Sopenharmony_ci if (ret) { 232162306a36Sopenharmony_ci DRM_ERROR("rv770_halt_smc failed\n"); 232262306a36Sopenharmony_ci return ret; 232362306a36Sopenharmony_ci } 232462306a36Sopenharmony_ci btc_set_at_for_uvd(rdev, new_ps); 232562306a36Sopenharmony_ci if (eg_pi->smu_uvd_hs) 232662306a36Sopenharmony_ci btc_notify_uvd_to_smc(rdev, new_ps); 232762306a36Sopenharmony_ci ret = cypress_upload_sw_state(rdev, new_ps); 232862306a36Sopenharmony_ci if (ret) { 232962306a36Sopenharmony_ci DRM_ERROR("cypress_upload_sw_state failed\n"); 233062306a36Sopenharmony_ci return ret; 233162306a36Sopenharmony_ci } 233262306a36Sopenharmony_ci if (eg_pi->dynamic_ac_timing) { 233362306a36Sopenharmony_ci ret = cypress_upload_mc_reg_table(rdev, new_ps); 233462306a36Sopenharmony_ci if (ret) { 233562306a36Sopenharmony_ci DRM_ERROR("cypress_upload_mc_reg_table failed\n"); 233662306a36Sopenharmony_ci return ret; 233762306a36Sopenharmony_ci } 233862306a36Sopenharmony_ci } 233962306a36Sopenharmony_ci 234062306a36Sopenharmony_ci cypress_program_memory_timing_parameters(rdev, new_ps); 234162306a36Sopenharmony_ci 234262306a36Sopenharmony_ci ret = rv770_resume_smc(rdev); 234362306a36Sopenharmony_ci if (ret) { 234462306a36Sopenharmony_ci DRM_ERROR("rv770_resume_smc failed\n"); 234562306a36Sopenharmony_ci return ret; 234662306a36Sopenharmony_ci } 234762306a36Sopenharmony_ci ret = rv770_set_sw_state(rdev); 234862306a36Sopenharmony_ci if (ret) { 234962306a36Sopenharmony_ci DRM_ERROR("rv770_set_sw_state failed\n"); 235062306a36Sopenharmony_ci return ret; 235162306a36Sopenharmony_ci } 235262306a36Sopenharmony_ci rv770_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); 235362306a36Sopenharmony_ci 235462306a36Sopenharmony_ci if (eg_pi->pcie_performance_request) 235562306a36Sopenharmony_ci cypress_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); 235662306a36Sopenharmony_ci 235762306a36Sopenharmony_ci ret = btc_set_power_state_conditionally_enable_ulv(rdev, new_ps); 235862306a36Sopenharmony_ci if (ret) { 235962306a36Sopenharmony_ci DRM_ERROR("btc_set_power_state_conditionally_enable_ulv failed\n"); 236062306a36Sopenharmony_ci return ret; 236162306a36Sopenharmony_ci } 236262306a36Sopenharmony_ci 236362306a36Sopenharmony_ci return 0; 236462306a36Sopenharmony_ci} 236562306a36Sopenharmony_ci 236662306a36Sopenharmony_civoid btc_dpm_post_set_power_state(struct radeon_device *rdev) 236762306a36Sopenharmony_ci{ 236862306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 236962306a36Sopenharmony_ci struct radeon_ps *new_ps = &eg_pi->requested_rps; 237062306a36Sopenharmony_ci 237162306a36Sopenharmony_ci btc_update_current_ps(rdev, new_ps); 237262306a36Sopenharmony_ci} 237362306a36Sopenharmony_ci 237462306a36Sopenharmony_ciint btc_dpm_enable(struct radeon_device *rdev) 237562306a36Sopenharmony_ci{ 237662306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 237762306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 237862306a36Sopenharmony_ci struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps; 237962306a36Sopenharmony_ci int ret; 238062306a36Sopenharmony_ci 238162306a36Sopenharmony_ci if (pi->gfx_clock_gating) 238262306a36Sopenharmony_ci btc_cg_clock_gating_default(rdev); 238362306a36Sopenharmony_ci 238462306a36Sopenharmony_ci if (btc_dpm_enabled(rdev)) 238562306a36Sopenharmony_ci return -EINVAL; 238662306a36Sopenharmony_ci 238762306a36Sopenharmony_ci if (pi->mg_clock_gating) 238862306a36Sopenharmony_ci btc_mg_clock_gating_default(rdev); 238962306a36Sopenharmony_ci 239062306a36Sopenharmony_ci if (eg_pi->ls_clock_gating) 239162306a36Sopenharmony_ci btc_ls_clock_gating_default(rdev); 239262306a36Sopenharmony_ci 239362306a36Sopenharmony_ci if (pi->voltage_control) { 239462306a36Sopenharmony_ci rv770_enable_voltage_control(rdev, true); 239562306a36Sopenharmony_ci ret = cypress_construct_voltage_tables(rdev); 239662306a36Sopenharmony_ci if (ret) { 239762306a36Sopenharmony_ci DRM_ERROR("cypress_construct_voltage_tables failed\n"); 239862306a36Sopenharmony_ci return ret; 239962306a36Sopenharmony_ci } 240062306a36Sopenharmony_ci } 240162306a36Sopenharmony_ci 240262306a36Sopenharmony_ci if (pi->mvdd_control) { 240362306a36Sopenharmony_ci ret = cypress_get_mvdd_configuration(rdev); 240462306a36Sopenharmony_ci if (ret) { 240562306a36Sopenharmony_ci DRM_ERROR("cypress_get_mvdd_configuration failed\n"); 240662306a36Sopenharmony_ci return ret; 240762306a36Sopenharmony_ci } 240862306a36Sopenharmony_ci } 240962306a36Sopenharmony_ci 241062306a36Sopenharmony_ci if (eg_pi->dynamic_ac_timing) { 241162306a36Sopenharmony_ci ret = btc_initialize_mc_reg_table(rdev); 241262306a36Sopenharmony_ci if (ret) 241362306a36Sopenharmony_ci eg_pi->dynamic_ac_timing = false; 241462306a36Sopenharmony_ci } 241562306a36Sopenharmony_ci 241662306a36Sopenharmony_ci if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_BACKBIAS) 241762306a36Sopenharmony_ci rv770_enable_backbias(rdev, true); 241862306a36Sopenharmony_ci 241962306a36Sopenharmony_ci if (pi->dynamic_ss) 242062306a36Sopenharmony_ci cypress_enable_spread_spectrum(rdev, true); 242162306a36Sopenharmony_ci 242262306a36Sopenharmony_ci if (pi->thermal_protection) 242362306a36Sopenharmony_ci rv770_enable_thermal_protection(rdev, true); 242462306a36Sopenharmony_ci 242562306a36Sopenharmony_ci rv770_setup_bsp(rdev); 242662306a36Sopenharmony_ci rv770_program_git(rdev); 242762306a36Sopenharmony_ci rv770_program_tp(rdev); 242862306a36Sopenharmony_ci rv770_program_tpp(rdev); 242962306a36Sopenharmony_ci rv770_program_sstp(rdev); 243062306a36Sopenharmony_ci rv770_program_engine_speed_parameters(rdev); 243162306a36Sopenharmony_ci cypress_enable_display_gap(rdev); 243262306a36Sopenharmony_ci rv770_program_vc(rdev); 243362306a36Sopenharmony_ci 243462306a36Sopenharmony_ci if (pi->dynamic_pcie_gen2) 243562306a36Sopenharmony_ci btc_enable_dynamic_pcie_gen2(rdev, true); 243662306a36Sopenharmony_ci 243762306a36Sopenharmony_ci ret = rv770_upload_firmware(rdev); 243862306a36Sopenharmony_ci if (ret) { 243962306a36Sopenharmony_ci DRM_ERROR("rv770_upload_firmware failed\n"); 244062306a36Sopenharmony_ci return ret; 244162306a36Sopenharmony_ci } 244262306a36Sopenharmony_ci ret = cypress_get_table_locations(rdev); 244362306a36Sopenharmony_ci if (ret) { 244462306a36Sopenharmony_ci DRM_ERROR("cypress_get_table_locations failed\n"); 244562306a36Sopenharmony_ci return ret; 244662306a36Sopenharmony_ci } 244762306a36Sopenharmony_ci ret = btc_init_smc_table(rdev, boot_ps); 244862306a36Sopenharmony_ci if (ret) 244962306a36Sopenharmony_ci return ret; 245062306a36Sopenharmony_ci 245162306a36Sopenharmony_ci if (eg_pi->dynamic_ac_timing) { 245262306a36Sopenharmony_ci ret = cypress_populate_mc_reg_table(rdev, boot_ps); 245362306a36Sopenharmony_ci if (ret) { 245462306a36Sopenharmony_ci DRM_ERROR("cypress_populate_mc_reg_table failed\n"); 245562306a36Sopenharmony_ci return ret; 245662306a36Sopenharmony_ci } 245762306a36Sopenharmony_ci } 245862306a36Sopenharmony_ci 245962306a36Sopenharmony_ci cypress_program_response_times(rdev); 246062306a36Sopenharmony_ci r7xx_start_smc(rdev); 246162306a36Sopenharmony_ci ret = cypress_notify_smc_display_change(rdev, false); 246262306a36Sopenharmony_ci if (ret) { 246362306a36Sopenharmony_ci DRM_ERROR("cypress_notify_smc_display_change failed\n"); 246462306a36Sopenharmony_ci return ret; 246562306a36Sopenharmony_ci } 246662306a36Sopenharmony_ci cypress_enable_sclk_control(rdev, true); 246762306a36Sopenharmony_ci 246862306a36Sopenharmony_ci if (eg_pi->memory_transition) 246962306a36Sopenharmony_ci cypress_enable_mclk_control(rdev, true); 247062306a36Sopenharmony_ci 247162306a36Sopenharmony_ci cypress_start_dpm(rdev); 247262306a36Sopenharmony_ci 247362306a36Sopenharmony_ci if (pi->gfx_clock_gating) 247462306a36Sopenharmony_ci btc_cg_clock_gating_enable(rdev, true); 247562306a36Sopenharmony_ci 247662306a36Sopenharmony_ci if (pi->mg_clock_gating) 247762306a36Sopenharmony_ci btc_mg_clock_gating_enable(rdev, true); 247862306a36Sopenharmony_ci 247962306a36Sopenharmony_ci if (eg_pi->ls_clock_gating) 248062306a36Sopenharmony_ci btc_ls_clock_gating_enable(rdev, true); 248162306a36Sopenharmony_ci 248262306a36Sopenharmony_ci rv770_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true); 248362306a36Sopenharmony_ci 248462306a36Sopenharmony_ci btc_init_stutter_mode(rdev); 248562306a36Sopenharmony_ci 248662306a36Sopenharmony_ci btc_update_current_ps(rdev, rdev->pm.dpm.boot_ps); 248762306a36Sopenharmony_ci 248862306a36Sopenharmony_ci return 0; 248962306a36Sopenharmony_ci}; 249062306a36Sopenharmony_ci 249162306a36Sopenharmony_civoid btc_dpm_disable(struct radeon_device *rdev) 249262306a36Sopenharmony_ci{ 249362306a36Sopenharmony_ci struct rv7xx_power_info *pi = rv770_get_pi(rdev); 249462306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 249562306a36Sopenharmony_ci 249662306a36Sopenharmony_ci if (!btc_dpm_enabled(rdev)) 249762306a36Sopenharmony_ci return; 249862306a36Sopenharmony_ci 249962306a36Sopenharmony_ci rv770_clear_vc(rdev); 250062306a36Sopenharmony_ci 250162306a36Sopenharmony_ci if (pi->thermal_protection) 250262306a36Sopenharmony_ci rv770_enable_thermal_protection(rdev, false); 250362306a36Sopenharmony_ci 250462306a36Sopenharmony_ci if (pi->dynamic_pcie_gen2) 250562306a36Sopenharmony_ci btc_enable_dynamic_pcie_gen2(rdev, false); 250662306a36Sopenharmony_ci 250762306a36Sopenharmony_ci if (rdev->irq.installed && 250862306a36Sopenharmony_ci r600_is_internal_thermal_sensor(rdev->pm.int_thermal_type)) { 250962306a36Sopenharmony_ci rdev->irq.dpm_thermal = false; 251062306a36Sopenharmony_ci radeon_irq_set(rdev); 251162306a36Sopenharmony_ci } 251262306a36Sopenharmony_ci 251362306a36Sopenharmony_ci if (pi->gfx_clock_gating) 251462306a36Sopenharmony_ci btc_cg_clock_gating_enable(rdev, false); 251562306a36Sopenharmony_ci 251662306a36Sopenharmony_ci if (pi->mg_clock_gating) 251762306a36Sopenharmony_ci btc_mg_clock_gating_enable(rdev, false); 251862306a36Sopenharmony_ci 251962306a36Sopenharmony_ci if (eg_pi->ls_clock_gating) 252062306a36Sopenharmony_ci btc_ls_clock_gating_enable(rdev, false); 252162306a36Sopenharmony_ci 252262306a36Sopenharmony_ci rv770_stop_dpm(rdev); 252362306a36Sopenharmony_ci btc_reset_to_default(rdev); 252462306a36Sopenharmony_ci btc_stop_smc(rdev); 252562306a36Sopenharmony_ci cypress_enable_spread_spectrum(rdev, false); 252662306a36Sopenharmony_ci 252762306a36Sopenharmony_ci btc_update_current_ps(rdev, rdev->pm.dpm.boot_ps); 252862306a36Sopenharmony_ci} 252962306a36Sopenharmony_ci 253062306a36Sopenharmony_civoid btc_dpm_setup_asic(struct radeon_device *rdev) 253162306a36Sopenharmony_ci{ 253262306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 253362306a36Sopenharmony_ci int r; 253462306a36Sopenharmony_ci 253562306a36Sopenharmony_ci r = ni_mc_load_microcode(rdev); 253662306a36Sopenharmony_ci if (r) 253762306a36Sopenharmony_ci DRM_ERROR("Failed to load MC firmware!\n"); 253862306a36Sopenharmony_ci rv770_get_memory_type(rdev); 253962306a36Sopenharmony_ci rv740_read_clock_registers(rdev); 254062306a36Sopenharmony_ci btc_read_arb_registers(rdev); 254162306a36Sopenharmony_ci rv770_read_voltage_smio_registers(rdev); 254262306a36Sopenharmony_ci 254362306a36Sopenharmony_ci if (eg_pi->pcie_performance_request) 254462306a36Sopenharmony_ci cypress_advertise_gen2_capability(rdev); 254562306a36Sopenharmony_ci 254662306a36Sopenharmony_ci rv770_get_pcie_gen2_status(rdev); 254762306a36Sopenharmony_ci rv770_enable_acpi_pm(rdev); 254862306a36Sopenharmony_ci} 254962306a36Sopenharmony_ci 255062306a36Sopenharmony_ciint btc_dpm_init(struct radeon_device *rdev) 255162306a36Sopenharmony_ci{ 255262306a36Sopenharmony_ci struct rv7xx_power_info *pi; 255362306a36Sopenharmony_ci struct evergreen_power_info *eg_pi; 255462306a36Sopenharmony_ci struct atom_clock_dividers dividers; 255562306a36Sopenharmony_ci int ret; 255662306a36Sopenharmony_ci 255762306a36Sopenharmony_ci eg_pi = kzalloc(sizeof(struct evergreen_power_info), GFP_KERNEL); 255862306a36Sopenharmony_ci if (eg_pi == NULL) 255962306a36Sopenharmony_ci return -ENOMEM; 256062306a36Sopenharmony_ci rdev->pm.dpm.priv = eg_pi; 256162306a36Sopenharmony_ci pi = &eg_pi->rv7xx; 256262306a36Sopenharmony_ci 256362306a36Sopenharmony_ci rv770_get_max_vddc(rdev); 256462306a36Sopenharmony_ci 256562306a36Sopenharmony_ci eg_pi->ulv.supported = false; 256662306a36Sopenharmony_ci pi->acpi_vddc = 0; 256762306a36Sopenharmony_ci eg_pi->acpi_vddci = 0; 256862306a36Sopenharmony_ci pi->min_vddc_in_table = 0; 256962306a36Sopenharmony_ci pi->max_vddc_in_table = 0; 257062306a36Sopenharmony_ci 257162306a36Sopenharmony_ci ret = r600_get_platform_caps(rdev); 257262306a36Sopenharmony_ci if (ret) 257362306a36Sopenharmony_ci return ret; 257462306a36Sopenharmony_ci 257562306a36Sopenharmony_ci ret = rv7xx_parse_power_table(rdev); 257662306a36Sopenharmony_ci if (ret) 257762306a36Sopenharmony_ci return ret; 257862306a36Sopenharmony_ci ret = r600_parse_extended_power_table(rdev); 257962306a36Sopenharmony_ci if (ret) 258062306a36Sopenharmony_ci return ret; 258162306a36Sopenharmony_ci 258262306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 258362306a36Sopenharmony_ci kcalloc(4, 258462306a36Sopenharmony_ci sizeof(struct radeon_clock_voltage_dependency_entry), 258562306a36Sopenharmony_ci GFP_KERNEL); 258662306a36Sopenharmony_ci if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 258762306a36Sopenharmony_ci r600_free_extended_power_table(rdev); 258862306a36Sopenharmony_ci return -ENOMEM; 258962306a36Sopenharmony_ci } 259062306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.count = 4; 259162306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[0].clk = 0; 259262306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[0].v = 0; 259362306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[1].clk = 36000; 259462306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[1].v = 800; 259562306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[2].clk = 54000; 259662306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[2].v = 800; 259762306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[3].clk = 72000; 259862306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[3].v = 800; 259962306a36Sopenharmony_ci 260062306a36Sopenharmony_ci if (rdev->pm.dpm.voltage_response_time == 0) 260162306a36Sopenharmony_ci rdev->pm.dpm.voltage_response_time = R600_VOLTAGERESPONSETIME_DFLT; 260262306a36Sopenharmony_ci if (rdev->pm.dpm.backbias_response_time == 0) 260362306a36Sopenharmony_ci rdev->pm.dpm.backbias_response_time = R600_BACKBIASRESPONSETIME_DFLT; 260462306a36Sopenharmony_ci 260562306a36Sopenharmony_ci ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, 260662306a36Sopenharmony_ci 0, false, ÷rs); 260762306a36Sopenharmony_ci if (ret) 260862306a36Sopenharmony_ci pi->ref_div = dividers.ref_div + 1; 260962306a36Sopenharmony_ci else 261062306a36Sopenharmony_ci pi->ref_div = R600_REFERENCEDIVIDER_DFLT; 261162306a36Sopenharmony_ci 261262306a36Sopenharmony_ci pi->mclk_strobe_mode_threshold = 40000; 261362306a36Sopenharmony_ci pi->mclk_edc_enable_threshold = 40000; 261462306a36Sopenharmony_ci eg_pi->mclk_edc_wr_enable_threshold = 40000; 261562306a36Sopenharmony_ci 261662306a36Sopenharmony_ci pi->rlp = RV770_RLP_DFLT; 261762306a36Sopenharmony_ci pi->rmp = RV770_RMP_DFLT; 261862306a36Sopenharmony_ci pi->lhp = RV770_LHP_DFLT; 261962306a36Sopenharmony_ci pi->lmp = RV770_LMP_DFLT; 262062306a36Sopenharmony_ci 262162306a36Sopenharmony_ci eg_pi->ats[0].rlp = RV770_RLP_DFLT; 262262306a36Sopenharmony_ci eg_pi->ats[0].rmp = RV770_RMP_DFLT; 262362306a36Sopenharmony_ci eg_pi->ats[0].lhp = RV770_LHP_DFLT; 262462306a36Sopenharmony_ci eg_pi->ats[0].lmp = RV770_LMP_DFLT; 262562306a36Sopenharmony_ci 262662306a36Sopenharmony_ci eg_pi->ats[1].rlp = BTC_RLP_UVD_DFLT; 262762306a36Sopenharmony_ci eg_pi->ats[1].rmp = BTC_RMP_UVD_DFLT; 262862306a36Sopenharmony_ci eg_pi->ats[1].lhp = BTC_LHP_UVD_DFLT; 262962306a36Sopenharmony_ci eg_pi->ats[1].lmp = BTC_LMP_UVD_DFLT; 263062306a36Sopenharmony_ci 263162306a36Sopenharmony_ci eg_pi->smu_uvd_hs = true; 263262306a36Sopenharmony_ci 263362306a36Sopenharmony_ci pi->voltage_control = 263462306a36Sopenharmony_ci radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 0); 263562306a36Sopenharmony_ci 263662306a36Sopenharmony_ci pi->mvdd_control = 263762306a36Sopenharmony_ci radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 0); 263862306a36Sopenharmony_ci 263962306a36Sopenharmony_ci eg_pi->vddci_control = 264062306a36Sopenharmony_ci radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 0); 264162306a36Sopenharmony_ci 264262306a36Sopenharmony_ci rv770_get_engine_memory_ss(rdev); 264362306a36Sopenharmony_ci 264462306a36Sopenharmony_ci pi->asi = RV770_ASI_DFLT; 264562306a36Sopenharmony_ci pi->pasi = CYPRESS_HASI_DFLT; 264662306a36Sopenharmony_ci pi->vrc = CYPRESS_VRC_DFLT; 264762306a36Sopenharmony_ci 264862306a36Sopenharmony_ci pi->power_gating = false; 264962306a36Sopenharmony_ci 265062306a36Sopenharmony_ci pi->gfx_clock_gating = true; 265162306a36Sopenharmony_ci 265262306a36Sopenharmony_ci pi->mg_clock_gating = true; 265362306a36Sopenharmony_ci pi->mgcgtssm = true; 265462306a36Sopenharmony_ci eg_pi->ls_clock_gating = false; 265562306a36Sopenharmony_ci eg_pi->sclk_deep_sleep = false; 265662306a36Sopenharmony_ci 265762306a36Sopenharmony_ci pi->dynamic_pcie_gen2 = true; 265862306a36Sopenharmony_ci 265962306a36Sopenharmony_ci if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) 266062306a36Sopenharmony_ci pi->thermal_protection = true; 266162306a36Sopenharmony_ci else 266262306a36Sopenharmony_ci pi->thermal_protection = false; 266362306a36Sopenharmony_ci 266462306a36Sopenharmony_ci pi->display_gap = true; 266562306a36Sopenharmony_ci 266662306a36Sopenharmony_ci if (rdev->flags & RADEON_IS_MOBILITY) 266762306a36Sopenharmony_ci pi->dcodt = true; 266862306a36Sopenharmony_ci else 266962306a36Sopenharmony_ci pi->dcodt = false; 267062306a36Sopenharmony_ci 267162306a36Sopenharmony_ci pi->ulps = true; 267262306a36Sopenharmony_ci 267362306a36Sopenharmony_ci eg_pi->dynamic_ac_timing = true; 267462306a36Sopenharmony_ci eg_pi->abm = true; 267562306a36Sopenharmony_ci eg_pi->mcls = true; 267662306a36Sopenharmony_ci eg_pi->light_sleep = true; 267762306a36Sopenharmony_ci eg_pi->memory_transition = true; 267862306a36Sopenharmony_ci#if defined(CONFIG_ACPI) 267962306a36Sopenharmony_ci eg_pi->pcie_performance_request = 268062306a36Sopenharmony_ci radeon_acpi_is_pcie_performance_request_supported(rdev); 268162306a36Sopenharmony_ci#else 268262306a36Sopenharmony_ci eg_pi->pcie_performance_request = false; 268362306a36Sopenharmony_ci#endif 268462306a36Sopenharmony_ci 268562306a36Sopenharmony_ci if (rdev->family == CHIP_BARTS) 268662306a36Sopenharmony_ci eg_pi->dll_default_on = true; 268762306a36Sopenharmony_ci else 268862306a36Sopenharmony_ci eg_pi->dll_default_on = false; 268962306a36Sopenharmony_ci 269062306a36Sopenharmony_ci eg_pi->sclk_deep_sleep = false; 269162306a36Sopenharmony_ci if (ASIC_IS_LOMBOK(rdev)) 269262306a36Sopenharmony_ci pi->mclk_stutter_mode_threshold = 30000; 269362306a36Sopenharmony_ci else 269462306a36Sopenharmony_ci pi->mclk_stutter_mode_threshold = 0; 269562306a36Sopenharmony_ci 269662306a36Sopenharmony_ci pi->sram_end = SMC_RAM_END; 269762306a36Sopenharmony_ci 269862306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.mclk_sclk_ratio = 4; 269962306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.vddc_vddci_delta = 200; 270062306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.min_vddc_for_pcie_gen2 = 900; 270162306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.valid_sclk_values.count = ARRAY_SIZE(btc_valid_sclk); 270262306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.valid_sclk_values.values = btc_valid_sclk; 270362306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.valid_mclk_values.count = 0; 270462306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.valid_mclk_values.values = NULL; 270562306a36Sopenharmony_ci 270662306a36Sopenharmony_ci if (rdev->family == CHIP_TURKS) 270762306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.sclk_mclk_delta = 15000; 270862306a36Sopenharmony_ci else 270962306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.sclk_mclk_delta = 10000; 271062306a36Sopenharmony_ci 271162306a36Sopenharmony_ci /* make sure dc limits are valid */ 271262306a36Sopenharmony_ci if ((rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.sclk == 0) || 271362306a36Sopenharmony_ci (rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.mclk == 0)) 271462306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc = 271562306a36Sopenharmony_ci rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; 271662306a36Sopenharmony_ci 271762306a36Sopenharmony_ci return 0; 271862306a36Sopenharmony_ci} 271962306a36Sopenharmony_ci 272062306a36Sopenharmony_civoid btc_dpm_fini(struct radeon_device *rdev) 272162306a36Sopenharmony_ci{ 272262306a36Sopenharmony_ci int i; 272362306a36Sopenharmony_ci 272462306a36Sopenharmony_ci for (i = 0; i < rdev->pm.dpm.num_ps; i++) { 272562306a36Sopenharmony_ci kfree(rdev->pm.dpm.ps[i].ps_priv); 272662306a36Sopenharmony_ci } 272762306a36Sopenharmony_ci kfree(rdev->pm.dpm.ps); 272862306a36Sopenharmony_ci kfree(rdev->pm.dpm.priv); 272962306a36Sopenharmony_ci kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries); 273062306a36Sopenharmony_ci r600_free_extended_power_table(rdev); 273162306a36Sopenharmony_ci} 273262306a36Sopenharmony_ci 273362306a36Sopenharmony_civoid btc_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, 273462306a36Sopenharmony_ci struct seq_file *m) 273562306a36Sopenharmony_ci{ 273662306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 273762306a36Sopenharmony_ci struct radeon_ps *rps = &eg_pi->current_rps; 273862306a36Sopenharmony_ci struct rv7xx_ps *ps = rv770_get_ps(rps); 273962306a36Sopenharmony_ci struct rv7xx_pl *pl; 274062306a36Sopenharmony_ci u32 current_index = 274162306a36Sopenharmony_ci (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_PROFILE_INDEX_MASK) >> 274262306a36Sopenharmony_ci CURRENT_PROFILE_INDEX_SHIFT; 274362306a36Sopenharmony_ci 274462306a36Sopenharmony_ci if (current_index > 2) { 274562306a36Sopenharmony_ci seq_printf(m, "invalid dpm profile %d\n", current_index); 274662306a36Sopenharmony_ci } else { 274762306a36Sopenharmony_ci if (current_index == 0) 274862306a36Sopenharmony_ci pl = &ps->low; 274962306a36Sopenharmony_ci else if (current_index == 1) 275062306a36Sopenharmony_ci pl = &ps->medium; 275162306a36Sopenharmony_ci else /* current_index == 2 */ 275262306a36Sopenharmony_ci pl = &ps->high; 275362306a36Sopenharmony_ci seq_printf(m, "uvd vclk: %d dclk: %d\n", rps->vclk, rps->dclk); 275462306a36Sopenharmony_ci seq_printf(m, "power level %d sclk: %u mclk: %u vddc: %u vddci: %u\n", 275562306a36Sopenharmony_ci current_index, pl->sclk, pl->mclk, pl->vddc, pl->vddci); 275662306a36Sopenharmony_ci } 275762306a36Sopenharmony_ci} 275862306a36Sopenharmony_ci 275962306a36Sopenharmony_ciu32 btc_dpm_get_current_sclk(struct radeon_device *rdev) 276062306a36Sopenharmony_ci{ 276162306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 276262306a36Sopenharmony_ci struct radeon_ps *rps = &eg_pi->current_rps; 276362306a36Sopenharmony_ci struct rv7xx_ps *ps = rv770_get_ps(rps); 276462306a36Sopenharmony_ci struct rv7xx_pl *pl; 276562306a36Sopenharmony_ci u32 current_index = 276662306a36Sopenharmony_ci (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_PROFILE_INDEX_MASK) >> 276762306a36Sopenharmony_ci CURRENT_PROFILE_INDEX_SHIFT; 276862306a36Sopenharmony_ci 276962306a36Sopenharmony_ci if (current_index > 2) { 277062306a36Sopenharmony_ci return 0; 277162306a36Sopenharmony_ci } else { 277262306a36Sopenharmony_ci if (current_index == 0) 277362306a36Sopenharmony_ci pl = &ps->low; 277462306a36Sopenharmony_ci else if (current_index == 1) 277562306a36Sopenharmony_ci pl = &ps->medium; 277662306a36Sopenharmony_ci else /* current_index == 2 */ 277762306a36Sopenharmony_ci pl = &ps->high; 277862306a36Sopenharmony_ci return pl->sclk; 277962306a36Sopenharmony_ci } 278062306a36Sopenharmony_ci} 278162306a36Sopenharmony_ci 278262306a36Sopenharmony_ciu32 btc_dpm_get_current_mclk(struct radeon_device *rdev) 278362306a36Sopenharmony_ci{ 278462306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 278562306a36Sopenharmony_ci struct radeon_ps *rps = &eg_pi->current_rps; 278662306a36Sopenharmony_ci struct rv7xx_ps *ps = rv770_get_ps(rps); 278762306a36Sopenharmony_ci struct rv7xx_pl *pl; 278862306a36Sopenharmony_ci u32 current_index = 278962306a36Sopenharmony_ci (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_PROFILE_INDEX_MASK) >> 279062306a36Sopenharmony_ci CURRENT_PROFILE_INDEX_SHIFT; 279162306a36Sopenharmony_ci 279262306a36Sopenharmony_ci if (current_index > 2) { 279362306a36Sopenharmony_ci return 0; 279462306a36Sopenharmony_ci } else { 279562306a36Sopenharmony_ci if (current_index == 0) 279662306a36Sopenharmony_ci pl = &ps->low; 279762306a36Sopenharmony_ci else if (current_index == 1) 279862306a36Sopenharmony_ci pl = &ps->medium; 279962306a36Sopenharmony_ci else /* current_index == 2 */ 280062306a36Sopenharmony_ci pl = &ps->high; 280162306a36Sopenharmony_ci return pl->mclk; 280262306a36Sopenharmony_ci } 280362306a36Sopenharmony_ci} 280462306a36Sopenharmony_ci 280562306a36Sopenharmony_ciu32 btc_dpm_get_sclk(struct radeon_device *rdev, bool low) 280662306a36Sopenharmony_ci{ 280762306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 280862306a36Sopenharmony_ci struct rv7xx_ps *requested_state = rv770_get_ps(&eg_pi->requested_rps); 280962306a36Sopenharmony_ci 281062306a36Sopenharmony_ci if (low) 281162306a36Sopenharmony_ci return requested_state->low.sclk; 281262306a36Sopenharmony_ci else 281362306a36Sopenharmony_ci return requested_state->high.sclk; 281462306a36Sopenharmony_ci} 281562306a36Sopenharmony_ci 281662306a36Sopenharmony_ciu32 btc_dpm_get_mclk(struct radeon_device *rdev, bool low) 281762306a36Sopenharmony_ci{ 281862306a36Sopenharmony_ci struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 281962306a36Sopenharmony_ci struct rv7xx_ps *requested_state = rv770_get_ps(&eg_pi->requested_rps); 282062306a36Sopenharmony_ci 282162306a36Sopenharmony_ci if (low) 282262306a36Sopenharmony_ci return requested_state->low.mclk; 282362306a36Sopenharmony_ci else 282462306a36Sopenharmony_ci return requested_state->high.mclk; 282562306a36Sopenharmony_ci} 2826