Commit 4018bae91649e8e38e371dc00cb5ac8f9e40089e

Authored by j_mayer
1 parent 26553115

New PowerPC CPU flag to define the decrementer and time-base source clock.

Use it to properly initialize the clock for the PreP target.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3701 c046a42c-6fe2-441c-8c8c-71466251a162
hw/ppc_prep.c
... ... @@ -564,8 +564,13 @@ static void ppc_prep_init (int ram_size, int vga_ram_size,
564 564 fprintf(stderr, "Unable to find PowerPC CPU definition\n");
565 565 exit(1);
566 566 }
567   - /* Set time-base frequency to 100 Mhz */
568   - cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
  567 + if (env->flags & POWERPC_FLAG_RTC_CLK) {
  568 + /* POWER / PowerPC 601 RTC clock frequency is 7.8125 MHz */
  569 + cpu_ppc_tb_init(env, 7812500UL);
  570 + } else {
  571 + /* Set time-base frequency to 100 Mhz */
  572 + cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);
  573 + }
569 574 qemu_register_reset(&cpu_ppc_reset, env);
570 575 register_savevm("cpu", 0, 3, cpu_save, cpu_load, env);
571 576 envs[i] = env;
... ...
target-ppc/cpu.h
... ... @@ -441,23 +441,27 @@ union ppc_tlb_t {
441 441 #endif
442 442  
443 443 enum {
444   - POWERPC_FLAG_NONE = 0x00000000,
  444 + POWERPC_FLAG_NONE = 0x00000000,
445 445 /* Flag for MSR bit 25 signification (VRE/SPE) */
446   - POWERPC_FLAG_SPE = 0x00000001,
447   - POWERPC_FLAG_VRE = 0x00000002,
  446 + POWERPC_FLAG_SPE = 0x00000001,
  447 + POWERPC_FLAG_VRE = 0x00000002,
448 448 /* Flag for MSR bit 17 signification (TGPR/CE) */
449   - POWERPC_FLAG_TGPR = 0x00000004,
450   - POWERPC_FLAG_CE = 0x00000008,
  449 + POWERPC_FLAG_TGPR = 0x00000004,
  450 + POWERPC_FLAG_CE = 0x00000008,
451 451 /* Flag for MSR bit 10 signification (SE/DWE/UBLE) */
452   - POWERPC_FLAG_SE = 0x00000010,
453   - POWERPC_FLAG_DWE = 0x00000020,
454   - POWERPC_FLAG_UBLE = 0x00000040,
  452 + POWERPC_FLAG_SE = 0x00000010,
  453 + POWERPC_FLAG_DWE = 0x00000020,
  454 + POWERPC_FLAG_UBLE = 0x00000040,
455 455 /* Flag for MSR bit 9 signification (BE/DE) */
456   - POWERPC_FLAG_BE = 0x00000080,
457   - POWERPC_FLAG_DE = 0x00000100,
  456 + POWERPC_FLAG_BE = 0x00000080,
  457 + POWERPC_FLAG_DE = 0x00000100,
458 458 /* Flag for MSR bit 2 signification (PX/PMM) */
459   - POWERPC_FLAG_PX = 0x00000200,
460   - POWERPC_FLAG_PMM = 0x00000400,
  459 + POWERPC_FLAG_PX = 0x00000200,
  460 + POWERPC_FLAG_PMM = 0x00000400,
  461 + /* Flag for special features */
  462 + /* Decrementer clock: RTC clock (POWER, 601) or bus clock */
  463 + POWERPC_FLAG_RTC_CLK = 0x00010000,
  464 + POWERPC_FLAG_BUS_CLK = 0x00020000,
461 465 };
462 466  
463 467 /*****************************************************************************/
... ...
target-ppc/translate_init.c
... ... @@ -3000,7 +3000,8 @@ static int check_pow_hid0 (CPUPPCState *env)
3000 3000 #define POWERPC_EXCP_401 (POWERPC_EXCP_40x)
3001 3001 #define POWERPC_INPUT_401 (PPC_FLAGS_INPUT_401)
3002 3002 #define POWERPC_BFDM_401 (bfd_mach_ppc_403)
3003   -#define POWERPC_FLAG_401 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
  3003 +#define POWERPC_FLAG_401 (POWERPC_FLAG_CE | POWERPC_FLAG_DE | \
  3004 + POWERPC_FLAG_BUS_CLK)
