| 1 | /*************************************************************** |
|---|
| 2 | ** |
|---|
| 3 | ** Broadcom Corp. Confidential |
|---|
| 4 | ** Copyright 1998-2000 Broadcom Corp. All Rights Reserved. |
|---|
| 5 | ** |
|---|
| 6 | ** THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED |
|---|
| 7 | ** SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM. |
|---|
| 8 | ** YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT |
|---|
| 9 | ** SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 10 | ** |
|---|
| 11 | ** File: bcm_mips_defs.h |
|---|
| 12 | ** Description: MIPS definitions. |
|---|
| 13 | ** |
|---|
| 14 | ****************************************************************/ |
|---|
| 15 | #ifndef __BCM_MIPS_DEFS__ |
|---|
| 16 | #define __BCM_MIPS_DEFS__ |
|---|
| 17 | |
|---|
| 18 | #define BCM_PHYS_TO_KSEG1(x) ((unsigned int)(x) | 0xA0000000) |
|---|
| 19 | #define BCM_CPU_TO_PHYS(x) ((unsigned int)(x) & ~0xA0000000) |
|---|
| 20 | #define BCM_PHYS_TO_KSEG0(x) ((unsigned int)(x) | 0x80000000) |
|---|
| 21 | /*************************************************************************** |
|---|
| 22 | Summary: |
|---|
| 23 | Macro to write a cp0 register. |
|---|
| 24 | |
|---|
| 25 | Description: |
|---|
| 26 | asm macro to write a cp0 register given the register, select and value. (MIPS32) |
|---|
| 27 | |
|---|
| 28 | See Also: |
|---|
| 29 | bcm_read_cp0 |
|---|
| 30 | ***************************************************************************/ |
|---|
| 31 | #define bcm_write_cp0(reg, sel, value) \ |
|---|
| 32 | { __asm__ __volatile__(".set\tpush\n\t" \ |
|---|
| 33 | ".set\tmips32\n\t" \ |
|---|
| 34 | "mtc0\t%z0, " #reg ", " #sel "\n\t" \ |
|---|
| 35 | ".set\tpop\n\t" \ |
|---|
| 36 | : /* none */ \ |
|---|
| 37 | : "r" ((unsigned int)value)); \ |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | /*************************************************************************** |
|---|
| 41 | Summary: |
|---|
| 42 | Macro to read a cp0 register. |
|---|
| 43 | |
|---|
| 44 | Description: |
|---|
| 45 | asm macro to read a cp0 register given the register and select. (MIPS32) |
|---|
| 46 | |
|---|
| 47 | See Also: |
|---|
| 48 | bcm_read_cp0 |
|---|
| 49 | ***************************************************************************/ |
|---|
| 50 | #define bcm_read_cp0(reg, sel) \ |
|---|
| 51 | ({ unsigned int bcm_read_cp0_res; \ |
|---|
| 52 | __asm__ __volatile__( ".set\tpush\n\t" \ |
|---|
| 53 | ".set\tmips32\n\t" \ |
|---|
| 54 | "mfc0\t%0, " #reg ", " #sel "\n\t" \ |
|---|
| 55 | ".set\tpop\n\t" \ |
|---|
| 56 | : "=r" (bcm_read_cp0_res)); \ |
|---|
| 57 | bcm_read_cp0_res; \ |
|---|
| 58 | }) |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | #endif /* __BCM_MIPS_DEFS__ */ |
|---|
| 62 | |
|---|