Skip to content

Commit

Permalink
hw/ppc/pegasos2: Let pegasos2 machine configure SuperI/O functions
Browse files Browse the repository at this point in the history
This is a preparation for implementing relocation and toggling of SuperI/O
functions in the VT8231 device model. Upon reset, all SuperI/O functions will be
deactivated, so in case if no -bios is given, let the machine configure those
functions the same way Pegasos II firmware would do.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>
Message-Id: <20240114123911.4877-11-shentey@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
shentok authored and mstsirkin committed Feb 14, 2024
1 parent 1d1afd9 commit 79a7f53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions hw/ppc/pegasos2.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ static void pegasos2_pci_config_write(Pegasos2MachineState *pm, int bus,
pegasos2_mv_reg_write(pm, pcicfg + 4, len, val);
}

static void pegasos2_superio_write(uint8_t addr, uint8_t val)
{
cpu_physical_memory_write(PCI1_IO_BASE + 0x3f0, &addr, 1);
cpu_physical_memory_write(PCI1_IO_BASE + 0x3f1, &val, 1);
}

static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason)
{
Pegasos2MachineState *pm = PEGASOS2_MACHINE(machine);
Expand All @@ -310,6 +316,12 @@ static void pegasos2_machine_reset(MachineState *machine, ShutdownCause reason)

pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
PCI_INTERRUPT_LINE, 2, 0x9);
pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
0x50, 1, 0x6);
pegasos2_superio_write(0xf4, 0xbe);
pegasos2_superio_write(0xf6, 0xef);
pegasos2_superio_write(0xf7, 0xfc);
pegasos2_superio_write(0xf2, 0x14);
pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
0x50, 1, 0x2);
pegasos2_pci_config_write(pm, 1, (PCI_DEVFN(12, 0) << 8) |
Expand Down

0 comments on commit 79a7f53

Please sign in to comment.