3004 3005 #define check_pow_401 check_pow_nocheck
3005 3006  
3006 3007 static void init_proc_401 (CPUPPCState *env)
... ... @@ -3026,7 +3027,8 @@ static void init_proc_401 (CPUPPCState *env)
3026 3027 #define POWERPC_EXCP_401x2 (POWERPC_EXCP_40x)
3027 3028 #define POWERPC_INPUT_401x2 (PPC_FLAGS_INPUT_401)
3028 3029 #define POWERPC_BFDM_401x2 (bfd_mach_ppc_403)
3029   -#define POWERPC_FLAG_401x2 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
  3030 +#define POWERPC_FLAG_401x2 (POWERPC_FLAG_CE | POWERPC_FLAG_DE | \
  3031 + POWERPC_FLAG_BUS_CLK)
3030 3032 #define check_pow_401x2 check_pow_nocheck
3031 3033  
3032 3034 static void init_proc_401x2 (CPUPPCState *env)
... ... @@ -3059,7 +3061,8 @@ static void init_proc_401x2 (CPUPPCState *env)
3059 3061 #define POWERPC_EXCP_401x3 (POWERPC_EXCP_40x)
3060 3062 #define POWERPC_INPUT_401x3 (PPC_FLAGS_INPUT_401)
3061 3063 #define POWERPC_BFDM_401x3 (bfd_mach_ppc_403)
3062   -#define POWERPC_FLAG_401x3 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
  3064 +#define POWERPC_FLAG_401x3 (POWERPC_FLAG_CE | POWERPC_FLAG_DE | \
  3065 + POWERPC_FLAG_BUS_CLK)
3063 3066 #define check_pow_401x3 check_pow_nocheck
3064 3067  
3065 3068 __attribute__ (( unused ))
... ... @@ -3088,7 +3091,8 @@ static void init_proc_401x3 (CPUPPCState *env)
3088 3091 #define POWERPC_EXCP_IOP480 (POWERPC_EXCP_40x)
3089 3092 #define POWERPC_INPUT_IOP480 (PPC_FLAGS_INPUT_401)
3090 3093 #define POWERPC_BFDM_IOP480 (bfd_mach_ppc_403)
3091   -#define POWERPC_FLAG_IOP480 (POWERPC_FLAG_CE | POWERPC_FLAG_DE)
  3094 +#define POWERPC_FLAG_IOP480 (POWERPC_FLAG_CE | POWERPC_FLAG_DE | \
  3095 + POWERPC_FLAG_BUS_CLK)
3092 3096 #define check_pow_IOP480 check_pow_nocheck
3093 3097  
3094 3098 static void init_proc_IOP480 (CPUPPCState *env)
... ... @@ -3119,7 +3123,8 @@ static void init_proc_IOP480 (CPUPPCState *env)
3119 3123 #define POWERPC_EXCP_403 (POWERPC_EXCP_40x)
3120 3124 #define POWERPC_INPUT_403 (PPC_FLAGS_INPUT_401)
3121 3125 #define POWERPC_BFDM_403 (bfd_mach_ppc_403)
3122   -#define POWERPC_FLAG_403 (POWERPC_FLAG_CE | POWERPC_FLAG_PX)
  3126 +#define POWERPC_FLAG_403 (POWERPC_FLAG_CE | POWERPC_FLAG_PX | \
  3127 + POWERPC_FLAG_BUS_CLK)
