On 31/10/2025 21:15, Soumyajyotii Ssarkar wrote:
From: RemZapCypher <[email protected]>
Enable the i82596 network chip which is included in the LASI
multi I/O chip. Since LASI has different start addresses on
the various machines, always initialize the LASI components
by their offsets.
Signed-off-by: Helge Deller <[email protected]>
---
hw/hppa/hppa_hardware.h | 20 ++++++++++++--------
hw/hppa/machine.c | 25 +++++++++++--------------
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/hw/hppa/hppa_hardware.h b/hw/hppa/hppa_hardware.h
index d422af0429..a8a496c0e1 100644
--- a/hw/hppa/hppa_hardware.h
+++ b/hw/hppa/hppa_hardware.h
@@ -21,14 +21,6 @@
#define DINO_SCSI_HPA 0xfff8c000
#define LASI_HPA_715 0xf0100000
#define LASI_HPA 0xffd00000
-#define LASI_UART_HPA 0xffd05000
-#define LASI_SCSI_HPA 0xffd06000
-#define LASI_LAN_HPA 0xffd07000
-#define LASI_RTC_HPA 0xffd09000
-#define LASI_LPT_HPA 0xffd02000
-#define LASI_AUDIO_HPA 0xffd04000
-#define LASI_PS2KBD_HPA 0xffd08000
-#define LASI_PS2MOU_HPA 0xffd08100
#define LASI_GFX_HPA 0xf8000000
#define ARTIST_FB_ADDR 0xf9000000
#define CPU_HPA 0xfffb0000
@@ -44,6 +36,18 @@
#define SCSI_HPA 0xf1040000 /* emulated SCSI, needs to be in f region */
+#define HPA_DISABLED_DEVICE 1 /* add to HPA to disable */
+
+/* LASI offsets */
+#define LASI_LPT 0x02000
+#define LASI_AUDIO 0x04000
+#define LASI_UART 0x05000
+#define LASI_SCSI 0x06000
+#define LASI_LAN 0x07000
+#define LASI_PS2 0x08000
+#define LASI_RTC 0x09000
+#define LASI_FDC 0x0A000
+
/* offsets to DINO HPA: */
#define DINO_PCI_ADDR 0x064
#define DINO_CONFIG_DATA 0x068
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index cbca0026ab..7c5297c071 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -50,8 +50,6 @@ struct HppaMachineState {
#define HPA_POWER_BUTTON (FIRMWARE_END - 0x10)
static hwaddr soft_power_reg;
-#define enable_lasi_lan() 0
-
static DeviceState *lasi_dev;
static void hppa_powerdown_req(Notifier *n, void *opaque)
@@ -376,13 +374,6 @@ static void machine_HP_common_init_tail(MachineState
*machine, PCIBus *pci_bus,
}
}
- /* Network setup. */
- if (lasi_dev) {
- lasi_82596_init(addr_space, translate(NULL, LASI_LAN_HPA),
- qdev_get_gpio_in(lasi_dev, LASI_IRQ_LAN_HPA),
- enable_lasi_lan());
- }
-
if (pci_bus) {
pci_init_nic_devices(pci_bus, mc->default_nic);
@@ -595,6 +586,11 @@ static void machine_HP_715_init(MachineState *machine)
lasi_ncr710_handle_legacy_cmdline(dev);
}
+ /* LASI i82596 network */
+ lasi_82596_init(addr_space, translate(NULL, LASI_HPA_715 + LASI_LAN),
+ qdev_get_gpio_in(lasi_dev, LASI_IRQ_LAN_HPA),
+ true);
+
The lasi_82596_init() function should not belong to the device in
hw/net/lasi_i82596.c since it attempts to wire up the NIC in a sysbus-specific way
which is not valid for other buses.
Having a look at lasi_82596_init() there are a few things wrong with it:
- qemu_create_nic_device() should be done in lasi_82596_instance_init()
- s->state.irq should not be set directly, but instead be initialised
as a qdev gpio in lasi_82596_instance_init() and then connected by the board
One solution might be to make these changes and then move the remainder of
lasi_82596_init() into hw/hppa/machine.c and then remove the function declaration
from the lasi_82596.h.
/* Add NICs, graphics & load firmware */
machine_HP_common_init_tail(machine, NULL, translate);
}
@@ -638,7 +634,7 @@ static void machine_HP_B160L_init(MachineState *machine)
assert(isa_bus);
/* Serial ports: Lasi and Dino use a 7.272727 MHz clock. */
- serial_mm_init(addr_space, translate(NULL, LASI_UART_HPA + 0x800), 0,
+ serial_mm_init(addr_space, translate(NULL, LASI_HPA + LASI_UART + 0x800),
0,
qdev_get_gpio_in(lasi_dev, LASI_IRQ_UART_HPA), 7272727 / 16,
serial_hd(0), DEVICE_BIG_ENDIAN);
@@ -647,7 +643,8 @@ static void machine_HP_B160L_init(MachineState *machine)
serial_hd(1), DEVICE_BIG_ENDIAN);
/* Parallel port */
- parallel_mm_init(addr_space, translate(NULL, LASI_LPT_HPA + 0x800), 0,
+ parallel_mm_init(addr_space,
+ translate(NULL, LASI_HPA + LASI_LPT + 0x800), 0,
qdev_get_gpio_in(lasi_dev, LASI_IRQ_LPT_HPA),
parallel_hds[0]);
@@ -657,11 +654,11 @@ static void machine_HP_B160L_init(MachineState *machine)
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
qdev_get_gpio_in(lasi_dev, LASI_IRQ_PS2KBD_HPA));
memory_region_add_subregion(addr_space,
- translate(NULL, LASI_PS2KBD_HPA),
+ translate(NULL, LASI_HPA + LASI_PS2),
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
0));
memory_region_add_subregion(addr_space,
- translate(NULL, LASI_PS2KBD_HPA + 0x100),
+ translate(NULL, LASI_HPA + LASI_PS2 + 0x100),
sysbus_mmio_get_region(SYS_BUS_DEVICE(dev),
1));
@@ -832,7 +829,7 @@ static void HP_715_machine_init_class_init(ObjectClass *oc, const void *data)
/* can only support up to max. 8 CPUs due inventory major numbers */
mc->max_cpus = MIN_CONST(HPPA_MAX_CPUS, 8);
mc->default_ram_size = 256 * MiB;
- mc->default_nic = NULL;
+ mc->default_nic = "lasi_82596";
This should be TYPE_LASI_82596.
ATB,
Mark.