2 * QEMU PowerPC 4xx emulation shared definitions
4 * Copyright (c) 2007 Jocelyn Mayer
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 #include "hw/ppc/ppc.h"
29 #include "exec/memory.h"
30 #include "hw/sysbus.h"
32 #define TYPE_PPC4xx_PCI_HOST_BRIDGE "ppc4xx-pcihost"
37 #define TYPE_PPC4xx_DCR_DEVICE "ppc4xx-dcr-device"
38 OBJECT_DECLARE_SIMPLE_TYPE(Ppc4xxDcrDeviceState
, PPC4xx_DCR_DEVICE
);
39 struct Ppc4xxDcrDeviceState
{
40 SysBusDevice parent_obj
;
45 void ppc4xx_dcr_register(Ppc4xxDcrDeviceState
*dev
, int dcrn
, void *opaque
,
46 dcr_read_cb dcr_read
, dcr_write_cb dcr_write
);
47 bool ppc4xx_dcr_realize(Ppc4xxDcrDeviceState
*dev
, PowerPCCPU
*cpu
,
50 /* Memory Access Layer (MAL) */
51 #define TYPE_PPC4xx_MAL "ppc4xx-mal"
52 OBJECT_DECLARE_SIMPLE_TYPE(Ppc4xxMalState
, PPC4xx_MAL
);
53 struct Ppc4xxMalState
{
54 Ppc4xxDcrDeviceState parent_obj
;
75 /* Peripheral local bus arbitrer */
76 #define TYPE_PPC4xx_PLB "ppc4xx-plb"
77 OBJECT_DECLARE_SIMPLE_TYPE(Ppc4xxPlbState
, PPC4xx_PLB
);
78 struct Ppc4xxPlbState
{
79 Ppc4xxDcrDeviceState parent_obj
;
86 /* Peripheral controller */
87 #define TYPE_PPC4xx_EBC "ppc4xx-ebc"
88 OBJECT_DECLARE_SIMPLE_TYPE(Ppc4xxEbcState
, PPC4xx_EBC
);
89 struct Ppc4xxEbcState
{
90 Ppc4xxDcrDeviceState parent_obj
;
101 /* SDRAM DDR controller */
104 MemoryRegion container
; /* used for clipping */
110 #define SDR0_DDR0_DDRM_ENCODE(n) ((((unsigned long)(n)) & 0x03) << 29)
111 #define SDR0_DDR0_DDRM_DDR1 0x20000000
112 #define SDR0_DDR0_DDRM_DDR2 0x40000000
114 #define TYPE_PPC4xx_SDRAM_DDR "ppc4xx-sdram-ddr"
115 OBJECT_DECLARE_SIMPLE_TYPE(Ppc4xxSdramDdrState
, PPC4xx_SDRAM_DDR
);
116 struct Ppc4xxSdramDdrState
{
117 Ppc4xxDcrDeviceState parent_obj
;
119 MemoryRegion
*dram_mr
;
120 uint32_t nbanks
; /* Banks to use from 4, e.g. when board has less slots */
121 Ppc4xxSdramBank bank
[4];
137 void ppc4xx_sdram_ddr_enable(Ppc4xxSdramDdrState
*s
);
139 /* SDRAM DDR2 controller */
140 #define TYPE_PPC4xx_SDRAM_DDR2 "ppc4xx-sdram-ddr2"
141 OBJECT_DECLARE_SIMPLE_TYPE(Ppc4xxSdramDdr2State
, PPC4xx_SDRAM_DDR2
);
142 struct Ppc4xxSdramDdr2State
{
143 Ppc4xxDcrDeviceState parent_obj
;
145 MemoryRegion
*dram_mr
;
146 uint32_t nbanks
; /* Banks to use from 4, e.g. when board has less slots */
147 Ppc4xxSdramBank bank
[4];
153 void ppc4xx_sdram_ddr2_enable(Ppc4xxSdramDdr2State
*s
);
155 #endif /* PPC4XX_H */