3123 3128 #define check_pow_403 check_pow_nocheck
3124 3129  
3125 3130 static void init_proc_403 (CPUPPCState *env)
... ... @@ -3149,7 +3154,8 @@ static void init_proc_403 (CPUPPCState *env)
3149 3154 #define POWERPC_EXCP_403GCX (POWERPC_EXCP_40x)
3150 3155 #define POWERPC_INPUT_403GCX (PPC_FLAGS_INPUT_401)
3151 3156 #define POWERPC_BFDM_403GCX (bfd_mach_ppc_403)
3152   -#define POWERPC_FLAG_403GCX (POWERPC_FLAG_CE | POWERPC_FLAG_PX)
  3157 +#define POWERPC_FLAG_403GCX (POWERPC_FLAG_CE | POWERPC_FLAG_PX | \
  3158 + POWERPC_FLAG_BUS_CLK)
3153 3159 #define check_pow_403GCX check_pow_nocheck
3154 3160  
3155 3161 static void init_proc_403GCX (CPUPPCState *env)
... ... @@ -3196,7 +3202,7 @@ static void init_proc_403GCX (CPUPPCState *env)
3196 3202 #define POWERPC_INPUT_405 (PPC_FLAGS_INPUT_405)
3197 3203 #define POWERPC_BFDM_405 (bfd_mach_ppc_403)
3198 3204 #define POWERPC_FLAG_405 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3199   - POWERPC_FLAG_DE)
  3205 + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
3200 3206 #define check_pow_405 check_pow_nocheck
3201 3207  
3202 3208 static void init_proc_405 (CPUPPCState *env)
... ... @@ -3240,7 +3246,7 @@ static void init_proc_405 (CPUPPCState *env)
3240 3246 #define POWERPC_INPUT_440EP (PPC_FLAGS_INPUT_BookE)
3241 3247 #define POWERPC_BFDM_440EP (bfd_mach_ppc_403)
3242 3248 #define POWERPC_FLAG_440EP (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3243   - POWERPC_FLAG_DE)
  3249 + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
3244 3250 #define check_pow_440EP check_pow_nocheck
3245 3251  
3246 3252 __attribute__ (( unused ))
... ... @@ -3318,7 +3324,7 @@ static void init_proc_440EP (CPUPPCState *env)
3318 3324 #define POWERPC_INPUT_440GP (PPC_FLAGS_INPUT_BookE)
3319 3325 #define POWERPC_BFDM_440GP (bfd_mach_ppc_403)
3320 3326 #define POWERPC_FLAG_440GP (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3321   - POWERPC_FLAG_DE)
  3327 + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
3322 3328 #define check_pow_440GP check_pow_nocheck
3323 3329  
3324 3330 __attribute__ (( unused ))
... ... @@ -3377,7 +3383,7 @@ static void init_proc_440GP (CPUPPCState *env)
3377 3383 #define POWERPC_INPUT_440x4 (PPC_FLAGS_INPUT_BookE)
3378 3384 #define POWERPC_BFDM_440x4 (bfd_mach_ppc_403)
3379 3385 #define POWERPC_FLAG_440x4 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3380   - POWERPC_FLAG_DE)
  3386 + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
3381 3387 #define check_pow_440x4 check_pow_nocheck
3382 3388  
3383 3389 __attribute__ (( unused ))
... ... @@ -3436,7 +3442,7 @@ static void init_proc_440x4 (CPUPPCState *env)
3436 3442 #define POWERPC_INPUT_440x5 (PPC_FLAGS_INPUT_BookE)
3437 3443 #define POWERPC_BFDM_440x5 (bfd_mach_ppc_403)
3438 3444 #define POWERPC_FLAG_440x5 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3439   - POWERPC_FLAG_DE)
  3445 + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
