aboutsummaryrefslogtreecommitdiff
path: root/hw/net/imx_fec.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2021-05-03 06:53:00 -0700
committerJason Wang <jasowang@redhat.com>2021-05-27 11:03:07 +0800
commitf607dce2ed0a78bee3da6482c7abe58a80df2974 (patch)
tree336b9fd60f0885d5822d16c1bf69d3a1f8fdff87 /hw/net/imx_fec.c
parentd90f154867ec0ec22fd719164b88716e8fd48672 (diff)
downloadqemu-f607dce2ed0a78bee3da6482c7abe58a80df2974.zip
qemu-f607dce2ed0a78bee3da6482c7abe58a80df2974.tar.gz
qemu-f607dce2ed0a78bee3da6482c7abe58a80df2974.tar.bz2
hw/net/imx_fec: return 0xffff when accessing non-existing PHY
If a PHY does not exist, attempts to read from it should return 0xffff. Otherwise the Linux kernel will believe that a PHY is there and select the non-existing PHY. This in turn will result in network errors later on since the real PHY is not selected or configured. Since reading from or writing to a non-existing PHY is not an emulation error, replace guest error messages with traces. Fixes: 461c51ad4275 ("Add a phy-num property to the i.MX FEC emulator") Cc: Jean-Christophe Dubois <jcd@tribudubois.net> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jason Wang <jasowang@redhat.com>
Diffstat (limited to 'hw/net/imx_fec.c')
-rw-r--r--hw/net/imx_fec.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index f03450c..9c7035b 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -283,9 +283,8 @@ static uint32_t imx_phy_read(IMXFECState *s, int reg)
uint32_t phy = reg / 32;
if (phy != s->phy_num) {
- qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n",
- TYPE_IMX_FEC, __func__, phy);
- return 0;
+ trace_imx_phy_read_num(phy, s->phy_num);
+ return 0xffff;
}
reg %= 32;
@@ -345,8 +344,7 @@ static void imx_phy_write(IMXFECState *s, int reg, uint32_t val)
uint32_t phy = reg / 32;
if (phy != s->phy_num) {
- qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad phy num %u\n",
- TYPE_IMX_FEC, __func__, phy);
+ trace_imx_phy_write_num(phy, s->phy_num);
return;
}