| 1 |
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause |
| 2 |
/* |
| 3 |
* Copyright (C) 2025 Intel Corporation |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef __iwl_pcie_utils_h__ |
| 7 |
#define __iwl_pcie_utils_h__ |
| 8 |
|
| 9 |
#include "iwl-io.h" |
| 10 |
|
| 11 |
void iwl_trans_pcie_dump_regs(struct iwl_trans *trans, struct pci_dev *pdev); |
| 12 |
|
| 13 |
static inline void _iwl_trans_set_bits_mask(struct iwl_trans *trans, |
| 14 |
u32 reg, u32 mask, u32 value) |
| 15 |
{ |
| 16 |
u32 v; |
| 17 |
|
| 18 |
#ifdef CONFIG_IWLWIFI_DEBUG |
| 19 |
WARN_ON_ONCE(value & ~mask); |
| 20 |
#endif |
| 21 |
|
| 22 |
v = iwl_read32(trans, reg); |
| 23 |
v &= ~mask; |
| 24 |
v |= value; |
| 25 |
iwl_write32(trans, reg, v); |
| 26 |
} |
| 27 |
|
| 28 |
static inline void iwl_trans_clear_bit(struct iwl_trans *trans, |
| 29 |
u32 reg, u32 mask) |
| 30 |
{ |
| 31 |
_iwl_trans_set_bits_mask(trans, reg, mask, 0); |
| 32 |
} |
| 33 |
|
| 34 |
static inline void iwl_trans_set_bit(struct iwl_trans *trans, |
| 35 |
u32 reg, u32 mask) |
| 36 |
{ |
| 37 |
_iwl_trans_set_bits_mask(trans, reg, mask, mask); |
| 38 |
} |
| 39 |
|
| 40 |
#endif /* __iwl_pcie_utils_h__ */ |