3440 3446 #define check_pow_440x5 check_pow_nocheck
3441 3447  
3442 3448 __attribute__ (( unused ))
... ... @@ -3514,7 +3520,7 @@ static void init_proc_440x5 (CPUPPCState *env)
3514 3520 #define POWERPC_INPUT_460 (PPC_FLAGS_INPUT_BookE)
3515 3521 #define POWERPC_BFDM_460 (bfd_mach_ppc_403)
3516 3522 #define POWERPC_FLAG_460 (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3517   - POWERPC_FLAG_DE)
  3523 + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
3518 3524 #define check_pow_460 check_pow_nocheck
3519 3525  
3520 3526 __attribute__ (( unused ))
... ... @@ -3600,7 +3606,7 @@ static void init_proc_460 (CPUPPCState *env)
3600 3606 #define POWERPC_INPUT_460F (PPC_FLAGS_INPUT_BookE)
3601 3607 #define POWERPC_BFDM_460F (bfd_mach_ppc_403)
3602 3608 #define POWERPC_FLAG_460F (POWERPC_FLAG_CE | POWERPC_FLAG_DWE | \
3603   - POWERPC_FLAG_DE)
  3609 + POWERPC_FLAG_DE | POWERPC_FLAG_BUS_CLK)
3604 3610 #define check_pow_460F check_pow_nocheck
3605 3611  
3606 3612 __attribute__ (( unused ))
... ... @@ -3681,7 +3687,8 @@ static void init_proc_460F (CPUPPCState *env)
3681 3687 #define POWERPC_EXCP_MPC5xx (POWERPC_EXCP_603)
3682 3688 #define POWERPC_INPUT_MPC5xx (PPC_FLAGS_INPUT_RCPU)
3683 3689 #define POWERPC_BFDM_MPC5xx (bfd_mach_ppc_505)
3684   -#define POWERPC_FLAG_MPC5xx (POWERPC_FLAG_SE | POWERPC_FLAG_BE)
  3690 +#define POWERPC_FLAG_MPC5xx (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
  3691 + POWERPC_FLAG_BUS_CLK)
3685 3692 #define check_pow_MPC5xx check_pow_none
3686 3693  
3687 3694 __attribute__ (( unused ))
... ... @@ -3706,7 +3713,8 @@ static void init_proc_MPC5xx (CPUPPCState *env)
3706 3713 #define POWERPC_EXCP_MPC8xx (POWERPC_EXCP_603)
3707 3714 #define POWERPC_INPUT_MPC8xx (PPC_FLAGS_INPUT_RCPU)
3708 3715 #define POWERPC_BFDM_MPC8xx (bfd_mach_ppc_860)
3709   -#define POWERPC_FLAG_MPC8xx (POWERPC_FLAG_SE | POWERPC_FLAG_BE)
  3716 +#define POWERPC_FLAG_MPC8xx (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
  3717 + POWERPC_FLAG_BUS_CLK)
3710 3718 #define check_pow_MPC8xx check_pow_none
3711 3719  
3712 3720 __attribute__ (( unused ))
... ... @@ -3731,7 +3739,7 @@ static void init_proc_MPC8xx (CPUPPCState *env)
3731 3739 #define POWERPC_INPUT_G2 (PPC_FLAGS_INPUT_6xx)
3732 3740 #define POWERPC_BFDM_G2 (bfd_mach_ppc_ec603e)
3733 3741 #define POWERPC_FLAG_G2 (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3734   - POWERPC_FLAG_BE)
  3742 + POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
3735 3743 #define check_pow_G2 check_pow_hid0
3736 3744  
3737 3745 static void init_proc_G2 (CPUPPCState *env)
... ... @@ -3776,7 +3784,7 @@ static void init_proc_G2 (CPUPPCState *env)
3776 3784 #define POWERPC_INPUT_G2LE (PPC_FLAGS_INPUT_6xx)
3777 3785 #define POWERPC_BFDM_G2LE (bfd_mach_ppc_ec603e)
3778 3786 #define POWERPC_FLAG_G2LE (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3779   - POWERPC_FLAG_BE)
  3787 + POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
