[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 12/26] e1000e: Improve software reset
From: |
Akihiko Odaki |
Subject: |
[PATCH v2 12/26] e1000e: Improve software reset |
Date: |
Tue, 24 Jan 2023 13:31:29 +0900 |
This change makes e1000e reset more things when software reset was
triggered. Some registers are exempted from software reset in the
datasheet and this change also implements the behavior accordingly.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
hw/net/e1000e_core.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 37aec6a970..b8670662c8 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -58,6 +58,8 @@
static inline void
e1000e_set_interrupt_cause(E1000ECore *core, uint32_t val);
+static void e1000e_reset(E1000ECore *core, bool sw);
+
static inline void
e1000e_process_ts_option(E1000ECore *core, struct e1000_tx_desc *dp)
{
@@ -1882,7 +1884,7 @@ e1000e_set_ctrl(E1000ECore *core, int index, uint32_t val)
if (val & E1000_CTRL_RST) {
trace_e1000e_core_ctrl_sw_reset();
- e1000x_reset_mac_addr(core->owner_nic, core->mac, core->permanent_mac);
+ e1000e_reset(core, true);
}
if (val & E1000_CTRL_PHY_RST) {
@@ -3488,8 +3490,7 @@ static const uint32_t e1000e_mac_reg_init[] = {
[EITR...EITR + E1000E_MSIX_VEC_NUM - 1] = E1000E_MIN_XITR,
};
-void
-e1000e_core_reset(E1000ECore *core)
+static void e1000e_reset(E1000ECore *core, bool sw)
{
int i;
@@ -3499,8 +3500,15 @@ e1000e_core_reset(E1000ECore *core)
memset(core->phy, 0, sizeof core->phy);
memcpy(core->phy, e1000e_phy_reg_init, sizeof e1000e_phy_reg_init);
- memset(core->mac, 0, sizeof core->mac);
- memcpy(core->mac, e1000e_mac_reg_init, sizeof e1000e_mac_reg_init);
+
+ for (i = 0; i < E1000E_MAC_SIZE; i++) {
+ if (sw && (i == PBA || i == PBS || i == FLA)) {
+ continue;
+ }
+
+ core->mac[i] = i < ARRAY_SIZE(e1000e_mac_reg_init) ?
+ e1000e_mac_reg_init[i] : 0;
+ }
core->rxbuf_min_shift = 1 + E1000_RING_DESC_LEN_SHIFT;
@@ -3517,6 +3525,12 @@ e1000e_core_reset(E1000ECore *core)
}
}
+void
+e1000e_core_reset(E1000ECore *core)
+{
+ e1000e_reset(core, false);
+}
+
void e1000e_core_pre_save(E1000ECore *core)
{
int i;
--
2.39.0
- [PATCH v2 02/26] hw/net: Add more MII definitions, (continued)
- [PATCH v2 02/26] hw/net: Add more MII definitions, Akihiko Odaki, 2023/01/23
- [PATCH v2 03/26] fsl_etsec: Use hw/net/mii.h, Akihiko Odaki, 2023/01/23
- [PATCH v2 04/26] e1000: Use hw/net/mii.h, Akihiko Odaki, 2023/01/23
- [PATCH v2 05/26] e1000: Mask registers when writing, Akihiko Odaki, 2023/01/23
- [PATCH v2 06/26] e1000e: Mask registers when writing, Akihiko Odaki, 2023/01/23
- [PATCH v2 07/26] e1000: Use more constant definitions, Akihiko Odaki, 2023/01/23
- [PATCH v2 08/26] e1000e: Use more constant definitions, Akihiko Odaki, 2023/01/23
- [PATCH v2 09/26] e1000: Use memcpy to intialize registers, Akihiko Odaki, 2023/01/23
- [PATCH v2 10/26] e1000e: Use memcpy to intialize registers, Akihiko Odaki, 2023/01/23
- [PATCH v2 11/26] e1000e: Remove pending interrupt flags, Akihiko Odaki, 2023/01/23
- [PATCH v2 12/26] e1000e: Improve software reset,
Akihiko Odaki <=
- [PATCH v2 13/26] e1000: Configure ResettableClass, Akihiko Odaki, 2023/01/23
- [PATCH v2 14/26] e1000e: Configure ResettableClass, Akihiko Odaki, 2023/01/23
- [PATCH v2 15/26] e1000e: Introduce e1000_rx_desc_union, Akihiko Odaki, 2023/01/23
- [PATCH v2 16/26] e1000e: Set MII_ANER_NWAY, Akihiko Odaki, 2023/01/23
- [PATCH v2 17/26] e1000e: Remove extra pointer indirection, Akihiko Odaki, 2023/01/23
- [PATCH v2 18/26] net: Check L4 header size, Akihiko Odaki, 2023/01/23
- [PATCH v2 19/26] e1000x: Alter the signature of e1000x_is_vlan_packet, Akihiko Odaki, 2023/01/23
- [PATCH v2 20/26] net: Strip virtio-net header when dumping, Akihiko Odaki, 2023/01/23
- [PATCH v2 21/26] hw/net/net_tx_pkt: Automatically determine if virtio-net header is used, Akihiko Odaki, 2023/01/23
- [PATCH v2 22/26] hw/net/net_rx_pkt: Remove net_rx_pkt_has_virt_hdr, Akihiko Odaki, 2023/01/23