[PATCH 11/20] kvm/ppc/mpic: remove some obviously unneeded code

2013-04-26 Thread Alexander Graf
From: Scott Wood scottw...@freescale.com

Remove some parts of the code that are obviously QEMU or Raven specific
before fixing style issues, to reduce the style issues that need to be
fixed.

Signed-off-by: Scott Wood scottw...@freescale.com
Signed-off-by: Alexander Graf ag...@suse.de
---
 arch/powerpc/kvm/mpic.c |  344 ---
 1 files changed, 0 insertions(+), 344 deletions(-)

diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
index 57655b9..d6d70a4 100644
--- a/arch/powerpc/kvm/mpic.c
+++ b/arch/powerpc/kvm/mpic.c
@@ -22,39 +22,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-/*
- *
- * Based on OpenPic implementations:
- * - Intel GW80314 I/O companion chip developer's manual
- * - Motorola MPC8245  MPC8540 user manuals.
- * - Motorola MCP750 (aka Raven) programmer manual.
- * - Motorola Harrier programmer manuel
- *
- * Serial interrupts, as implemented in Raven chipset are not supported yet.
- *
- */
-#include hw.h
-#include ppc/mac.h
-#include pci/pci.h
-#include openpic.h
-#include sysbus.h
-#include pci/msi.h
-#include qemu/bitops.h
-#include ppc.h
-
-//#define DEBUG_OPENPIC
-
-#ifdef DEBUG_OPENPIC
-static const int debug_openpic = 1;
-#else
-static const int debug_openpic = 0;
-#endif
-
-#define DPRINTF(fmt, ...) do { \
-if (debug_openpic) { \
-printf(fmt , ## __VA_ARGS__); \
-} \
-} while (0)
 
 #define MAX_CPU 32
 #define MAX_SRC 256
@@ -82,21 +49,6 @@ static const int debug_openpic = 0;
 #define OPENPIC_CPU_REG_START0x2
 #define OPENPIC_CPU_REG_SIZE 0x100 + ((MAX_CPU - 1) * 0x1000)
 
-/* Raven */
-#define RAVEN_MAX_CPU  2
-#define RAVEN_MAX_EXT 48
-#define RAVEN_MAX_IRQ 64
-#define RAVEN_MAX_TMR  MAX_TMR
-#define RAVEN_MAX_IPI  MAX_IPI
-
-/* Interrupt definitions */
-#define RAVEN_FE_IRQ (RAVEN_MAX_EXT)   /* Internal functional IRQ */
-#define RAVEN_ERR_IRQ(RAVEN_MAX_EXT + 1)   /* Error IRQ */
-#define RAVEN_TMR_IRQ(RAVEN_MAX_EXT + 2)   /* First timer IRQ */
-#define RAVEN_IPI_IRQ(RAVEN_TMR_IRQ + RAVEN_MAX_TMR)   /* First IPI 
IRQ */
-/* First doorbell IRQ */
-#define RAVEN_DBL_IRQ(RAVEN_IPI_IRQ + (RAVEN_MAX_CPU * RAVEN_MAX_IPI))
-
 typedef struct FslMpicInfo {
int max_ext;
 } FslMpicInfo;
@@ -138,44 +90,6 @@ static FslMpicInfo fsl_mpic_42 = {
 #define ILR_INTTGT_CINT   0x01 /* critical */
 #define ILR_INTTGT_MCP0x02 /* machine check */
 
-/* The currently supported INTTGT values happen to be the same as QEMU's
- * openpic output codes, but don't depend on this.  The output codes
- * could change (unlikely, but...) or support could be added for
- * more INTTGT values.
- */
-static const int inttgt_output[][2] = {
-   {ILR_INTTGT_INT, OPENPIC_OUTPUT_INT},
-   {ILR_INTTGT_CINT, OPENPIC_OUTPUT_CINT},
-   {ILR_INTTGT_MCP, OPENPIC_OUTPUT_MCK},
-};
-
-static int inttgt_to_output(int inttgt)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(inttgt_output); i++) {
-   if (inttgt_output[i][0] == inttgt) {
-   return inttgt_output[i][1];
-   }
-   }
-
-   fprintf(stderr, %s: unsupported inttgt %d\n, __func__, inttgt);
-   return OPENPIC_OUTPUT_INT;
-}
-
-static int output_to_inttgt(int output)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(inttgt_output); i++) {
-   if (inttgt_output[i][1] == output) {
-   return inttgt_output[i][0];
-   }
-   }
-
-   abort();
-}
-
 #define MSIIR_OFFSET   0x140
 #define MSIIR_SRS_SHIFT29
 #define MSIIR_SRS_MASK (0x7  MSIIR_SRS_SHIFT)