3780 3788 #define check_pow_G2LE check_pow_hid0
3781 3789  
3782 3790 static void init_proc_G2LE (CPUPPCState *env)
... ... @@ -3834,7 +3842,8 @@ static void init_proc_G2LE (CPUPPCState *env)
3834 3842 #define POWERPC_INPUT_e200 (PPC_FLAGS_INPUT_BookE)
3835 3843 #define POWERPC_BFDM_e200 (bfd_mach_ppc_860)
3836 3844 #define POWERPC_FLAG_e200 (POWERPC_FLAG_SPE | POWERPC_FLAG_CE | \
3837   - POWERPC_FLAG_UBLE | POWERPC_FLAG_DE)
  3845 + POWERPC_FLAG_UBLE | POWERPC_FLAG_DE | \
  3846 + POWERPC_FLAG_BUS_CLK)
3838 3847 #define check_pow_e200 check_pow_hid0
3839 3848  
3840 3849 __attribute__ (( unused ))
... ... @@ -3947,7 +3956,7 @@ static void init_proc_e200 (CPUPPCState *env)
3947 3956 #define POWERPC_INPUT_e300 (PPC_FLAGS_INPUT_6xx)
3948 3957 #define POWERPC_BFDM_e300 (bfd_mach_ppc_603)
3949 3958 #define POWERPC_FLAG_e300 (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
3950   - POWERPC_FLAG_BE)
  3959 + POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
3951 3960 #define check_pow_e300 check_pow_hid0
3952 3961  
3953 3962 __attribute__ (( unused ))
... ... @@ -3990,7 +3999,8 @@ static void init_proc_e300 (CPUPPCState *env)
3990 3999 #define POWERPC_INPUT_e500 (PPC_FLAGS_INPUT_BookE)
3991 4000 #define POWERPC_BFDM_e500 (bfd_mach_ppc_860)
3992 4001 #define POWERPC_FLAG_e500 (POWERPC_FLAG_SPE | POWERPC_FLAG_CE | \
3993   - POWERPC_FLAG_UBLE | POWERPC_FLAG_DE)
  4002 + POWERPC_FLAG_UBLE | POWERPC_FLAG_DE | \
  4003 + POWERPC_FLAG_BUS_CLK)
3994 4004 #define check_pow_e500 check_pow_hid0
3995 4005  
3996 4006 __attribute__ (( unused ))
... ... @@ -4125,7 +4135,7 @@ static void init_proc_e500 (CPUPPCState *env)
4125 4135 //#define POWERPC_EXCP_601 (POWERPC_EXCP_601)
4126 4136 #define POWERPC_INPUT_601 (PPC_FLAGS_INPUT_6xx)
4127 4137 #define POWERPC_BFDM_601 (bfd_mach_ppc_601)
4128   -#define POWERPC_FLAG_601 (POWERPC_FLAG_SE)
  4138 +#define POWERPC_FLAG_601 (POWERPC_FLAG_SE | POWERPC_FLAG_RTC_CLK)
4129 4139 #define check_pow_601 check_pow_none
4130 4140  
4131 4141 static void init_proc_601 (CPUPPCState *env)
... ... @@ -4183,7 +4193,7 @@ static void init_proc_601 (CPUPPCState *env)
4183 4193 #define POWERPC_INPUT_602 (PPC_FLAGS_INPUT_6xx)
4184 4194 #define POWERPC_BFDM_602 (bfd_mach_ppc_602)
4185 4195 #define POWERPC_FLAG_602 (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
4186   - POWERPC_FLAG_BE)
  4196 + POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
4187 4197 #define check_pow_602 check_pow_hid0
4188 4198  
4189 4199 static void init_proc_602 (CPUPPCState *env)
... ... @@ -4221,7 +4231,7 @@ static void init_proc_602 (CPUPPCState *env)
4221 4231 #define POWERPC_INPUT_603 (PPC_FLAGS_INPUT_6xx)
4222 4232 #define POWERPC_BFDM_603 (bfd_mach_ppc_603)
4223 4233 #define POWERPC_FLAG_603 (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
4224   - POWERPC_FLAG_BE)
  4234 + POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
