]> Git Repo - qemu.git/blobdiff - hw/ppc.c
KVM: Coalesced MMIO support
[qemu.git] / hw / ppc.c
index 91451015404734fc4f1d34b1ba44f0f9a173bbb5..60d6e86cf015e1b5010f573a316f56d289d133cf 100644 (file)
--- a/hw/ppc.c
+++ b/hw/ppc.c
 #include "qemu-timer.h"
 #include "sysemu.h"
 #include "nvram.h"
+#include "qemu-log.h"
 
 //#define PPC_DEBUG_IRQ
 //#define PPC_DEBUG_TB
 
-extern FILE *logfile;
-extern int loglevel;
-
 static void cpu_ppc_tb_stop (CPUState *env);
 static void cpu_ppc_tb_start (CPUState *env);
 
@@ -48,8 +46,8 @@ static void ppc_set_irq (CPUState *env, int n_IRQ, int level)
     }
 #if defined(PPC_DEBUG_IRQ)
     if (loglevel & CPU_LOG_INT) {
-        fprintf(logfile, "%s: %p n_IRQ %d level %d => pending %08x req %08x\n",
-                __func__, env, n_IRQ, level,
+        fprintf(logfile, "%s: %p n_IRQ %d level %d => pending %08" PRIx32
+                "req %08x\n", __func__, env, n_IRQ, level,
                 env->pending_interrupts, env->interrupt_request);
     }
 #endif
@@ -457,7 +455,7 @@ uint32_t cpu_ppc_load_tbl (CPUState *env)
     tb = cpu_ppc_get_tb(tb_env, qemu_get_clock(vm_clock), tb_env->tb_offset);
 #if defined(PPC_DEBUG_TB)
     if (loglevel != 0) {
-        fprintf(logfile, "%s: tb=0x%016lx\n", __func__, tb);
+        fprintf(logfile, "%s: tb %016" PRIx64 "\n", __func__, tb);
     }
 #endif
 
@@ -472,7 +470,7 @@ static always_inline uint32_t _cpu_ppc_load_tbu (CPUState *env)
     tb = cpu_ppc_get_tb(tb_env, qemu_get_clock(vm_clock), tb_env->tb_offset);
 #if defined(PPC_DEBUG_TB)
     if (loglevel != 0) {
-        fprintf(logfile, "%s: tb=0x%016lx\n", __func__, tb);
+        fprintf(logfile, "%s: tb %016" PRIx64 "\n", __func__, tb);
     }
 #endif
 
@@ -491,8 +489,8 @@ static always_inline void cpu_ppc_store_tb (ppc_tb_t *tb_env, uint64_t vmclk,
     *tb_offsetp = value - muldiv64(vmclk, tb_env->tb_freq, ticks_per_sec);
 #ifdef PPC_DEBUG_TB
     if (loglevel != 0) {
-        fprintf(logfile, "%s: tb=0x%016lx offset=%08lx\n", __func__, value,
-                *tb_offsetp);
+        fprintf(logfile, "%s: tb %016" PRIx64 " offset %08" PRIx64 "\n",
+                __func__, value, *tb_offsetp);
     }
 #endif
 }
@@ -532,7 +530,7 @@ uint32_t cpu_ppc_load_atbl (CPUState *env)
     tb = cpu_ppc_get_tb(tb_env, qemu_get_clock(vm_clock), tb_env->atb_offset);
 #if defined(PPC_DEBUG_TB)
     if (loglevel != 0) {
-        fprintf(logfile, "%s: tb=0x%016lx\n", __func__, tb);
+        fprintf(logfile, "%s: tb %016" PRIx64 "\n", __func__, tb);
     }
 #endif
 
@@ -547,7 +545,7 @@ uint32_t cpu_ppc_load_atbu (CPUState *env)
     tb = cpu_ppc_get_tb(tb_env, qemu_get_clock(vm_clock), tb_env->atb_offset);
 #if defined(PPC_DEBUG_TB)
     if (loglevel != 0) {
-        fprintf(logfile, "%s: tb=0x%016lx\n", __func__, tb);
+        fprintf(logfile, "%s: tb %016" PRIx64 "\n", __func__, tb);
     }
 #endif
 
@@ -602,7 +600,7 @@ static void cpu_ppc_tb_start (CPUState *env)
 {
     ppc_tb_t *tb_env = env->tb_env;
     uint64_t tb, atb, vmclk;
-    
+
     /* If the time base is not frozen, do nothing */
     if (tb_env->tb_freq == 0) {
         vmclk = qemu_get_clock(vm_clock);
@@ -633,7 +631,7 @@ static always_inline uint32_t _cpu_ppc_load_decr (CPUState *env,
         decr = -muldiv64(-diff, tb_env->decr_freq, ticks_per_sec);
 #if defined(PPC_DEBUG_TB)
     if (loglevel != 0) {
-        fprintf(logfile, "%s: 0x%08x\n", __func__, decr);
+        fprintf(logfile, "%s: %08" PRIx32 "\n", __func__, decr);
     }
 #endif
 
@@ -700,7 +698,8 @@ static void __cpu_ppc_store_decr (CPUState *env, uint64_t *nextp,
 
 #ifdef PPC_DEBUG_TB
     if (loglevel != 0) {
-        fprintf(logfile, "%s: 0x%08x => 0x%08x\n", __func__, decr, value);
+        fprintf(logfile, "%s: %08" PRIx32 " => %08" PRIx32 "\n", __func__,
+                decr, value);
     }
 #endif
     now = qemu_get_clock(vm_clock);
@@ -807,10 +806,12 @@ clk_setup_cb cpu_ppc_tb_init (CPUState *env, uint32_t freq)
 }
 
 /* Specific helpers for POWER & PowerPC 601 RTC */
-clk_setup_cb cpu_ppc601_rtc_init (CPUState *env)
+#if 0
+static clk_setup_cb cpu_ppc601_rtc_init (CPUState *env)
 {
     return cpu_ppc_tb_init(env, 7812500);
 }
+#endif
 
 void cpu_ppc601_store_rtcu (CPUState *env, uint32_t value)
 {
@@ -910,7 +911,7 @@ static void start_stop_pit (CPUState *env, ppc_tb_t *tb_env, int is_excp)
     } else {
 #ifdef PPC_DEBUG_TB
         if (loglevel != 0) {
-            fprintf(logfile, "%s: start PIT 0x" REGX "\n",
+            fprintf(logfile, "%s: start PIT %016" PRIx64 "\n",
                     __func__, ppcemb_timer->pit_reload);
         }
 #endif
@@ -1032,7 +1033,7 @@ void store_40x_pit (CPUState *env, target_ulong val)
     ppcemb_timer = tb_env->opaque;
 #ifdef PPC_DEBUG_TB
     if (loglevel != 0) {
-        fprintf(logfile, "%s %p %p\n", __func__, tb_env, ppcemb_timer);
+        fprintf(logfile, "%s val" ADDRX "\n", __func__, val);
     }
 #endif
     ppcemb_timer->pit_reload = val;
@@ -1048,7 +1049,7 @@ void store_booke_tsr (CPUState *env, target_ulong val)
 {
 #ifdef PPC_DEBUG_TB
     if (loglevel != 0) {
-        fprintf(logfile, "%s: val=" ADDRX "\n", __func__, val);
+        fprintf(logfile, "%s: val " ADDRX "\n", __func__, val);
     }
 #endif
     env->spr[SPR_40x_TSR] &= ~(val & 0xFC000000);
@@ -1063,7 +1064,7 @@ void store_booke_tcr (CPUState *env, target_ulong val)
     tb_env = env->tb_env;
 #ifdef PPC_DEBUG_TB
     if (loglevel != 0) {
-        fprintf(logfile, "%s: val=" ADDRX "\n", __func__, val);
+        fprintf(logfile, "%s: val " ADDRX "\n", __func__, val);
     }
 #endif
     env->spr[SPR_40x_TCR] = val & 0xFFC00000;
@@ -1078,7 +1079,8 @@ static void ppc_emb_set_tb_clk (void *opaque, uint32_t freq)
 
 #ifdef PPC_DEBUG_TB
     if (loglevel != 0) {
-        fprintf(logfile, "%s set new frequency to %u\n", __func__, freq);
+        fprintf(logfile, "%s set new frequency to %" PRIu32 "\n", __func__,
+                freq);
     }
 #endif
     tb_env->tb_freq = freq;
@@ -1102,8 +1104,7 @@ clk_setup_cb ppc_emb_timers_init (CPUState *env, uint32_t freq)
     tb_env->opaque = ppcemb_timer;
 #ifdef PPC_DEBUG_TB
     if (loglevel != 0) {
-        fprintf(logfile, "%s %p %p %p\n", __func__, tb_env, ppcemb_timer,
-                &ppc_emb_set_tb_clk);
+        fprintf(logfile, "%s freq %" PRIu32 "\n", __func__, freq);
     }
 #endif
     if (ppcemb_timer != NULL) {
@@ -1239,7 +1240,7 @@ void PPC_debug_write (void *opaque, uint32_t addr, uint32_t val)
         fflush(stdout);
         break;
     case 2:
-        printf("Set loglevel to %04x\n", val);
+        printf("Set loglevel to %04" PRIx32 "\n", val);
         cpu_set_log(val | 0x100);
         break;
     }
@@ -1304,7 +1305,7 @@ uint32_t NVRAM_get_lword (nvram_t *nvram, uint32_t addr)
 }
 
 void NVRAM_set_string (nvram_t *nvram, uint32_t addr,
-                       const unsigned char *str, uint32_t max)
+                       const char *str, uint32_t max)
 {
     int i;
 
@@ -1344,7 +1345,7 @@ static uint16_t NVRAM_crc_update (uint16_t prev, uint16_t value)
     return tmp;
 }
 
-uint16_t NVRAM_compute_crc (nvram_t *nvram, uint32_t start, uint32_t count)
+static uint16_t NVRAM_compute_crc (nvram_t *nvram, uint32_t start, uint32_t count)
 {
     uint32_t i;
     uint16_t crc = 0xFFFF;
@@ -1365,7 +1366,7 @@ uint16_t NVRAM_compute_crc (nvram_t *nvram, uint32_t start, uint32_t count)
 #define CMDLINE_ADDR 0x017ff000
 
 int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
-                          const unsigned char *arch,
+                          const char *arch,
                           uint32_t RAM_size, int boot_device,
                           uint32_t kernel_image, uint32_t kernel_size,
                           const char *cmdline,
@@ -1386,7 +1387,7 @@ int PPC_NVRAM_set_params (nvram_t *nvram, uint16_t NVRAM_size,
     NVRAM_set_lword(nvram,  0x3C, kernel_size);
     if (cmdline) {
         /* XXX: put the cmdline in NVRAM too ? */
-        strcpy(phys_ram_base + CMDLINE_ADDR, cmdline);
+        strcpy((char *)(phys_ram_base + CMDLINE_ADDR), cmdline);
         NVRAM_set_lword(nvram,  0x40, CMDLINE_ADDR);
         NVRAM_set_lword(nvram,  0x44, strlen(cmdline));
     } else {
This page took 0.032972 seconds and 4 git commands to generate.