@@ -1265,228 +1179,36 @@ static uint64_t openpic_cpu_read(void *opaque, hwaddr 
addr, unsigned len)
return openpic_cpu_read_internal(opaque, addr, (addr  0x1f000)  12);
 }
 
-static const MemoryRegionOps openpic_glb_ops_le = {
-   .write = openpic_gbl_write,
-   .read = openpic_gbl_read,
-   .endianness = DEVICE_LITTLE_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-.max_access_size = 4,
-},
-};
-
 static const MemoryRegionOps openpic_glb_ops_be = {
.write = openpic_gbl_write,
.read = openpic_gbl_read,
-   .endianness = DEVICE_BIG_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-.max_access_size = 4,
-},
-};
-
-static const MemoryRegionOps openpic_tmr_ops_le = {
-   .write = openpic_tmr_write,
-   .read = openpic_tmr_read,
-   .endianness = DEVICE_LITTLE_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-.max_access_size = 4,
-},
 };
 
 static const MemoryRegionOps openpic_tmr_ops_be = {
.write = openpic_tmr_write,
.read = openpic_tmr_read,
-   .endianness = DEVICE_BIG_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-

[PATCH 11/20] kvm/ppc/mpic: remove some obviously unneeded code

2013-04-26 Thread Alexander Graf
From: Scott Wood scottw...@freescale.com

Remove some parts of the code that are obviously QEMU or Raven specific
before fixing style issues, to reduce the style issues that need to be
fixed.

Signed-off-by: Scott Wood scottw...@freescale.com
Signed-off-by: Alexander Graf ag...@suse.de
---
 arch/powerpc/kvm/mpic.c |  344 ---
 1 files changed, 0 insertions(+), 344 deletions(-)

diff --git a/arch/powerpc/kvm/mpic.c b/arch/powerpc/kvm/mpic.c
index 57655b9..d6d70a4 100644
--- a/arch/powerpc/kvm/mpic.c
+++ b/arch/powerpc/kvm/mpic.c
@@ -22,39 +22,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-/*
- *
- * Based on OpenPic implementations:
- * - Intel GW80314 I/O companion chip developer's manual
- * - Motorola MPC8245  MPC8540 user manuals.
- * - Motorola MCP750 (aka Raven) programmer manual.
- * - Motorola Harrier programmer manuel
- *
- * Serial interrupts, as implemented in Raven chipset are not supported yet.
- *
- */
-#include hw.h
-#include ppc/mac.h
-#include pci/pci.h
-#include openpic.h
-#include sysbus.h
-#include pci/msi.h
-#include qemu/bitops.h
-#include ppc.h
-
-//#define DEBUG_OPENPIC
-
-#ifdef DEBUG_OPENPIC
-static const int debug_openpic = 1;
-#else
-static const int debug_openpic = 0;
-#endif
-
-#define DPRINTF(fmt, ...) do { \
-if (debug_openpic) { \
-printf(fmt , ## __VA_ARGS__); \
-} \
-} while (0)
 
 #define MAX_CPU 32
 #define MAX_SRC 256
@@ -82,21 +49,6 @@ static const int debug_openpic = 0;
 #define OPENPIC_CPU_REG_START0x2
 #define OPENPIC_CPU_REG_SIZE 0x100 + ((MAX_CPU - 1) * 0x1000)
 
-/* Raven */
-#define RAVEN_MAX_CPU  2
-#define RAVEN_MAX_EXT 48
-#define RAVEN_MAX_IRQ 64
-#define RAVEN_MAX_TMR  MAX_TMR
-#define RAVEN_MAX_IPI  MAX_IPI
-
-/* Interrupt definitions */
-#define RAVEN_FE_IRQ (RAVEN_MAX_EXT)   /* Internal functional IRQ */
-#define RAVEN_ERR_IRQ(RAVEN_MAX_EXT + 1)   /* Error IRQ */
-#define RAVEN_TMR_IRQ(RAVEN_MAX_EXT + 2)   /* First timer IRQ */
-#define RAVEN_IPI_IRQ(RAVEN_TMR_IRQ + RAVEN_MAX_TMR)   /* First IPI 
IRQ */
-/* First doorbell IRQ */
-#define RAVEN_DBL_IRQ(RAVEN_IPI_IRQ + (RAVEN_MAX_CPU * RAVEN_MAX_IPI))
-
 typedef struct FslMpicInfo {
int max_ext;
 } FslMpicInfo;
@@ -138,44 +90,6 @@ static FslMpicInfo fsl_mpic_42 = {
 #define ILR_INTTGT_CINT   0x01 /* critical */
 #define ILR_INTTGT_MCP0x02 /* machine check */
 
-/* The currently supported INTTGT values happen to be the same as QEMU's
- * openpic output codes, but don't depend on this.  The output codes
- * could change (unlikely, but...) or support could be added for
- * more INTTGT values.
- */
-static const int inttgt_output[][2] = {
-   {ILR_INTTGT_INT, OPENPIC_OUTPUT_INT},
-   {ILR_INTTGT_CINT, OPENPIC_OUTPUT_CINT},
-   {ILR_INTTGT_MCP, OPENPIC_OUTPUT_MCK},
-};
-
-static int inttgt_to_output(int inttgt)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(inttgt_output); i++) {
-   if (inttgt_output[i][0] == inttgt) {
-   return inttgt_output[i][1];
-   }
-   }
-
-   fprintf(stderr, %s: unsupported inttgt %d\n, __func__, inttgt);
-   return OPENPIC_OUTPUT_INT;
-}
-
-static int output_to_inttgt(int output)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(inttgt_output); i++) {
-   if (inttgt_output[i][1] == output) {
-   return inttgt_output[i][0];
-   }
-   }
-
-   abort();
-}
-
 #define MSIIR_OFFSET   0x140
 #define MSIIR_SRS_SHIFT29
 #define MSIIR_SRS_MASK (0x7  MSIIR_SRS_SHIFT)
@@ -1265,228 +1179,36 @@ static uint64_t openpic_cpu_read(void *opaque, hwaddr 
addr, unsigned len)
return openpic_cpu_read_internal(opaque, addr, (addr  0x1f000)  12);
 }
 
-static const MemoryRegionOps openpic_glb_ops_le = {
-   .write = openpic_gbl_write,
-   .read = openpic_gbl_read,
-   .endianness = DEVICE_LITTLE_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-.max_access_size = 4,
-},
-};
-
 static const MemoryRegionOps openpic_glb_ops_be = {
.write = openpic_gbl_write,
.read = openpic_gbl_read,
-   .endianness = DEVICE_BIG_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-.max_access_size = 4,
-},
-};
-
-static const MemoryRegionOps openpic_tmr_ops_le = {
-   .write = openpic_tmr_write,
-   .read = openpic_tmr_read,
-   .endianness = DEVICE_LITTLE_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-.max_access_size = 4,
-},
 };
 
 static const MemoryRegionOps openpic_tmr_ops_be = {
.write = openpic_tmr_write,
.read = openpic_tmr_read,
-   .endianness = DEVICE_BIG_ENDIAN,
-   .impl = {
-.min_access_size = 4,
-