4225 4235 #define check_pow_603 check_pow_hid0
4226 4236  
4227 4237 static void init_proc_603 (CPUPPCState *env)
... ... @@ -4259,7 +4269,7 @@ static void init_proc_603 (CPUPPCState *env)
4259 4269 #define POWERPC_INPUT_603E (PPC_FLAGS_INPUT_6xx)
4260 4270 #define POWERPC_BFDM_603E (bfd_mach_ppc_ec603e)
4261 4271 #define POWERPC_FLAG_603E (POWERPC_FLAG_TGPR | POWERPC_FLAG_SE | \
4262   - POWERPC_FLAG_BE)
  4272 + POWERPC_FLAG_BE | POWERPC_FLAG_BUS_CLK)
4263 4273 #define check_pow_603E check_pow_hid0
4264 4274  
4265 4275 static void init_proc_603E (CPUPPCState *env)
... ... @@ -4302,7 +4312,7 @@ static void init_proc_603E (CPUPPCState *env)
4302 4312 #define POWERPC_INPUT_604 (PPC_FLAGS_INPUT_6xx)
4303 4313 #define POWERPC_BFDM_604 (bfd_mach_ppc_604)
4304 4314 #define POWERPC_FLAG_604 (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
4305   - POWERPC_FLAG_PMM)
  4315 + POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
4306 4316 #define check_pow_604 check_pow_nocheck
4307 4317  
4308 4318 static void init_proc_604 (CPUPPCState *env)
... ... @@ -4339,7 +4349,7 @@ static void init_proc_604 (CPUPPCState *env)
4339 4349 #define POWERPC_INPUT_7x0 (PPC_FLAGS_INPUT_6xx)
4340 4350 #define POWERPC_BFDM_7x0 (bfd_mach_ppc_750)
4341 4351 #define POWERPC_FLAG_7x0 (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
4342   - POWERPC_FLAG_PMM)
  4352 + POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
4343 4353 #define check_pow_7x0 check_pow_hid0
4344 4354  
4345 4355 static void init_proc_7x0 (CPUPPCState *env)
... ... @@ -4378,7 +4388,7 @@ static void init_proc_7x0 (CPUPPCState *env)
4378 4388 #define POWERPC_INPUT_750fx (PPC_FLAGS_INPUT_6xx)
4379 4389 #define POWERPC_BFDM_750fx (bfd_mach_ppc_750)
4380 4390 #define POWERPC_FLAG_750fx (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
4381   - POWERPC_FLAG_PMM)
  4391 + POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
4382 4392 #define check_pow_750fx check_pow_hid0
4383 4393  
4384 4394 static void init_proc_750fx (CPUPPCState *env)
... ... @@ -4424,7 +4434,7 @@ static void init_proc_750fx (CPUPPCState *env)
4424 4434 #define POWERPC_INPUT_7x5 (PPC_FLAGS_INPUT_6xx)
4425 4435 #define POWERPC_BFDM_7x5 (bfd_mach_ppc_750)
4426 4436 #define POWERPC_FLAG_7x5 (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
4427   - POWERPC_FLAG_PMM)
  4437 + POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK)
