diff options
| author | Dave Kleikamp <shaggy@linux.vnet.ibm.com> | 2010-02-08 06:53:26 -0500 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2010-02-16 22:03:17 -0500 |
| commit | 99396ac105f54fe3584374c7c70a5cb6def766e6 (patch) | |
| tree | 8d46e6f476fa214cd30d2c00c167819301a42e48 | |
| parent | 3162d92dfb79a0b5fc03380b8819fa5f870ebf1e (diff) | |
powerpc/booke: Add definitions for advanced debug registers
powerpc/booke: Add definitions for advanced debug registers
From: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Based on patches originally written by Torez Smith.
This patch adds additional definitions for BookE Debug Registers
to the reg_booke.h header file.
Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Acked-by: David Gibson <dwg@au1.ibm.com>
Cc: Torez Smith <lnxtorez@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Cc: Kumar Gala <galak@kernel.crashing.org>
Cc: Sergio Durigan Junior <sergiodj@br.ibm.com>
Cc: Thiago Jung Bauermann <bauerman@br.ibm.com>
Cc: linuxppc-dev list <Linuxppc-dev@ozlabs.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| -rw-r--r-- | arch/powerpc/include/asm/processor.h | 36 | ||||
| -rw-r--r-- | arch/powerpc/include/asm/reg_booke.h | 96 |
2 files changed, 129 insertions, 3 deletions
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h index 9eed29eee604..221ba6240464 100644 --- a/arch/powerpc/include/asm/processor.h +++ b/arch/powerpc/include/asm/processor.h | |||
| @@ -161,9 +161,41 @@ struct thread_struct { | |||
| 161 | #ifdef CONFIG_PPC32 | 161 | #ifdef CONFIG_PPC32 |
| 162 | void *pgdir; /* root of page-table tree */ | 162 | void *pgdir; /* root of page-table tree */ |
| 163 | #endif | 163 | #endif |
| 164 | #if defined(CONFIG_4xx) || defined (CONFIG_BOOKE) | 164 | #ifdef CONFIG_PPC_ADV_DEBUG_REGS |
| 165 | unsigned long dbcr0; /* debug control register values */ | 165 | /* |
| 166 | * The following help to manage the use of Debug Control Registers | ||
| 167 | * om the BookE platforms. | ||
| 168 | */ | ||
| 169 | unsigned long dbcr0; | ||
| 166 | unsigned long dbcr1; | 170 | unsigned long dbcr1; |
| 171 | #ifdef CONFIG_BOOKE | ||
| 172 | unsigned long dbcr2; | ||
| 173 | #endif | ||
| 174 | /* | ||
| 175 | * The stored value of the DBSR register will be the value at the | ||
| 176 | * last debug interrupt. This register can only be read from the | ||
| 177 | * user (will never be written to) and has value while helping to | ||
| 178 | * describe the reason for the last debug trap. Torez | ||
| 179 | */ | ||
| 180 | unsigned long dbsr; | ||
| 181 | /* | ||
| 182 | * The following will contain addresses used by debug applications | ||
| 183 | * to help trace and trap on particular address locations. | ||
| 184 | * The bits in the Debug Control Registers above help define which | ||
| 185 | * of the following registers will contain valid data and/or addresses. | ||
| 186 | */ | ||
| 187 | unsigned long iac1; | ||
| 188 | unsigned long iac2; | ||
| 189 | #if CONFIG_PPC_ADV_DEBUG_IACS > 2 | ||
| 190 | unsigned long iac3; | ||
| 191 | unsigned long iac4; | ||
| 192 | #endif | ||
| 193 | unsigned long dac1; | ||
| 194 | unsigned long dac2; | ||
| 195 | #if CONFIG_PPC_ADV_DEBUG_DVCS > 0 | ||
| 196 | unsigned long dvc1; | ||
| 197 | unsigned long dvc2; | ||
| 198 | #endif | ||
| 167 | #endif | 199 | #endif |
| 168 | /* FP and VSX 0-31 register set */ | 200 | /* FP and VSX 0-31 register set */ |
| 169 | double fpr[32][TS_FPRWIDTH]; | 201 | double fpr[32][TS_FPRWIDTH]; |
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h index 3bf783505528..8808d307fe7e 100644 --- a/arch/powerpc/include/asm/reg_booke.h +++ b/arch/powerpc/include/asm/reg_booke.h | |||
| @@ -248,6 +248,8 @@ | |||
| 248 | #define DBSR_RET 0x00008000 /* Return Debug Event */ | 248 | #define DBSR_RET 0x00008000 /* Return Debug Event */ |
| 249 | #define DBSR_CIRPT 0x00000040 /* Critical Interrupt Taken Event */ | 249 | #define DBSR_CIRPT 0x00000040 /* Critical Interrupt Taken Event */ |
| 250 | #define DBSR_CRET 0x00000020 /* Critical Return Debug Event */ | 250 | #define DBSR_CRET 0x00000020 /* Critical Return Debug Event */ |
| 251 | #define DBSR_IAC12ATS 0x00000002 /* Instr Address Compare 1/2 Toggle */ | ||
| 252 | #define DBSR_IAC34ATS 0x00000001 /* Instr Address Compare 3/4 Toggle */ | ||
| 251 | #endif | 253 | #endif |
| 252 | #ifdef CONFIG_40x | 254 | #ifdef CONFIG_40x |
| 253 | #define DBSR_IC 0x80000000 /* Instruction Completion */ | 255 | #define DBSR_IC 0x80000000 /* Instruction Completion */ |
| @@ -313,6 +315,38 @@ | |||
| 313 | #define DBCR0_IA12T 0x00008000 /* Instr Addr 1-2 range Toggle */ | 315 | #define DBCR0_IA12T 0x00008000 /* Instr Addr 1-2 range Toggle */ |
| 314 | #define DBCR0_IA34T 0x00004000 /* Instr Addr 3-4 range Toggle */ | 316 | #define DBCR0_IA34T 0x00004000 /* Instr Addr 3-4 range Toggle */ |
| 315 | #define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */ | 317 | #define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */ |
| 318 | |||
| 319 | #define dbcr_iac_range(task) ((task)->thread.dbcr0) | ||
| 320 | #define DBCR_IAC12I DBCR0_IA12 /* Range Inclusive */ | ||
| 321 | #define DBCR_IAC12X (DBCR0_IA12 | DBCR0_IA12X) /* Range Exclusive */ | ||
| 322 | #define DBCR_IAC12MODE (DBCR0_IA12 | DBCR0_IA12X) /* IAC 1-2 Mode Bits */ | ||
| 323 | #define DBCR_IAC34I DBCR0_IA34 /* Range Inclusive */ | ||
| 324 | #define DBCR_IAC34X (DBCR0_IA34 | DBCR0_IA34X) /* Range Exclusive */ | ||
| 325 | #define DBCR_IAC34MODE (DBCR0_IA34 | DBCR0_IA34X) /* IAC 3-4 Mode Bits */ | ||
| 326 | |||
| 327 | /* Bit definitions related to the DBCR1. */ | ||
| 328 | #define DBCR1_DAC1R 0x80000000 /* DAC1 Read Debug Event */ | ||
| 329 | #define DBCR1_DAC2R 0x40000000 /* DAC2 Read Debug Event */ | ||
| 330 | #define DBCR1_DAC1W 0x20000000 /* DAC1 Write Debug Event */ | ||
| 331 | #define DBCR1_DAC2W 0x10000000 /* DAC2 Write Debug Event */ | ||
| 332 | |||
| 333 | #define dbcr_dac(task) ((task)->thread.dbcr1) | ||
| 334 | #define DBCR_DAC1R DBCR1_DAC1R | ||
| 335 | #define DBCR_DAC1W DBCR1_DAC1W | ||
| 336 | #define DBCR_DAC2R DBCR1_DAC2R | ||
| 337 | #define DBCR_DAC2W DBCR1_DAC2W | ||
| 338 | |||
| 339 | /* | ||
| 340 | * Are there any active Debug Events represented in the | ||
| 341 | * Debug Control Registers? | ||
| 342 | */ | ||
| 343 | #define DBCR0_ACTIVE_EVENTS (DBCR0_ICMP | DBCR0_IAC1 | DBCR0_IAC2 | \ | ||
| 344 | DBCR0_IAC3 | DBCR0_IAC4) | ||
| 345 | #define DBCR1_ACTIVE_EVENTS (DBCR1_DAC1R | DBCR1_DAC2R | \ | ||
| 346 | DBCR1_DAC1W | DBCR1_DAC2W) | ||
| 347 | #define DBCR_ACTIVE_EVENTS(dbcr0, dbcr1) (((dbcr0) & DBCR0_ACTIVE_EVENTS) || \ | ||
| 348 | ((dbcr1) & DBCR1_ACTIVE_EVENTS)) | ||
| 349 | |||
| 316 | #elif defined(CONFIG_BOOKE) | 350 | #elif defined(CONFIG_BOOKE) |
| 317 | #define DBCR0_EDM 0x80000000 /* External Debug Mode */ | 351 | #define DBCR0_EDM 0x80000000 /* External Debug Mode */ |
| 318 | #define DBCR0_IDM 0x40000000 /* Internal Debug Mode */ | 352 | #define DBCR0_IDM 0x40000000 /* Internal Debug Mode */ |
| @@ -342,19 +376,79 @@ | |||
| 342 | #define DBCR0_CRET 0x00000020 /* Critical Return Debug Event */ | 376 | #define DBCR0_CRET 0x00000020 /* Critical Return Debug Event */ |
| 343 | #define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */ | 377 | #define DBCR0_FT 0x00000001 /* Freeze Timers on debug event */ |
| 344 | 378 | ||
| 379 | #define dbcr_dac(task) ((task)->thread.dbcr0) | ||
| 380 | #define DBCR_DAC1R DBCR0_DAC1R | ||
| 381 | #define DBCR_DAC1W DBCR0_DAC1W | ||
| 382 | #define DBCR_DAC2R DBCR0_DAC2R | ||
| 383 | #define DBCR_DAC2W DBCR0_DAC2W | ||
| 384 | |||
| 345 | /* Bit definitions related to the DBCR1. */ | 385 | /* Bit definitions related to the DBCR1. */ |
| 386 | #define DBCR1_IAC1US 0xC0000000 /* Instr Addr Cmp 1 Sup/User */ | ||
| 387 | #define DBCR1_IAC1ER 0x30000000 /* Instr Addr Cmp 1 Eff/Real */ | ||
| 388 | #define DBCR1_IAC1ER_01 0x10000000 /* reserved */ | ||
| 389 | #define DBCR1_IAC1ER_10 0x20000000 /* Instr Addr Cmp 1 Eff/Real MSR[IS]=0 */ | ||
| 390 | #define DBCR1_IAC1ER_11 0x30000000 /* Instr Addr Cmp 1 Eff/Real MSR[IS]=1 */ | ||
| 391 | #define DBCR1_IAC2US 0x0C000000 /* Instr Addr Cmp 2 Sup/User */ | ||
| 392 | #define DBCR1_IAC2ER 0x03000000 /* Instr Addr Cmp 2 Eff/Real */ | ||
| 393 | #define DBCR1_IAC2ER_01 0x01000000 /* reserved */ | ||
| 394 | #define DBCR1_IAC2ER_10 0x02000000 /* Instr Addr Cmp 2 Eff/Real MSR[IS]=0 */ | ||
| 395 | #define DBCR1_IAC2ER_11 0x03000000 /* Instr Addr Cmp 2 Eff/Real MSR[IS]=1 */ | ||
| 346 | #define DBCR1_IAC12M 0x00800000 /* Instr Addr 1-2 range enable */ | 396 | #define DBCR1_IAC12M 0x00800000 /* Instr Addr 1-2 range enable */ |
| 347 | #define DBCR1_IAC12MX 0x00C00000 /* Instr Addr 1-2 range eXclusive */ | 397 | #define DBCR1_IAC12MX 0x00C00000 /* Instr Addr 1-2 range eXclusive */ |
| 348 | #define DBCR1_IAC12AT 0x00010000 /* Instr Addr 1-2 range Toggle */ | 398 | #define DBCR1_IAC12AT 0x00010000 /* Instr Addr 1-2 range Toggle */ |
| 399 | #define DBCR1_IAC3US 0x0000C000 /* Instr Addr Cmp 3 Sup/User */ | ||
| 400 | #define DBCR1_IAC3ER 0x00003000 /* Instr Addr Cmp 3 Eff/Real */ | ||
| 401 | #define DBCR1_IAC3ER_01 0x00001000 /* reserved */ | ||
| 402 | #define DBCR1_IAC3ER_10 0x00002000 /* Instr Addr Cmp 3 Eff/Real MSR[IS]=0 */ | ||
| 403 | #define DBCR1_IAC3ER_11 0x00003000 /* Instr Addr Cmp 3 Eff/Real MSR[IS]=1 */ | ||
| 404 | #define DBCR1_IAC4US 0x00000C00 /* Instr Addr Cmp 4 Sup/User */ | ||
| 405 | #define DBCR1_IAC4ER 0x00000300 /* Instr Addr Cmp 4 Eff/Real */ | ||
| 406 | #define DBCR1_IAC4ER_01 0x00000100 /* Instr Addr Cmp 4 Eff/Real MSR[IS]=0 */ | ||
| 407 | #define DBCR1_IAC4ER_10 0x00000200 /* Instr Addr Cmp 4 Eff/Real MSR[IS]=0 */ | ||
| 408 | #define DBCR1_IAC4ER_11 0x00000300 /* Instr Addr Cmp 4 Eff/Real MSR[IS]=1 */ | ||
| 349 | #define DBCR1_IAC34M 0x00000080 /* Instr Addr 3-4 range enable */ | 409 | #define DBCR1_IAC34M 0x00000080 /* Instr Addr 3-4 range enable */ |
| 350 | #define DBCR1_IAC34MX 0x000000C0 /* Instr Addr 3-4 range eXclusive */ | 410 | #define DBCR1_IAC34MX 0x000000C0 /* Instr Addr 3-4 range eXclusive */ |
| 351 | #define DBCR1_IAC34AT 0x00000001 /* Instr Addr 3-4 range Toggle */ | 411 | #define DBCR1_IAC34AT 0x00000001 /* Instr Addr 3-4 range Toggle */ |
| 352 | 412 | ||
| 413 | #define dbcr_iac_range(task) ((task)->thread.dbcr1) | ||
| 414 | #define DBCR_IAC12I DBCR1_IAC12M /* Range Inclusive */ | ||
| 415 | #define DBCR_IAC12X DBCR1_IAC12MX /* Range Exclusive */ | ||
| 416 | #define DBCR_IAC12MODE DBCR1_IAC12MX /* IAC 1-2 Mode Bits */ | ||
| 417 | #define DBCR_IAC34I DBCR1_IAC34M /* Range Inclusive */ | ||
| 418 | #define DBCR_IAC34X DBCR1_IAC34MX /* Range Exclusive */ | ||
| 419 | #define DBCR_IAC34MODE DBCR1_IAC34MX /* IAC 3-4 Mode Bits */ | ||
| 420 | |||
| 353 | /* Bit definitions related to the DBCR2. */ | 421 | /* Bit definitions related to the DBCR2. */ |
| 422 | #define DBCR2_DAC1US 0xC0000000 /* Data Addr Cmp 1 Sup/User */ | ||
| 423 | #define DBCR2_DAC1ER 0x30000000 /* Data Addr Cmp 1 Eff/Real */ | ||
| 424 | #define DBCR2_DAC2US 0x00000000 /* Data Addr Cmp 2 Sup/User */ | ||
| 425 | #define DBCR2_DAC2ER 0x00000000 /* Data Addr Cmp 2 Eff/Real */ | ||
| 354 | #define DBCR2_DAC12M 0x00800000 /* DAC 1-2 range enable */ | 426 | #define DBCR2_DAC12M 0x00800000 /* DAC 1-2 range enable */ |
| 427 | #define DBCR2_DAC12MM 0x00400000 /* DAC 1-2 Mask mode*/ | ||
| 355 | #define DBCR2_DAC12MX 0x00C00000 /* DAC 1-2 range eXclusive */ | 428 | #define DBCR2_DAC12MX 0x00C00000 /* DAC 1-2 range eXclusive */ |
| 429 | #define DBCR2_DAC12MODE 0x00C00000 /* DAC 1-2 Mode Bits */ | ||
| 356 | #define DBCR2_DAC12A 0x00200000 /* DAC 1-2 Asynchronous */ | 430 | #define DBCR2_DAC12A 0x00200000 /* DAC 1-2 Asynchronous */ |
| 357 | #endif | 431 | #define DBCR2_DVC1M 0x000C0000 /* Data Value Comp 1 Mode */ |
| 432 | #define DBCR2_DVC1M_SHIFT 18 /* # of bits to shift DBCR2_DVC1M */ | ||
| 433 | #define DBCR2_DVC2M 0x00030000 /* Data Value Comp 2 Mode */ | ||
| 434 | #define DBCR2_DVC2M_SHIFT 16 /* # of bits to shift DBCR2_DVC2M */ | ||
| 435 | #define DBCR2_DVC1BE 0x00000F00 /* Data Value Comp 1 Byte */ | ||
| 436 | #define DBCR2_DVC1BE_SHIFT 8 /* # of bits to shift DBCR2_DVC1BE */ | ||
| 437 | #define DBCR2_DVC2BE 0x0000000F /* Data Value Comp 2 Byte */ | ||
| 438 | #define DBCR2_DVC2BE_SHIFT 0 /* # of bits to shift DBCR2_DVC2BE */ | ||
| 439 | |||
| 440 | /* | ||
| 441 | * Are there any active Debug Events represented in the | ||
| 442 | * Debug Control Registers? | ||
| 443 | */ | ||
| 444 | #define DBCR0_ACTIVE_EVENTS (DBCR0_ICMP | DBCR0_IAC1 | DBCR0_IAC2 | \ | ||
| 445 | DBCR0_IAC3 | DBCR0_IAC4 | DBCR0_DAC1R | \ | ||
| 446 | DBCR0_DAC1W | DBCR0_DAC2R | DBCR0_DAC2W) | ||
| 447 | #define DBCR1_ACTIVE_EVENTS 0 | ||
| 448 | |||
| 449 | #define DBCR_ACTIVE_EVENTS(dbcr0, dbcr1) (((dbcr0) & DBCR0_ACTIVE_EVENTS) || \ | ||
| 450 | ((dbcr1) & DBCR1_ACTIVE_EVENTS)) | ||
| 451 | #endif /* #elif defined(CONFIG_BOOKE) */ | ||
| 358 | 452 | ||
| 359 | /* Bit definitions related to the TCR. */ | 453 | /* Bit definitions related to the TCR. */ |
| 360 | #define TCR_WP(x) (((x)&0x3)<<30) /* WDT Period */ | 454 | #define TCR_WP(x) (((x)&0x3)<<30) /* WDT Period */ |
