Skip to content

Commit 5ec4f1d

Browse files
thorpejrth7680
authored andcommitted
hw/alpha: Provide a PCI-ISA bridge device node
- Move initialization of the ISA bus from typhoon_init() to clipper_init(); this apsect of device topology is really associated with the individual model, not the core logic chipset. typhoon_init() now returns the IRQ to use for the output of the ISA PIC. - In clipper_init(), instantiate an i82378 instance, and connect its PIC output to the ISA IRQ input provided by typhoon_init(). Remove the explicit instantiations of i8254 and i82374, as these devices are subsumed by the i82378. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Signed-off-by: Jason Thorpe <[email protected]> Message-Id: <[email protected]> [rth: Remove direct dependencies on i82374, i8254, i8259.] Signed-off-by: Richard Henderson <[email protected]>
1 parent 387a1dc commit 5ec4f1d

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

hw/alpha/Kconfig

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ config DP264
33
imply PCI_DEVICES
44
imply TEST_DEVICES
55
imply E1000_PCI
6-
select I82374
7-
select I8254
8-
select I8259
6+
select I82378
97
select IDE_CMD646
108
select MC146818RTC
119
select PCI

hw/alpha/alpha_sys.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "hw/intc/i8259.h"
1111

1212

13-
PCIBus *typhoon_init(MemoryRegion *, ISABus **, qemu_irq *, AlphaCPU *[4],
13+
PCIBus *typhoon_init(MemoryRegion *, qemu_irq *, qemu_irq *, AlphaCPU *[4],
1414
pci_map_irq_fn, uint8_t devfn_min);
1515

1616
/* alpha_pci.c. */

hw/alpha/dp264.c

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
#include "qemu/error-report.h"
1616
#include "hw/rtc/mc146818rtc.h"
1717
#include "hw/ide/pci.h"
18-
#include "hw/timer/i8254.h"
1918
#include "hw/isa/superio.h"
20-
#include "hw/dma/i8257.h"
2119
#include "net/net.h"
2220
#include "qemu/cutils.h"
2321
#include "qemu/datadir.h"
@@ -58,8 +56,10 @@ static void clipper_init(MachineState *machine)
5856
AlphaCPU *cpus[4];
5957
PCIBus *pci_bus;
6058
PCIDevice *pci_dev;
59+
DeviceState *i82378_dev;
6160
ISABus *isa_bus;
6261
qemu_irq rtc_irq;
62+
qemu_irq isa_irq;
6363
long size, i;
6464
char *palcode_filename;
6565
uint64_t palcode_entry;
@@ -90,14 +90,39 @@ static void clipper_init(MachineState *machine)
9090
* Init the chipset. Because we're using CLIPPER IRQ mappings,
9191
* the minimum PCI device IdSel is 1.
9292
*/
93-
pci_bus = typhoon_init(machine->ram, &isa_bus, &rtc_irq, cpus,
93+
pci_bus = typhoon_init(machine->ram, &isa_irq, &rtc_irq, cpus,
9494
clipper_pci_map_irq, PCI_DEVFN(1, 0));
9595

96+
/*
97+
* Init the PCI -> ISA bridge.
98+
*
99+
* Technically, PCI-based Alphas shipped with one of three different
100+
* PCI-ISA bridges:
101+
*
102+
* - Intel i82378 SIO
103+
* - Cypress CY82c693UB
104+
* - ALI M1533
105+
*
106+
* (An Intel i82375 PCI-EISA bridge was also used on some models.)
107+
*
108+
* For simplicity, we model an i82378 here, even though it wouldn't
109+
* have been on any Tsunami/Typhoon systems; it's close enough, and
110+
* we don't want to deal with modelling the CY82c693UB (which has
111+
* incompatible edge/level control registers, plus other peripherals
112+
* like IDE and USB) or the M1533 (which also has IDE and USB).
113+
*
114+
* Importantly, we need to provide a PCI device node for it, otherwise
115+
* some operating systems won't notice there's an ISA bus to configure.
116+
*/
117+
i82378_dev = DEVICE(pci_create_simple(pci_bus, PCI_DEVFN(7, 0), "i82378"));
118+
isa_bus = ISA_BUS(qdev_get_child_bus(i82378_dev, "isa.0"));
119+
120+
/* Connect the ISA PIC to the Typhoon IRQ used for ISA interrupts. */
121+
qdev_connect_gpio_out(i82378_dev, 0, isa_irq);
122+
96123
/* Since we have an SRM-compatible PALcode, use the SRM epoch. */
97124
mc146818_rtc_init(isa_bus, 1900, rtc_irq);
98125

99-
i8254_pit_init(isa_bus, 0x40, 0, NULL);
100-
101126
/* VGA setup. Don't bother loading the bios. */
102127
pci_vga_init(pci_bus);
103128

@@ -106,9 +131,6 @@ static void clipper_init(MachineState *machine)
106131
pci_nic_init_nofail(&nd_table[i], pci_bus, "e1000", NULL);
107132
}
108133

109-
/* 2 82C37 (dma) */
110-
isa_create_simple(isa_bus, "i82374");
111-
112134
/* Super I/O */
113135
isa_create_simple(isa_bus, TYPE_SMC37C669_SUPERIO);
114136

hw/alpha/typhoon.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -814,9 +814,9 @@ static void typhoon_alarm_timer(void *opaque)
814814
cpu_interrupt(CPU(s->cchip.cpu[cpu]), CPU_INTERRUPT_TIMER);
815815
}
816816

817-
PCIBus *typhoon_init(MemoryRegion *ram, ISABus **isa_bus, qemu_irq *p_rtc_irq,
818-
AlphaCPU *cpus[4], pci_map_irq_fn sys_map_irq,
819-
uint8_t devfn_min)
817+
PCIBus *typhoon_init(MemoryRegion *ram, qemu_irq *p_isa_irq,
818+
qemu_irq *p_rtc_irq, AlphaCPU *cpus[4],
819+
pci_map_irq_fn sys_map_irq, uint8_t devfn_min)
820820
{
821821
MemoryRegion *addr_space = get_system_memory();
822822
DeviceState *dev;
@@ -844,6 +844,7 @@ PCIBus *typhoon_init(MemoryRegion *ram, ISABus **isa_bus, qemu_irq *p_rtc_irq,
844844
}
845845
}
846846

847+
*p_isa_irq = qemu_allocate_irq(typhoon_set_isa_irq, s, 0);
847848
*p_rtc_irq = qemu_allocate_irq(typhoon_set_timer_irq, s, 0);
848849

849850
/* Main memory region, 0x00.0000.0000. Real hardware supports 32GB,
@@ -919,18 +920,6 @@ PCIBus *typhoon_init(MemoryRegion *ram, ISABus **isa_bus, qemu_irq *p_rtc_irq,
919920
/* Pchip1 PCI I/O, 0x802.FC00.0000, 32MB. */
920921
/* Pchip1 PCI configuration, 0x802.FE00.0000, 16MB. */
921922

922-
/* Init the ISA bus. */
923-
/* ??? Technically there should be a cy82c693ub pci-isa bridge. */
924-
{
925-
qemu_irq *isa_irqs;
926-
927-
*isa_bus = isa_bus_new(NULL, get_system_memory(), &s->pchip.reg_io,
928-
&error_abort);
929-
isa_irqs = i8259_init(*isa_bus,
930-
qemu_allocate_irq(typhoon_set_isa_irq, s, 0));
931-
isa_bus_irqs(*isa_bus, isa_irqs);
932-
}
933-
934923
return b;
935924
}
936925

0 commit comments

Comments
 (0)