4428 4438 #define check_pow_7x5 check_pow_hid0
4429 4439  
4430 4440 static void init_proc_7x5 (CPUPPCState *env)
... ... @@ -4485,7 +4495,8 @@ static void init_proc_7x5 (CPUPPCState *env)
4485 4495 #define POWERPC_INPUT_7400 (PPC_FLAGS_INPUT_6xx)
4486 4496 #define POWERPC_BFDM_7400 (bfd_mach_ppc_7400)
4487 4497 #define POWERPC_FLAG_7400 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4488   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  4498 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  4499 + POWERPC_FLAG_BUS_CLK)
4489 4500 #define check_pow_7400 check_pow_hid0
4490 4501  
4491 4502 static void init_proc_7400 (CPUPPCState *env)
... ... @@ -4517,7 +4528,8 @@ static void init_proc_7400 (CPUPPCState *env)
4517 4528 #define POWERPC_INPUT_7410 (PPC_FLAGS_INPUT_6xx)
4518 4529 #define POWERPC_BFDM_7410 (bfd_mach_ppc_7400)
4519 4530 #define POWERPC_FLAG_7410 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4520   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  4531 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  4532 + POWERPC_FLAG_BUS_CLK)
4521 4533 #define check_pow_7410 check_pow_hid0
4522 4534  
4523 4535 static void init_proc_7410 (CPUPPCState *env)
... ... @@ -4561,7 +4573,8 @@ static void init_proc_7410 (CPUPPCState *env)
4561 4573 #define POWERPC_INPUT_7440 (PPC_FLAGS_INPUT_6xx)
4562 4574 #define POWERPC_BFDM_7440 (bfd_mach_ppc_7400)
4563 4575 #define POWERPC_FLAG_7440 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4564   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  4576 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  4577 + POWERPC_FLAG_BUS_CLK)
4565 4578 #define check_pow_7440 check_pow_hid0
4566 4579  
4567 4580 __attribute__ (( unused ))
... ... @@ -4632,7 +4645,8 @@ static void init_proc_7440 (CPUPPCState *env)
4632 4645 #define POWERPC_INPUT_7450 (PPC_FLAGS_INPUT_6xx)
4633 4646 #define POWERPC_BFDM_7450 (bfd_mach_ppc_7400)
4634 4647 #define POWERPC_FLAG_7450 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4635   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  4648 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  4649 + POWERPC_FLAG_BUS_CLK)
4636 4650 #define check_pow_7450 check_pow_hid0
4637 4651  
4638 4652 __attribute__ (( unused ))
... ... @@ -4705,7 +4719,8 @@ static void init_proc_7450 (CPUPPCState *env)
4705 4719 #define POWERPC_INPUT_7445 (PPC_FLAGS_INPUT_6xx)
4706 4720 #define POWERPC_BFDM_7445 (bfd_mach_ppc_7400)
4707 4721 #define POWERPC_FLAG_7445 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4708   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  4722 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  4723 + POWERPC_FLAG_BUS_CLK)
4709 4724 #define check_pow_7445 check_pow_hid0
4710 4725  
4711 4726 __attribute__ (( unused ))
... ... @@ -4810,7 +4825,8 @@ static void init_proc_7445 (CPUPPCState *env)
4810 4825 #define POWERPC_INPUT_7455 (PPC_FLAGS_INPUT_6xx)
4811 4826 #define POWERPC_BFDM_7455 (bfd_mach_ppc_7400)
4812 4827 #define POWERPC_FLAG_7455 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4813   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  4828 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  4829 + POWERPC_FLAG_BUS_CLK)
4814 4830 #define check_pow_7455 check_pow_hid0
4815 4831  
4816 4832 __attribute__ (( unused ))
... ... @@ -4922,7 +4938,8 @@ static void init_proc_7455 (CPUPPCState *env)
4922 4938 #define POWERPC_INPUT_970 (PPC_FLAGS_INPUT_970)
4923 4939 #define POWERPC_BFDM_970 (bfd_mach_ppc64)
4924 4940 #define POWERPC_FLAG_970 (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
4925   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  4941 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  4942 + POWERPC_FLAG_BUS_CLK)
4926 4943  
4927 4944 #if defined(CONFIG_USER_ONLY)
4928 4945 #define POWERPC970_HID5_INIT 0x00000080
... ... @@ -5002,7 +5019,8 @@ static void init_proc_970 (CPUPPCState *env)
5002 5019 #define POWERPC_INPUT_970FX (PPC_FLAGS_INPUT_970)
5003 5020 #define POWERPC_BFDM_970FX (bfd_mach_ppc64)
5004 5021 #define POWERPC_FLAG_970FX (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
5005   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  5022 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  5023 + POWERPC_FLAG_BUS_CLK)
5006 5024  
5007 5025 static int check_pow_970FX (CPUPPCState *env)
5008 5026 {
... ... @@ -5076,7 +5094,8 @@ static void init_proc_970FX (CPUPPCState *env)
5076 5094 #define POWERPC_INPUT_970GX (PPC_FLAGS_INPUT_970)
5077 5095 #define POWERPC_BFDM_970GX (bfd_mach_ppc64)
5078 5096 #define POWERPC_FLAG_970GX (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
5079   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  5097 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  5098 + POWERPC_FLAG_BUS_CLK)
5080 5099  
5081 5100 static int check_pow_970GX (CPUPPCState *env)
5082 5101 {
... ... @@ -5150,7 +5169,8 @@ static void init_proc_970GX (CPUPPCState *env)
5150 5169 #define POWERPC_INPUT_970MP (PPC_FLAGS_INPUT_970)
5151 5170 #define POWERPC_BFDM_970MP (bfd_mach_ppc64)
5152 5171 #define POWERPC_FLAG_970MP (POWERPC_FLAG_VRE | POWERPC_FLAG_SE | \
5153   - POWERPC_FLAG_BE | POWERPC_FLAG_PMM)
  5172 + POWERPC_FLAG_BE | POWERPC_FLAG_PMM | \
  5173 + POWERPC_FLAG_BUS_CLK)
