* [Qemu-devel] [PATCH v2 3/4] ppc4xx: Add more PLB registers
2017-09-16 14:02 [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation BALATON Zoltan
@ 2017-09-16 14:02 ` BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 4/4] ppc: Add 460EX embedded CPU BALATON Zoltan
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: BALATON Zoltan @ 2017-09-16 14:02 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Alexander Graf, David Gibson, Francois Revol
These registers are present in 440 SoCs (and maybe in others too) and
U-Boot accesses them when printing register info. We don't emulate
these but add them to avoid crashing when they are read or written.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
v2: No change, discussed in: http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00385.html
hw/ppc/ppc405_uc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/ppc405_uc.c b/hw/ppc/ppc405_uc.c
index e621d0a..8e58065 100644
--- a/hw/ppc/ppc405_uc.c
+++ b/hw/ppc/ppc405_uc.c
@@ -105,9 +105,12 @@ ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, ppc4xx_bd_info_t *bd,
/*****************************************************************************/
/* Peripheral local bus arbitrer */
enum {
- PLB0_BESR = 0x084,
- PLB0_BEAR = 0x086,
- PLB0_ACR = 0x087,
+ PLB3A0_ACR = 0x077,
+ PLB4A0_ACR = 0x081,
+ PLB0_BESR = 0x084,
+ PLB0_BEAR = 0x086,
+ PLB0_ACR = 0x087,
+ PLB4A1_ACR = 0x089,
};
typedef struct ppc4xx_plb_t ppc4xx_plb_t;
@@ -179,9 +182,12 @@ void ppc4xx_plb_init(CPUPPCState *env)
ppc4xx_plb_t *plb;
plb = g_malloc0(sizeof(ppc4xx_plb_t));
+ ppc_dcr_register(env, PLB3A0_ACR, plb, &dcr_read_plb, &dcr_write_plb);
+ ppc_dcr_register(env, PLB4A0_ACR, plb, &dcr_read_plb, &dcr_write_plb);
ppc_dcr_register(env, PLB0_ACR, plb, &dcr_read_plb, &dcr_write_plb);
ppc_dcr_register(env, PLB0_BEAR, plb, &dcr_read_plb, &dcr_write_plb);
ppc_dcr_register(env, PLB0_BESR, plb, &dcr_read_plb, &dcr_write_plb);
+ ppc_dcr_register(env, PLB4A1_ACR, plb, &dcr_read_plb, &dcr_write_plb);
qemu_register_reset(ppc4xx_plb_reset, plb);
}
--
2.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 4/4] ppc: Add 460EX embedded CPU
2017-09-16 14:02 [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 3/4] ppc4xx: Add more PLB registers BALATON Zoltan
@ 2017-09-16 14:02 ` BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 2/4] ehci: Add ppc4xx-ehci for the USB 2.0 controller in embedded PPC SoCs BALATON Zoltan
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: BALATON Zoltan @ 2017-09-16 14:02 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Alexander Graf, David Gibson, Francois Revol
Despite its name it is a 440 core CPU
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
---
v2: Rebased to latest changes on master
target/ppc/cpu-models.c | 3 +++
target/ppc/cpu-models.h | 1 +
target/ppc/translate_init.c | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+)
diff --git a/target/ppc/cpu-models.c b/target/ppc/cpu-models.c
index 9626d6b..9d45702 100644
--- a/target/ppc/cpu-models.c
+++ b/target/ppc/cpu-models.c
@@ -167,6 +167,8 @@
"PowerPC 440 EPb")
POWERPC_DEF("440epx", CPU_POWERPC_440EPX, 440EP,
"PowerPC 440 EPX")
+ POWERPC_DEF("460exb", CPU_POWERPC_460EXb, 460EX,
+ "PowerPC 460 EXb")
#if defined(TODO_USER_ONLY)
POWERPC_DEF("440gpb", CPU_POWERPC_440GPb, 440GP,
"PowerPC 440 GPb")
@@ -786,6 +788,7 @@ PowerPCCPUAlias ppc_cpu_aliases[] = {
{ "x2vp50", "x2vp20" },
{ "440ep", "440epb" },
+ { "460ex", "460exb" },
#if defined(TODO_USER_ONLY)
{ "440gp", "440gpc" },
{ "440gr", "440gra" },
diff --git a/target/ppc/cpu-models.h b/target/ppc/cpu-models.h
index df31d7f..ed64005 100644
--- a/target/ppc/cpu-models.h
+++ b/target/ppc/cpu-models.h
@@ -240,6 +240,7 @@ enum {
CPU_POWERPC_440SP = 0x53221850,
CPU_POWERPC_440SP2 = 0x53221891,
CPU_POWERPC_440SPE = 0x53421890,
+ CPU_POWERPC_460EXb = 0x130218A4, /* called 460 but 440 core */
/* PowerPC 460 family */
#if 0
/* Generic PowerPC 464 */
diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c
index c827d1e..f36decd 100644
--- a/target/ppc/translate_init.c
+++ b/target/ppc/translate_init.c
@@ -3833,6 +3833,44 @@ POWERPC_FAMILY(440EP)(ObjectClass *oc, void *data)
POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
}
+POWERPC_FAMILY(460EX)(ObjectClass *oc, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(oc);
+ PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
+
+ dc->desc = "PowerPC 460 EX";
+ pcc->init_proc = init_proc_440EP;
+ pcc->check_pow = check_pow_nocheck;
+ pcc->insns_flags = PPC_INSNS_BASE | PPC_STRING |
+ PPC_FLOAT | PPC_FLOAT_FRES | PPC_FLOAT_FSEL |
+ PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
+ PPC_FLOAT_STFIWX |
+ PPC_DCR | PPC_DCRX | PPC_WRTEE | PPC_RFMCI |
+ PPC_CACHE | PPC_CACHE_ICBI |
+ PPC_CACHE_DCBZ | PPC_CACHE_DCBA |
+ PPC_MEM_TLBSYNC | PPC_MFTB |
+ PPC_BOOKE | PPC_4xx_COMMON | PPC_405_MAC |
+ PPC_440_SPEC;
+ pcc->msr_mask = (1ull << MSR_POW) |
+ (1ull << MSR_CE) |
+ (1ull << MSR_EE) |
+ (1ull << MSR_PR) |
+ (1ull << MSR_FP) |
+ (1ull << MSR_ME) |
+ (1ull << MSR_FE0) |
+ (1ull << MSR_DWE) |
+ (1ull << MSR_DE) |
+ (1ull << MSR_FE1) |
+ (1ull << MSR_IR) |
+ (1ull << MSR_DR);
+ pcc->mmu_model = POWERPC_MMU_BOOKE;
+ pcc->excp_model = POWERPC_EXCP_BOOKE;
+ pcc->bus_model = PPC_FLAGS_INPUT_BookE;
+ pcc->bfd_mach = bfd_mach_ppc_403;
+ pcc->flags = POWERPC_FLAG_CE | POWERPC_FLAG_DWE |
+ POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK;
+}
+
static void init_proc_440GP(CPUPPCState *env)
{
/* Time base */
--
2.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation
@ 2017-09-16 14:02 BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 3/4] ppc4xx: Add more PLB registers BALATON Zoltan
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: BALATON Zoltan @ 2017-09-16 14:02 UTC (permalink / raw)
To: qemu-devel, qemu-ppc; +Cc: Alexander Graf, David Gibson, Francois Revol
Resending those patches that were reviewed and did not need any
changes or only rebasing to latest master so these could go in now.
I'll get back to the other patches that need more changes later.
BALATON Zoltan (4):
ohci: Allow sysbus version to be used as a companion
ehci: Add ppc4xx-ehci for the USB 2.0 controller in embedded PPC SoCs
ppc4xx: Add more PLB registers
ppc: Add 460EX embedded CPU
hw/ppc/ppc405_uc.c | 12 +++++++++---
hw/usb/hcd-ehci-sysbus.c | 25 +++++++++++++++++++++++++
hw/usb/hcd-ehci.h | 1 +
hw/usb/hcd-ohci.c | 15 ++++++++++++---
target/ppc/cpu-models.c | 3 +++
target/ppc/cpu-models.h | 1 +
target/ppc/translate_init.c | 38 ++++++++++++++++++++++++++++++++++++++
7 files changed, 89 insertions(+), 6 deletions(-)
--
2.7.6
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 2/4] ehci: Add ppc4xx-ehci for the USB 2.0 controller in embedded PPC SoCs
2017-09-16 14:02 [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 3/4] ppc4xx: Add more PLB registers BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 4/4] ppc: Add 460EX embedded CPU BALATON Zoltan
@ 2017-09-16 14:02 ` BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 1/4] ohci: Allow sysbus version to be used as a companion BALATON Zoltan
2017-09-18 0:26 ` [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation David Gibson
4 siblings, 0 replies; 6+ messages in thread
From: BALATON Zoltan @ 2017-09-16 14:02 UTC (permalink / raw)
To: qemu-devel, qemu-ppc
Cc: Alexander Graf, David Gibson, Francois Revol, Gerd Hoffmann
Some PPC SoCs have an EHCI with OHCI companion USB controller. Add a
new type for this similar to types used for other embedded SoCs.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
---
v2: Added R-b from: http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00345.html
hw/usb/hcd-ehci-sysbus.c | 25 +++++++++++++++++++++++++
hw/usb/hcd-ehci.h | 1 +
2 files changed, 26 insertions(+)
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
index 6c20604..3b83beb 100644
--- a/hw/usb/hcd-ehci-sysbus.c
+++ b/hw/usb/hcd-ehci-sysbus.c
@@ -142,6 +142,30 @@ static const TypeInfo ehci_tegra2_type_info = {
.class_init = ehci_tegra2_class_init,
};
+static void ehci_ppc4xx_init(Object *o)
+{
+ EHCISysBusState *s = SYS_BUS_EHCI(o);
+
+ s->ehci.companion_enable = true;
+}
+
+static void ehci_ppc4xx_class_init(ObjectClass *oc, void *data)
+{
+ SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
+ DeviceClass *dc = DEVICE_CLASS(oc);
+
+ sec->capsbase = 0x0;
+ sec->opregbase = 0x10;
+ set_bit(DEVICE_CATEGORY_USB, dc->categories);
+}
+
+static const TypeInfo ehci_ppc4xx_type_info = {
+ .name = TYPE_PPC4xx_EHCI,
+ .parent = TYPE_SYS_BUS_EHCI,
+ .class_init = ehci_ppc4xx_class_init,
+ .instance_init = ehci_ppc4xx_init,
+};
+
/*
* Faraday FUSBH200 USB 2.0 EHCI
*/
@@ -224,6 +248,7 @@ static void ehci_sysbus_register_types(void)
type_register_static(&ehci_xlnx_type_info);
type_register_static(&ehci_exynos4210_type_info);
type_register_static(&ehci_tegra2_type_info);
+ type_register_static(&ehci_ppc4xx_type_info);
type_register_static(&ehci_fusbh200_type_info);
}
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
index 821f1de..0bc364b 100644
--- a/hw/usb/hcd-ehci.h
+++ b/hw/usb/hcd-ehci.h
@@ -344,6 +344,7 @@ typedef struct EHCIPCIState {
#define TYPE_SYS_BUS_EHCI "sysbus-ehci-usb"
#define TYPE_EXYNOS4210_EHCI "exynos4210-ehci-usb"
#define TYPE_TEGRA2_EHCI "tegra2-ehci-usb"
+#define TYPE_PPC4xx_EHCI "ppc4xx-ehci-usb"
#define TYPE_FUSBH200_EHCI "fusbh200-ehci-usb"
#define SYS_BUS_EHCI(obj) \
--
2.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH v2 1/4] ohci: Allow sysbus version to be used as a companion
2017-09-16 14:02 [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation BALATON Zoltan
` (2 preceding siblings ...)
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 2/4] ehci: Add ppc4xx-ehci for the USB 2.0 controller in embedded PPC SoCs BALATON Zoltan
@ 2017-09-16 14:02 ` BALATON Zoltan
2017-09-18 0:26 ` [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation David Gibson
4 siblings, 0 replies; 6+ messages in thread
From: BALATON Zoltan @ 2017-09-16 14:02 UTC (permalink / raw)
To: qemu-devel, qemu-ppc
Cc: Alexander Graf, David Gibson, Francois Revol, Gerd Hoffmann
Some PPC SoCs have an EHCI with OHCI companion USB controller. To
emulate this allow the sysbus version of OHCI to be used as a companion.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
---
v2: Added R-b from http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00346.html
hw/usb/hcd-ohci.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c
index 267982e..17beedd 100644
--- a/hw/usb/hcd-ohci.c
+++ b/hw/usb/hcd-ohci.c
@@ -1999,7 +1999,9 @@ typedef struct {
/*< public >*/
OHCIState ohci;
+ char *masterbus;
uint32_t num_ports;
+ uint32_t firstport;
dma_addr_t dma_offset;
} OHCISysBusState;
@@ -2007,10 +2009,15 @@ static void ohci_realize_pxa(DeviceState *dev, Error **errp)
{
OHCISysBusState *s = SYSBUS_OHCI(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+ Error *err = NULL;
- /* Cannot fail as we pass NULL for masterbus */
- usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset, NULL, 0,
- &address_space_memory, &error_abort);
+ usb_ohci_init(&s->ohci, dev, s->num_ports, s->dma_offset,
+ s->masterbus, s->firstport,
+ &address_space_memory, &err);
+ if (err) {
+ error_propagate(errp, err);
+ return;
+ }
sysbus_init_irq(sbd, &s->ohci.irq);
sysbus_init_mmio(sbd, &s->ohci.mem);
}
@@ -2142,7 +2149,9 @@ static const TypeInfo ohci_pci_info = {
};
static Property ohci_sysbus_properties[] = {
+ DEFINE_PROP_STRING("masterbus", OHCISysBusState, masterbus),
DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3),
+ DEFINE_PROP_UINT32("firstport", OHCISysBusState, firstport, 0),
DEFINE_PROP_DMAADDR("dma-offset", OHCISysBusState, dma_offset, 0),
DEFINE_PROP_END_OF_LIST(),
};
--
2.7.6
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation
2017-09-16 14:02 [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation BALATON Zoltan
` (3 preceding siblings ...)
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 1/4] ohci: Allow sysbus version to be used as a companion BALATON Zoltan
@ 2017-09-18 0:26 ` David Gibson
4 siblings, 0 replies; 6+ messages in thread
From: David Gibson @ 2017-09-18 0:26 UTC (permalink / raw)
To: BALATON Zoltan; +Cc: qemu-devel, qemu-ppc, Alexander Graf, Francois Revol
[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]
On Sat, Sep 16, 2017 at 04:02:41PM +0200, BALATON Zoltan wrote:
> Resending those patches that were reviewed and did not need any
> changes or only rebasing to latest master so these could go in now.
> I'll get back to the other patches that need more changes later.
Applied to ppc-for-2.11, thanks.
> BALATON Zoltan (4):
> ohci: Allow sysbus version to be used as a companion
> ehci: Add ppc4xx-ehci for the USB 2.0 controller in embedded PPC SoCs
> ppc4xx: Add more PLB registers
> ppc: Add 460EX embedded CPU
>
> hw/ppc/ppc405_uc.c | 12 +++++++++---
> hw/usb/hcd-ehci-sysbus.c | 25 +++++++++++++++++++++++++
> hw/usb/hcd-ehci.h | 1 +
> hw/usb/hcd-ohci.c | 15 ++++++++++++---
> target/ppc/cpu-models.c | 3 +++
> target/ppc/cpu-models.h | 1 +
> target/ppc/translate_init.c | 38 ++++++++++++++++++++++++++++++++++++++
> 7 files changed, 89 insertions(+), 6 deletions(-)
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-09-18 2:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-16 14:02 [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 3/4] ppc4xx: Add more PLB registers BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 4/4] ppc: Add 460EX embedded CPU BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 2/4] ehci: Add ppc4xx-ehci for the USB 2.0 controller in embedded PPC SoCs BALATON Zoltan
2017-09-16 14:02 ` [Qemu-devel] [PATCH v2 1/4] ohci: Allow sysbus version to be used as a companion BALATON Zoltan
2017-09-18 0:26 ` [Qemu-devel] [PATCH v2 0/4] Sam460ex emulation David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).