5154 5174  
5155 5175 static int check_pow_970MP (CPUPPCState *env)
5156 5176 {
... ... @@ -5222,7 +5242,8 @@ static void init_proc_970MP (CPUPPCState *env)
5222 5242 #define POWERPC_EXCP_620 (POWERPC_EXCP_970)
5223 5243 #define POWERPC_INPUT_620 (PPC_FLAGS_INPUT_6xx)
5224 5244 #define POWERPC_BFDM_620 (bfd_mach_ppc64)
5225   -#define POWERPC_FLAG_620 (POWERPC_FLAG_SE | POWERPC_FLAG_BE)
  5245 +#define POWERPC_FLAG_620 (POWERPC_FLAG_SE | POWERPC_FLAG_BE | \
  5246 + POWERPC_FLAG_BUS_CLK)
5226 5247 #define check_pow_620 check_pow_nocheck /* Check this */
5227 5248  
5228 5249 __attribute__ (( unused ))
... ... @@ -7883,6 +7904,11 @@ static void init_ppc_proc (CPUPPCState *env, const ppc_def_t *def)
7883 7904 "Should not define POWERPC_FLAG_PX nor POWERPC_FLAG_PMM\n");
7884 7905 exit(1);
7885 7906 }
  7907 + if ((env->flags & (POWERPC_FLAG_RTC_CLK | POWERPC_FLAG_BUS_CLK)) == 0) {
  7908 + fprintf(stderr, "PowerPC flags inconsistency\n"
  7909 + "Should define the time-base and decrementer clock source\n");
  7910 + exit(1);
  7911 + }
7886 7912 /* Allocate TLBs buffer when needed */
7887 7913 #if !defined(CONFIG_USER_ONLY)
7888 7914 if (env->nb_tlb != 0) {
... ... @@ -8399,6 +8425,8 @@ int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
8399 8425 printf(" performance monitor mark\n");
8400 8426 if (env->flags == POWERPC_FLAG_NONE)
8401 8427 printf(" none\n");
  8428 + printf(" Time-base/decrementer clock source: %s\n",
  8429 + env->flags & POWERPC_FLAG_RTC_CLK ? "RTC clock" : "bus clock");
8402 8430 }
8403 8431 dump_ppc_insns(env);
8404 8432 dump_ppc_sprs(env);
... ...