diff mbox

[edk2,03/26] ArmPkg/AsmMacroIoLib: remove unused obsolete MMIO and other asm macros

Message ID 1470842282-8415-4-git-send-email-ard.biesheuvel@linaro.org
State Accepted
Commit 874883a49d0e85cd5494ab880776c4d103bce80a
Headers show

Commit Message

Ard Biesheuvel Aug. 10, 2016, 3:17 p.m. UTC
This removes the various Mmio ASM macros that are not used anywhere in
the code, and removes some variants of LoadConstant... () that are not
used anywhere either.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 ArmPkg/Include/AsmMacroIoLib.h   | 213 --------------------
 ArmPkg/Include/AsmMacroIoLib.inc |  54 -----
 2 files changed, 267 deletions(-)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Aug. 10, 2016, 5:04 p.m. UTC | #1
On Wed, Aug 10, 2016 at 05:17:39PM +0200, Ard Biesheuvel wrote:
> This removes the various Mmio ASM macros that are not used anywhere in

> the code, and removes some variants of LoadConstant... () that are not

> used anywhere either.


If you say something about how the Mmio* functions are redundant due
to the MdePkg implementations:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> Contributed-under: TianoCore Contribution Agreement 1.0

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---

>  ArmPkg/Include/AsmMacroIoLib.h   | 213 --------------------

>  ArmPkg/Include/AsmMacroIoLib.inc |  54 -----

>  2 files changed, 267 deletions(-)

> 

> diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h

> index f94dcc619f7a..551b87803d19 100644

> --- a/ArmPkg/Include/AsmMacroIoLib.h

> +++ b/ArmPkg/Include/AsmMacroIoLib.h

> @@ -24,88 +24,6 @@

>  //  ldr reg, =expr does not work with current Apple tool chain. So do the work our selves

>  //

>  

> -// returns _Data in R0 and _Address in R1

> -#define MmioWrite32(_Address, _Data) \

> -  ldr  r1, [pc, #8]     ;            \

> -  ldr  r0, [pc, #8]     ;            \

> -  str  r0, [r1]         ;            \

> -  b    1f               ;            \

> -  .long (_Address)      ;            \

> -  .long (_Data) ;                    \

> -1:

> -

> -// returns _Data in R0 and _Address in R1, and _OrData in r2

> -#define MmioOr32(_Address, _OrData) \

> -  ldr  r1, [pc, #16]    ;           \

> -  ldr  r2, [pc, #16]    ;           \

> -  ldr  r0, [r1]         ;           \

> -  orr  r0, r0, r2       ;           \

> -  str  r0, [r1]         ;           \

> -  b    1f               ;           \

> -  .long (_Address)      ;           \

> -  .long (_OrData)       ;           \

> -1:

> -

> -// returns _Data in R0 and _Address in R1, and _OrData in r2

> -#define MmioAnd32(_Address, _AndData) \

> -  ldr  r1, [pc, #16]    ;             \

> -  ldr  r2, [pc, #16]    ;             \

> -  ldr  r0, [r1]         ;             \

> -  and  r0, r0, r2       ;             \

> -  str  r0, [r1]         ;             \

> -  b    1f               ;             \

> -  .long (_Address)      ;             \

> -  .long (_AndData)       ;             \

> -1:

> -

> -// returns result in R0, _Address in R1, and _OrData in r2

> -#define MmioAndThenOr32(_Address, _AndData, _OrData)  \

> -  ldr  r1, [pc, #24]    ;                             \

> -  ldr  r0, [r1]         ;                             \

> -  ldr  r2, [pc, #20]    ;                             \

> -  and  r0, r0, r2       ;                             \

> -  ldr  r2, [pc, #16]    ;                             \

> -  orr  r0, r0, r2       ;                             \

> -  str  r0, [r1]         ;                             \

> -  b    1f               ;                             \

> -  .long (_Address)      ;                             \

> -  .long (_AndData)      ;                             \

> -  .long (_OrData)       ;                             \

> -1:

> -

> -// returns _Data in _Reg and _Address in R1

> -#define MmioWriteFromReg32(_Address, _Reg) \

> -  ldr  r1, [pc, #4]     ;                  \

> -  str  _Reg, [r1]       ;                  \

> -  b    1f               ;                  \

> -  .long (_Address)      ;                  \

> -1:

> -

> -

> -// returns _Data in R0 and _Address in R1

> -#define MmioRead32(_Address)   \

> -  ldr  r1, [pc, #4]     ;      \

> -  ldr  r0, [r1]         ;      \

> -  b    1f               ;      \

> -  .long (_Address)      ;      \

> -1:

> -

> -// returns _Data in Reg and _Address in R1

> -#define MmioReadToReg32(_Address, _Reg) \

> -  ldr  r1, [pc, #4]     ;               \

> -  ldr  _Reg, [r1]       ;               \

> -  b    1f               ;               \

> -  .long (_Address)      ;               \

> -1:

> -

> -

> -// load R0 with _Data

> -#define LoadConstant(_Data)  \

> -  ldr  r0, [pc, #0]     ;    \

> -  b    1f               ;    \

> -  .long (_Data)         ;    \

> -1:

> -

>  // load _Reg with _Data

>  #define LoadConstantToReg(_Data, _Reg)  \

>    ldr  _Reg, [pc, #0]   ;               \

> @@ -113,91 +31,8 @@

>    .long (_Data)         ;               \

>  1:

>  

> -// load _Reg with _Data if eq

> -#define LoadConstantToRegIfEq(_Data, _Reg)  \

> -  ldreq  _Reg, [pc, #0]   ;                 \

> -  b    1f                 ;                 \

> -  .long (_Data)           ;                 \

> -1:

> -

> -// Reserve a region at the top of the Primary Core stack

> -// for Global variables for the XIP phase

> -#define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \

> -  and     Tmp, GlobalSize, #7         ;             \

> -  rsbne   Tmp, Tmp, #8                ;             \

> -  add     GlobalSize, GlobalSize, Tmp ;             \

> -  sub     sp, StackTop, GlobalSize    ;             \

> -                                      ;             \

> -  mov     Tmp, sp                     ;             \

> -  mov     GlobalSize, #0x0            ;             \

> -_SetPrimaryStackInitGlobals:          ;             \

> -  cmp     Tmp, StackTop               ;             \

> -  beq     _SetPrimaryStackEnd         ;             \

> -  str     GlobalSize, [Tmp], #4       ;             \

> -  b       _SetPrimaryStackInitGlobals ;             \

> -_SetPrimaryStackEnd:

> -

> -// Initialize the Global Variable with '0'

> -#define InitializePrimaryStack(GlobalSize, Tmp1)    \

> -  and     Tmp1, GlobalSize, #7        ;             \

> -  rsbne   Tmp1, Tmp1, #8              ;             \

> -  add     GlobalSize, GlobalSize, Tmp1 ;            \

> -                                      ;             \

> -  mov     Tmp1, sp                    ;             \

> -  sub     sp, GlobalSize              ;             \

> -  mov     GlobalSize, #0x0            ;             \

> -_InitializePrimaryStackLoop:          ;             \

> -  cmp     Tmp1, sp                    ;             \

> -  bls     _InitializePrimaryStackEnd  ;             \

> -  str     GlobalSize, [Tmp1, #-4]!    ;             \

> -  b       _InitializePrimaryStackLoop ;             \

> -_InitializePrimaryStackEnd:

> -

>  #elif defined (__GNUC__)

>  

> -#define MmioWrite32(Address, Data) \

> -  ldr  r1, =Address ;              \

> -  ldr  r0, =Data    ;              \

> -  str  r0, [r1]

> -

> -#define MmioOr32(Address, OrData) \

> -  ldr  r1, =Address ;             \

> -  ldr  r2, =OrData  ;             \

> -  ldr  r0, [r1]     ;             \

> -  orr  r0, r0, r2   ;             \

> -  str  r0, [r1]

> -

> -#define MmioAnd32(Address, AndData) \

> -  ldr  r1, =Address ;               \

> -  ldr  r2, =AndData ;               \

> -  ldr  r0, [r1]     ;               \

> -  and  r0, r0, r2   ;               \

> -  str  r0, [r1]

> -

> -#define MmioAndThenOr32(Address, AndData, OrData) \

> -  ldr  r1, =Address ;                             \

> -  ldr  r0, [r1]     ;                             \

> -  ldr  r2, =AndData ;                             \

> -  and  r0, r0, r2   ;                             \

> -  ldr  r2, =OrData  ;                             \

> -  orr  r0, r0, r2   ;                             \

> -  str  r0, [r1]

> -

> -#define MmioWriteFromReg32(Address, Reg) \

> -  ldr  r1, =Address ;                    \

> -  str  Reg, [r1]

> -

> -#define MmioRead32(Address) \

> -  ldr  r1, =Address ;       \

> -  ldr  r0, [r1]

> -

> -#define MmioReadToReg32(Address, Reg) \

> -  ldr  r1, =Address ;                 \

> -  ldr  Reg, [r1]

> -

> -#define LoadConstant(Data) \

> -  ldr  r0, =Data

> -

>  #define LoadConstantToReg(Data, Reg) \

>    ldr  Reg, =Data

>  

> @@ -209,59 +44,11 @@ _InitializePrimaryStackEnd:

>  //  Less magic in the macros if ldr reg, =expr works

>  //

>  

> -// returns _Data in R0 and _Address in R1

> -

> -

> -

> -#define MmioWrite32(Address, Data) MmioWrite32Macro Address, Data

> -

> -

> -

> -

> -// returns Data in R0 and Address in R1, and OrData in r2

> -#define MmioOr32(Address, OrData) MmioOr32Macro Address, OrData

> -

> -

> -// returns _Data in R0 and _Address in R1, and _OrData in r2

> -

> -

> -#define MmioAnd32(Address, AndData)  MmioAnd32Macro Address, AndData

> -

> -// returns result in R0, _Address in R1, and _OrData in r2

> -

> -

> -#define MmioAndThenOr32(Address, AndData, OrData) MmioAndThenOr32Macro Address, AndData, OrData

> -

> -

> -// returns _Data in _Reg and _Address in R1

> -

> -

> -#define MmioWriteFromReg32(Address, Reg) MmioWriteFromReg32Macro Address, Reg

> -

> -// returns _Data in R0 and _Address in R1

> -

> -

> -#define MmioRead32(Address)  MmioRead32Macro Address

> -

> -// returns _Data in Reg and _Address in R1

> -

> -

> -#define MmioReadToReg32(Address, Reg) MmioReadToReg32Macro Address, Reg

> -

> -

> -// load R0 with _Data

> -

> -

> -#define LoadConstant(Data)  LoadConstantMacro Data

> -

>  // load _Reg with _Data

>  

>  

>  #define LoadConstantToReg(Data, Reg)  LoadConstantToRegMacro Data, Reg

>  

> -// conditional load testing eq flag

> -#define LoadConstantToRegIfEq(Data, Reg)  LoadConstantToRegIfEqMacro Data, Reg

> -

>  #endif

>  

>  #endif

> diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc

> index 95dc640d6fc3..c9cad5230c94 100644

> --- a/ArmPkg/Include/AsmMacroIoLib.inc

> +++ b/ArmPkg/Include/AsmMacroIoLib.inc

> @@ -17,60 +17,6 @@

>  

>  

>    MACRO

> -  MmioWrite32Macro $Address, $Data

> -  ldr  r1, = ($Address)

> -  ldr  r0, = ($Data)

> -  str  r0, [r1]

> -  MEND

> -

> -  MACRO

> -  MmioOr32Macro $Address, $OrData

> -  ldr  r1, =($Address)

> -  ldr  r2, =($OrData)

> -  ldr  r0, [r1]

> -  orr  r0, r0, r2

> -  str  r0, [r1]

> -  MEND

> -

> -  MACRO

> -  MmioAnd32Macro $Address, $AndData

> -  ldr  r1, =($Address)

> -  ldr  r2, =($AndData)

> -  ldr  r0, [r1]

> -  and  r0, r0, r2

> -  str  r0, [r1]

> -  MEND

> -

> -  MACRO

> -  MmioAndThenOr32Macro $Address, $AndData, $OrData

> -  ldr  r1, =($Address)

> -  ldr  r0, [r1]

> -  ldr  r2, =($AndData)

> -  and  r0, r0, r2

> -  ldr  r2, =($OrData)

> -  orr  r0, r0, r2

> -  str  r0, [r1]

> -  MEND

> -

> -  MACRO

> -  MmioWriteFromReg32Macro $Address, $Reg

> -  ldr  r1, =($Address)

> -  str  $Reg, [r1]

> -  MEND

> -

> -  MACRO

> -  MmioRead32Macro $Address

> -  ldr  r1, =($Address)

> -  ldr  r0, [r1]

> -  MEND

> -

> -  MACRO

> -  MmioReadToReg32Macro $Address, $Reg

> -  ldr  r1, =($Address)

> -  ldr  $Reg, [r1]

> -  MEND

> -

> -  MACRO

>    LoadConstantMacro $Data

>    ldr  r0, =($Data)

>    MEND

> -- 

> 2.7.4

> 

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Ard Biesheuvel Aug. 10, 2016, 5:26 p.m. UTC | #2
On 10 August 2016 at 19:04, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Wed, Aug 10, 2016 at 05:17:39PM +0200, Ard Biesheuvel wrote:

>> This removes the various Mmio ASM macros that are not used anywhere in

>> the code, and removes some variants of LoadConstant... () that are not

>> used anywhere either.

>

> If you say something about how the Mmio* functions are redundant due

> to the MdePkg implementations:


No, they are not. These are asm implementations, and completely unused.

> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

>

>> Contributed-under: TianoCore Contribution Agreement 1.0

>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

>> ---

>>  ArmPkg/Include/AsmMacroIoLib.h   | 213 --------------------

>>  ArmPkg/Include/AsmMacroIoLib.inc |  54 -----

>>  2 files changed, 267 deletions(-)

>>

>> diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h

>> index f94dcc619f7a..551b87803d19 100644

>> --- a/ArmPkg/Include/AsmMacroIoLib.h

>> +++ b/ArmPkg/Include/AsmMacroIoLib.h

>> @@ -24,88 +24,6 @@

>>  //  ldr reg, =expr does not work with current Apple tool chain. So do the work our selves

>>  //

>>

>> -// returns _Data in R0 and _Address in R1

>> -#define MmioWrite32(_Address, _Data) \

>> -  ldr  r1, [pc, #8]     ;            \

>> -  ldr  r0, [pc, #8]     ;            \

>> -  str  r0, [r1]         ;            \

>> -  b    1f               ;            \

>> -  .long (_Address)      ;            \

>> -  .long (_Data) ;                    \

>> -1:

>> -

>> -// returns _Data in R0 and _Address in R1, and _OrData in r2

>> -#define MmioOr32(_Address, _OrData) \

>> -  ldr  r1, [pc, #16]    ;           \

>> -  ldr  r2, [pc, #16]    ;           \

>> -  ldr  r0, [r1]         ;           \

>> -  orr  r0, r0, r2       ;           \

>> -  str  r0, [r1]         ;           \

>> -  b    1f               ;           \

>> -  .long (_Address)      ;           \

>> -  .long (_OrData)       ;           \

>> -1:

>> -

>> -// returns _Data in R0 and _Address in R1, and _OrData in r2

>> -#define MmioAnd32(_Address, _AndData) \

>> -  ldr  r1, [pc, #16]    ;             \

>> -  ldr  r2, [pc, #16]    ;             \

>> -  ldr  r0, [r1]         ;             \

>> -  and  r0, r0, r2       ;             \

>> -  str  r0, [r1]         ;             \

>> -  b    1f               ;             \

>> -  .long (_Address)      ;             \

>> -  .long (_AndData)       ;             \

>> -1:

>> -

>> -// returns result in R0, _Address in R1, and _OrData in r2

>> -#define MmioAndThenOr32(_Address, _AndData, _OrData)  \

>> -  ldr  r1, [pc, #24]    ;                             \

>> -  ldr  r0, [r1]         ;                             \

>> -  ldr  r2, [pc, #20]    ;                             \

>> -  and  r0, r0, r2       ;                             \

>> -  ldr  r2, [pc, #16]    ;                             \

>> -  orr  r0, r0, r2       ;                             \

>> -  str  r0, [r1]         ;                             \

>> -  b    1f               ;                             \

>> -  .long (_Address)      ;                             \

>> -  .long (_AndData)      ;                             \

>> -  .long (_OrData)       ;                             \

>> -1:

>> -

>> -// returns _Data in _Reg and _Address in R1

>> -#define MmioWriteFromReg32(_Address, _Reg) \

>> -  ldr  r1, [pc, #4]     ;                  \

>> -  str  _Reg, [r1]       ;                  \

>> -  b    1f               ;                  \

>> -  .long (_Address)      ;                  \

>> -1:

>> -

>> -

>> -// returns _Data in R0 and _Address in R1

>> -#define MmioRead32(_Address)   \

>> -  ldr  r1, [pc, #4]     ;      \

>> -  ldr  r0, [r1]         ;      \

>> -  b    1f               ;      \

>> -  .long (_Address)      ;      \

>> -1:

>> -

>> -// returns _Data in Reg and _Address in R1

>> -#define MmioReadToReg32(_Address, _Reg) \

>> -  ldr  r1, [pc, #4]     ;               \

>> -  ldr  _Reg, [r1]       ;               \

>> -  b    1f               ;               \

>> -  .long (_Address)      ;               \

>> -1:

>> -

>> -

>> -// load R0 with _Data

>> -#define LoadConstant(_Data)  \

>> -  ldr  r0, [pc, #0]     ;    \

>> -  b    1f               ;    \

>> -  .long (_Data)         ;    \

>> -1:

>> -

>>  // load _Reg with _Data

>>  #define LoadConstantToReg(_Data, _Reg)  \

>>    ldr  _Reg, [pc, #0]   ;               \

>> @@ -113,91 +31,8 @@

>>    .long (_Data)         ;               \

>>  1:

>>

>> -// load _Reg with _Data if eq

>> -#define LoadConstantToRegIfEq(_Data, _Reg)  \

>> -  ldreq  _Reg, [pc, #0]   ;                 \

>> -  b    1f                 ;                 \

>> -  .long (_Data)           ;                 \

>> -1:

>> -

>> -// Reserve a region at the top of the Primary Core stack

>> -// for Global variables for the XIP phase

>> -#define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \

>> -  and     Tmp, GlobalSize, #7         ;             \

>> -  rsbne   Tmp, Tmp, #8                ;             \

>> -  add     GlobalSize, GlobalSize, Tmp ;             \

>> -  sub     sp, StackTop, GlobalSize    ;             \

>> -                                      ;             \

>> -  mov     Tmp, sp                     ;             \

>> -  mov     GlobalSize, #0x0            ;             \

>> -_SetPrimaryStackInitGlobals:          ;             \

>> -  cmp     Tmp, StackTop               ;             \

>> -  beq     _SetPrimaryStackEnd         ;             \

>> -  str     GlobalSize, [Tmp], #4       ;             \

>> -  b       _SetPrimaryStackInitGlobals ;             \

>> -_SetPrimaryStackEnd:

>> -

>> -// Initialize the Global Variable with '0'

>> -#define InitializePrimaryStack(GlobalSize, Tmp1)    \

>> -  and     Tmp1, GlobalSize, #7        ;             \

>> -  rsbne   Tmp1, Tmp1, #8              ;             \

>> -  add     GlobalSize, GlobalSize, Tmp1 ;            \

>> -                                      ;             \

>> -  mov     Tmp1, sp                    ;             \

>> -  sub     sp, GlobalSize              ;             \

>> -  mov     GlobalSize, #0x0            ;             \

>> -_InitializePrimaryStackLoop:          ;             \

>> -  cmp     Tmp1, sp                    ;             \

>> -  bls     _InitializePrimaryStackEnd  ;             \

>> -  str     GlobalSize, [Tmp1, #-4]!    ;             \

>> -  b       _InitializePrimaryStackLoop ;             \

>> -_InitializePrimaryStackEnd:

>> -

>>  #elif defined (__GNUC__)

>>

>> -#define MmioWrite32(Address, Data) \

>> -  ldr  r1, =Address ;              \

>> -  ldr  r0, =Data    ;              \

>> -  str  r0, [r1]

>> -

>> -#define MmioOr32(Address, OrData) \

>> -  ldr  r1, =Address ;             \

>> -  ldr  r2, =OrData  ;             \

>> -  ldr  r0, [r1]     ;             \

>> -  orr  r0, r0, r2   ;             \

>> -  str  r0, [r1]

>> -

>> -#define MmioAnd32(Address, AndData) \

>> -  ldr  r1, =Address ;               \

>> -  ldr  r2, =AndData ;               \

>> -  ldr  r0, [r1]     ;               \

>> -  and  r0, r0, r2   ;               \

>> -  str  r0, [r1]

>> -

>> -#define MmioAndThenOr32(Address, AndData, OrData) \

>> -  ldr  r1, =Address ;                             \

>> -  ldr  r0, [r1]     ;                             \

>> -  ldr  r2, =AndData ;                             \

>> -  and  r0, r0, r2   ;                             \

>> -  ldr  r2, =OrData  ;                             \

>> -  orr  r0, r0, r2   ;                             \

>> -  str  r0, [r1]

>> -

>> -#define MmioWriteFromReg32(Address, Reg) \

>> -  ldr  r1, =Address ;                    \

>> -  str  Reg, [r1]

>> -

>> -#define MmioRead32(Address) \

>> -  ldr  r1, =Address ;       \

>> -  ldr  r0, [r1]

>> -

>> -#define MmioReadToReg32(Address, Reg) \

>> -  ldr  r1, =Address ;                 \

>> -  ldr  Reg, [r1]

>> -

>> -#define LoadConstant(Data) \

>> -  ldr  r0, =Data

>> -

>>  #define LoadConstantToReg(Data, Reg) \

>>    ldr  Reg, =Data

>>

>> @@ -209,59 +44,11 @@ _InitializePrimaryStackEnd:

>>  //  Less magic in the macros if ldr reg, =expr works

>>  //

>>

>> -// returns _Data in R0 and _Address in R1

>> -

>> -

>> -

>> -#define MmioWrite32(Address, Data) MmioWrite32Macro Address, Data

>> -

>> -

>> -

>> -

>> -// returns Data in R0 and Address in R1, and OrData in r2

>> -#define MmioOr32(Address, OrData) MmioOr32Macro Address, OrData

>> -

>> -

>> -// returns _Data in R0 and _Address in R1, and _OrData in r2

>> -

>> -

>> -#define MmioAnd32(Address, AndData)  MmioAnd32Macro Address, AndData

>> -

>> -// returns result in R0, _Address in R1, and _OrData in r2

>> -

>> -

>> -#define MmioAndThenOr32(Address, AndData, OrData) MmioAndThenOr32Macro Address, AndData, OrData

>> -

>> -

>> -// returns _Data in _Reg and _Address in R1

>> -

>> -

>> -#define MmioWriteFromReg32(Address, Reg) MmioWriteFromReg32Macro Address, Reg

>> -

>> -// returns _Data in R0 and _Address in R1

>> -

>> -

>> -#define MmioRead32(Address)  MmioRead32Macro Address

>> -

>> -// returns _Data in Reg and _Address in R1

>> -

>> -

>> -#define MmioReadToReg32(Address, Reg) MmioReadToReg32Macro Address, Reg

>> -

>> -

>> -// load R0 with _Data

>> -

>> -

>> -#define LoadConstant(Data)  LoadConstantMacro Data

>> -

>>  // load _Reg with _Data

>>

>>

>>  #define LoadConstantToReg(Data, Reg)  LoadConstantToRegMacro Data, Reg

>>

>> -// conditional load testing eq flag

>> -#define LoadConstantToRegIfEq(Data, Reg)  LoadConstantToRegIfEqMacro Data, Reg

>> -

>>  #endif

>>

>>  #endif

>> diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc

>> index 95dc640d6fc3..c9cad5230c94 100644

>> --- a/ArmPkg/Include/AsmMacroIoLib.inc

>> +++ b/ArmPkg/Include/AsmMacroIoLib.inc

>> @@ -17,60 +17,6 @@

>>

>>

>>    MACRO

>> -  MmioWrite32Macro $Address, $Data

>> -  ldr  r1, = ($Address)

>> -  ldr  r0, = ($Data)

>> -  str  r0, [r1]

>> -  MEND

>> -

>> -  MACRO

>> -  MmioOr32Macro $Address, $OrData

>> -  ldr  r1, =($Address)

>> -  ldr  r2, =($OrData)

>> -  ldr  r0, [r1]

>> -  orr  r0, r0, r2

>> -  str  r0, [r1]

>> -  MEND

>> -

>> -  MACRO

>> -  MmioAnd32Macro $Address, $AndData

>> -  ldr  r1, =($Address)

>> -  ldr  r2, =($AndData)

>> -  ldr  r0, [r1]

>> -  and  r0, r0, r2

>> -  str  r0, [r1]

>> -  MEND

>> -

>> -  MACRO

>> -  MmioAndThenOr32Macro $Address, $AndData, $OrData

>> -  ldr  r1, =($Address)

>> -  ldr  r0, [r1]

>> -  ldr  r2, =($AndData)

>> -  and  r0, r0, r2

>> -  ldr  r2, =($OrData)

>> -  orr  r0, r0, r2

>> -  str  r0, [r1]

>> -  MEND

>> -

>> -  MACRO

>> -  MmioWriteFromReg32Macro $Address, $Reg

>> -  ldr  r1, =($Address)

>> -  str  $Reg, [r1]

>> -  MEND

>> -

>> -  MACRO

>> -  MmioRead32Macro $Address

>> -  ldr  r1, =($Address)

>> -  ldr  r0, [r1]

>> -  MEND

>> -

>> -  MACRO

>> -  MmioReadToReg32Macro $Address, $Reg

>> -  ldr  r1, =($Address)

>> -  ldr  $Reg, [r1]

>> -  MEND

>> -

>> -  MACRO

>>    LoadConstantMacro $Data

>>    ldr  r0, =($Data)

>>    MEND

>> --

>> 2.7.4

>>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Leif Lindholm Aug. 11, 2016, 8:23 a.m. UTC | #3
On Wed, Aug 10, 2016 at 07:26:46PM +0200, Ard Biesheuvel wrote:
> On 10 August 2016 at 19:04, Leif Lindholm <leif.lindholm@linaro.org> wrote:

> > On Wed, Aug 10, 2016 at 05:17:39PM +0200, Ard Biesheuvel wrote:

> >> This removes the various Mmio ASM macros that are not used anywhere in

> >> the code, and removes some variants of LoadConstant... () that are not

> >> used anywhere either.

> >

> > If you say something about how the Mmio* functions are redundant due

> > to the MdePkg implementations:

> 

> No, they are not. These are asm implementations, and completely unused.


Yes, but due to the unfortunate naming of these macros conflicting
with real functions existing in IoLib, this patch looks potentially
horrifying at first glance. Hence I would prefer that to be mentioned
in the commit message.

/
    Leif

> > Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> >

> >> Contributed-under: TianoCore Contribution Agreement 1.0

> >> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> >> ---

> >>  ArmPkg/Include/AsmMacroIoLib.h   | 213 --------------------

> >>  ArmPkg/Include/AsmMacroIoLib.inc |  54 -----

> >>  2 files changed, 267 deletions(-)

> >>

> >> diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h

> >> index f94dcc619f7a..551b87803d19 100644

> >> --- a/ArmPkg/Include/AsmMacroIoLib.h

> >> +++ b/ArmPkg/Include/AsmMacroIoLib.h

> >> @@ -24,88 +24,6 @@

> >>  //  ldr reg, =expr does not work with current Apple tool chain. So do the work our selves

> >>  //

> >>

> >> -// returns _Data in R0 and _Address in R1

> >> -#define MmioWrite32(_Address, _Data) \

> >> -  ldr  r1, [pc, #8]     ;            \

> >> -  ldr  r0, [pc, #8]     ;            \

> >> -  str  r0, [r1]         ;            \

> >> -  b    1f               ;            \

> >> -  .long (_Address)      ;            \

> >> -  .long (_Data) ;                    \

> >> -1:

> >> -

> >> -// returns _Data in R0 and _Address in R1, and _OrData in r2

> >> -#define MmioOr32(_Address, _OrData) \

> >> -  ldr  r1, [pc, #16]    ;           \

> >> -  ldr  r2, [pc, #16]    ;           \

> >> -  ldr  r0, [r1]         ;           \

> >> -  orr  r0, r0, r2       ;           \

> >> -  str  r0, [r1]         ;           \

> >> -  b    1f               ;           \

> >> -  .long (_Address)      ;           \

> >> -  .long (_OrData)       ;           \

> >> -1:

> >> -

> >> -// returns _Data in R0 and _Address in R1, and _OrData in r2

> >> -#define MmioAnd32(_Address, _AndData) \

> >> -  ldr  r1, [pc, #16]    ;             \

> >> -  ldr  r2, [pc, #16]    ;             \

> >> -  ldr  r0, [r1]         ;             \

> >> -  and  r0, r0, r2       ;             \

> >> -  str  r0, [r1]         ;             \

> >> -  b    1f               ;             \

> >> -  .long (_Address)      ;             \

> >> -  .long (_AndData)       ;             \

> >> -1:

> >> -

> >> -// returns result in R0, _Address in R1, and _OrData in r2

> >> -#define MmioAndThenOr32(_Address, _AndData, _OrData)  \

> >> -  ldr  r1, [pc, #24]    ;                             \

> >> -  ldr  r0, [r1]         ;                             \

> >> -  ldr  r2, [pc, #20]    ;                             \

> >> -  and  r0, r0, r2       ;                             \

> >> -  ldr  r2, [pc, #16]    ;                             \

> >> -  orr  r0, r0, r2       ;                             \

> >> -  str  r0, [r1]         ;                             \

> >> -  b    1f               ;                             \

> >> -  .long (_Address)      ;                             \

> >> -  .long (_AndData)      ;                             \

> >> -  .long (_OrData)       ;                             \

> >> -1:

> >> -

> >> -// returns _Data in _Reg and _Address in R1

> >> -#define MmioWriteFromReg32(_Address, _Reg) \

> >> -  ldr  r1, [pc, #4]     ;                  \

> >> -  str  _Reg, [r1]       ;                  \

> >> -  b    1f               ;                  \

> >> -  .long (_Address)      ;                  \

> >> -1:

> >> -

> >> -

> >> -// returns _Data in R0 and _Address in R1

> >> -#define MmioRead32(_Address)   \

> >> -  ldr  r1, [pc, #4]     ;      \

> >> -  ldr  r0, [r1]         ;      \

> >> -  b    1f               ;      \

> >> -  .long (_Address)      ;      \

> >> -1:

> >> -

> >> -// returns _Data in Reg and _Address in R1

> >> -#define MmioReadToReg32(_Address, _Reg) \

> >> -  ldr  r1, [pc, #4]     ;               \

> >> -  ldr  _Reg, [r1]       ;               \

> >> -  b    1f               ;               \

> >> -  .long (_Address)      ;               \

> >> -1:

> >> -

> >> -

> >> -// load R0 with _Data

> >> -#define LoadConstant(_Data)  \

> >> -  ldr  r0, [pc, #0]     ;    \

> >> -  b    1f               ;    \

> >> -  .long (_Data)         ;    \

> >> -1:

> >> -

> >>  // load _Reg with _Data

> >>  #define LoadConstantToReg(_Data, _Reg)  \

> >>    ldr  _Reg, [pc, #0]   ;               \

> >> @@ -113,91 +31,8 @@

> >>    .long (_Data)         ;               \

> >>  1:

> >>

> >> -// load _Reg with _Data if eq

> >> -#define LoadConstantToRegIfEq(_Data, _Reg)  \

> >> -  ldreq  _Reg, [pc, #0]   ;                 \

> >> -  b    1f                 ;                 \

> >> -  .long (_Data)           ;                 \

> >> -1:

> >> -

> >> -// Reserve a region at the top of the Primary Core stack

> >> -// for Global variables for the XIP phase

> >> -#define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \

> >> -  and     Tmp, GlobalSize, #7         ;             \

> >> -  rsbne   Tmp, Tmp, #8                ;             \

> >> -  add     GlobalSize, GlobalSize, Tmp ;             \

> >> -  sub     sp, StackTop, GlobalSize    ;             \

> >> -                                      ;             \

> >> -  mov     Tmp, sp                     ;             \

> >> -  mov     GlobalSize, #0x0            ;             \

> >> -_SetPrimaryStackInitGlobals:          ;             \

> >> -  cmp     Tmp, StackTop               ;             \

> >> -  beq     _SetPrimaryStackEnd         ;             \

> >> -  str     GlobalSize, [Tmp], #4       ;             \

> >> -  b       _SetPrimaryStackInitGlobals ;             \

> >> -_SetPrimaryStackEnd:

> >> -

> >> -// Initialize the Global Variable with '0'

> >> -#define InitializePrimaryStack(GlobalSize, Tmp1)    \

> >> -  and     Tmp1, GlobalSize, #7        ;             \

> >> -  rsbne   Tmp1, Tmp1, #8              ;             \

> >> -  add     GlobalSize, GlobalSize, Tmp1 ;            \

> >> -                                      ;             \

> >> -  mov     Tmp1, sp                    ;             \

> >> -  sub     sp, GlobalSize              ;             \

> >> -  mov     GlobalSize, #0x0            ;             \

> >> -_InitializePrimaryStackLoop:          ;             \

> >> -  cmp     Tmp1, sp                    ;             \

> >> -  bls     _InitializePrimaryStackEnd  ;             \

> >> -  str     GlobalSize, [Tmp1, #-4]!    ;             \

> >> -  b       _InitializePrimaryStackLoop ;             \

> >> -_InitializePrimaryStackEnd:

> >> -

> >>  #elif defined (__GNUC__)

> >>

> >> -#define MmioWrite32(Address, Data) \

> >> -  ldr  r1, =Address ;              \

> >> -  ldr  r0, =Data    ;              \

> >> -  str  r0, [r1]

> >> -

> >> -#define MmioOr32(Address, OrData) \

> >> -  ldr  r1, =Address ;             \

> >> -  ldr  r2, =OrData  ;             \

> >> -  ldr  r0, [r1]     ;             \

> >> -  orr  r0, r0, r2   ;             \

> >> -  str  r0, [r1]

> >> -

> >> -#define MmioAnd32(Address, AndData) \

> >> -  ldr  r1, =Address ;               \

> >> -  ldr  r2, =AndData ;               \

> >> -  ldr  r0, [r1]     ;               \

> >> -  and  r0, r0, r2   ;               \

> >> -  str  r0, [r1]

> >> -

> >> -#define MmioAndThenOr32(Address, AndData, OrData) \

> >> -  ldr  r1, =Address ;                             \

> >> -  ldr  r0, [r1]     ;                             \

> >> -  ldr  r2, =AndData ;                             \

> >> -  and  r0, r0, r2   ;                             \

> >> -  ldr  r2, =OrData  ;                             \

> >> -  orr  r0, r0, r2   ;                             \

> >> -  str  r0, [r1]

> >> -

> >> -#define MmioWriteFromReg32(Address, Reg) \

> >> -  ldr  r1, =Address ;                    \

> >> -  str  Reg, [r1]

> >> -

> >> -#define MmioRead32(Address) \

> >> -  ldr  r1, =Address ;       \

> >> -  ldr  r0, [r1]

> >> -

> >> -#define MmioReadToReg32(Address, Reg) \

> >> -  ldr  r1, =Address ;                 \

> >> -  ldr  Reg, [r1]

> >> -

> >> -#define LoadConstant(Data) \

> >> -  ldr  r0, =Data

> >> -

> >>  #define LoadConstantToReg(Data, Reg) \

> >>    ldr  Reg, =Data

> >>

> >> @@ -209,59 +44,11 @@ _InitializePrimaryStackEnd:

> >>  //  Less magic in the macros if ldr reg, =expr works

> >>  //

> >>

> >> -// returns _Data in R0 and _Address in R1

> >> -

> >> -

> >> -

> >> -#define MmioWrite32(Address, Data) MmioWrite32Macro Address, Data

> >> -

> >> -

> >> -

> >> -

> >> -// returns Data in R0 and Address in R1, and OrData in r2

> >> -#define MmioOr32(Address, OrData) MmioOr32Macro Address, OrData

> >> -

> >> -

> >> -// returns _Data in R0 and _Address in R1, and _OrData in r2

> >> -

> >> -

> >> -#define MmioAnd32(Address, AndData)  MmioAnd32Macro Address, AndData

> >> -

> >> -// returns result in R0, _Address in R1, and _OrData in r2

> >> -

> >> -

> >> -#define MmioAndThenOr32(Address, AndData, OrData) MmioAndThenOr32Macro Address, AndData, OrData

> >> -

> >> -

> >> -// returns _Data in _Reg and _Address in R1

> >> -

> >> -

> >> -#define MmioWriteFromReg32(Address, Reg) MmioWriteFromReg32Macro Address, Reg

> >> -

> >> -// returns _Data in R0 and _Address in R1

> >> -

> >> -

> >> -#define MmioRead32(Address)  MmioRead32Macro Address

> >> -

> >> -// returns _Data in Reg and _Address in R1

> >> -

> >> -

> >> -#define MmioReadToReg32(Address, Reg) MmioReadToReg32Macro Address, Reg

> >> -

> >> -

> >> -// load R0 with _Data

> >> -

> >> -

> >> -#define LoadConstant(Data)  LoadConstantMacro Data

> >> -

> >>  // load _Reg with _Data

> >>

> >>

> >>  #define LoadConstantToReg(Data, Reg)  LoadConstantToRegMacro Data, Reg

> >>

> >> -// conditional load testing eq flag

> >> -#define LoadConstantToRegIfEq(Data, Reg)  LoadConstantToRegIfEqMacro Data, Reg

> >> -

> >>  #endif

> >>

> >>  #endif

> >> diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc

> >> index 95dc640d6fc3..c9cad5230c94 100644

> >> --- a/ArmPkg/Include/AsmMacroIoLib.inc

> >> +++ b/ArmPkg/Include/AsmMacroIoLib.inc

> >> @@ -17,60 +17,6 @@

> >>

> >>

> >>    MACRO

> >> -  MmioWrite32Macro $Address, $Data

> >> -  ldr  r1, = ($Address)

> >> -  ldr  r0, = ($Data)

> >> -  str  r0, [r1]

> >> -  MEND

> >> -

> >> -  MACRO

> >> -  MmioOr32Macro $Address, $OrData

> >> -  ldr  r1, =($Address)

> >> -  ldr  r2, =($OrData)

> >> -  ldr  r0, [r1]

> >> -  orr  r0, r0, r2

> >> -  str  r0, [r1]

> >> -  MEND

> >> -

> >> -  MACRO

> >> -  MmioAnd32Macro $Address, $AndData

> >> -  ldr  r1, =($Address)

> >> -  ldr  r2, =($AndData)

> >> -  ldr  r0, [r1]

> >> -  and  r0, r0, r2

> >> -  str  r0, [r1]

> >> -  MEND

> >> -

> >> -  MACRO

> >> -  MmioAndThenOr32Macro $Address, $AndData, $OrData

> >> -  ldr  r1, =($Address)

> >> -  ldr  r0, [r1]

> >> -  ldr  r2, =($AndData)

> >> -  and  r0, r0, r2

> >> -  ldr  r2, =($OrData)

> >> -  orr  r0, r0, r2

> >> -  str  r0, [r1]

> >> -  MEND

> >> -

> >> -  MACRO

> >> -  MmioWriteFromReg32Macro $Address, $Reg

> >> -  ldr  r1, =($Address)

> >> -  str  $Reg, [r1]

> >> -  MEND

> >> -

> >> -  MACRO

> >> -  MmioRead32Macro $Address

> >> -  ldr  r1, =($Address)

> >> -  ldr  r0, [r1]

> >> -  MEND

> >> -

> >> -  MACRO

> >> -  MmioReadToReg32Macro $Address, $Reg

> >> -  ldr  r1, =($Address)

> >> -  ldr  $Reg, [r1]

> >> -  MEND

> >> -

> >> -  MACRO

> >>    LoadConstantMacro $Data

> >>    ldr  r0, =($Data)

> >>    MEND

> >> --

> >> 2.7.4

> >>

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

diff --git a/ArmPkg/Include/AsmMacroIoLib.h b/ArmPkg/Include/AsmMacroIoLib.h
index f94dcc619f7a..551b87803d19 100644
--- a/ArmPkg/Include/AsmMacroIoLib.h
+++ b/ArmPkg/Include/AsmMacroIoLib.h
@@ -24,88 +24,6 @@ 
 //  ldr reg, =expr does not work with current Apple tool chain. So do the work our selves
 //
 
-// returns _Data in R0 and _Address in R1
-#define MmioWrite32(_Address, _Data) \
-  ldr  r1, [pc, #8]     ;            \
-  ldr  r0, [pc, #8]     ;            \
-  str  r0, [r1]         ;            \
-  b    1f               ;            \
-  .long (_Address)      ;            \
-  .long (_Data) ;                    \
-1:
-
-// returns _Data in R0 and _Address in R1, and _OrData in r2
-#define MmioOr32(_Address, _OrData) \
-  ldr  r1, [pc, #16]    ;           \
-  ldr  r2, [pc, #16]    ;           \
-  ldr  r0, [r1]         ;           \
-  orr  r0, r0, r2       ;           \
-  str  r0, [r1]         ;           \
-  b    1f               ;           \
-  .long (_Address)      ;           \
-  .long (_OrData)       ;           \
-1:
-
-// returns _Data in R0 and _Address in R1, and _OrData in r2
-#define MmioAnd32(_Address, _AndData) \
-  ldr  r1, [pc, #16]    ;             \
-  ldr  r2, [pc, #16]    ;             \
-  ldr  r0, [r1]         ;             \
-  and  r0, r0, r2       ;             \
-  str  r0, [r1]         ;             \
-  b    1f               ;             \
-  .long (_Address)      ;             \
-  .long (_AndData)       ;             \
-1:
-
-// returns result in R0, _Address in R1, and _OrData in r2
-#define MmioAndThenOr32(_Address, _AndData, _OrData)  \
-  ldr  r1, [pc, #24]    ;                             \
-  ldr  r0, [r1]         ;                             \
-  ldr  r2, [pc, #20]    ;                             \
-  and  r0, r0, r2       ;                             \
-  ldr  r2, [pc, #16]    ;                             \
-  orr  r0, r0, r2       ;                             \
-  str  r0, [r1]         ;                             \
-  b    1f               ;                             \
-  .long (_Address)      ;                             \
-  .long (_AndData)      ;                             \
-  .long (_OrData)       ;                             \
-1:
-
-// returns _Data in _Reg and _Address in R1
-#define MmioWriteFromReg32(_Address, _Reg) \
-  ldr  r1, [pc, #4]     ;                  \
-  str  _Reg, [r1]       ;                  \
-  b    1f               ;                  \
-  .long (_Address)      ;                  \
-1:
-
-
-// returns _Data in R0 and _Address in R1
-#define MmioRead32(_Address)   \
-  ldr  r1, [pc, #4]     ;      \
-  ldr  r0, [r1]         ;      \
-  b    1f               ;      \
-  .long (_Address)      ;      \
-1:
-
-// returns _Data in Reg and _Address in R1
-#define MmioReadToReg32(_Address, _Reg) \
-  ldr  r1, [pc, #4]     ;               \
-  ldr  _Reg, [r1]       ;               \
-  b    1f               ;               \
-  .long (_Address)      ;               \
-1:
-
-
-// load R0 with _Data
-#define LoadConstant(_Data)  \
-  ldr  r0, [pc, #0]     ;    \
-  b    1f               ;    \
-  .long (_Data)         ;    \
-1:
-
 // load _Reg with _Data
 #define LoadConstantToReg(_Data, _Reg)  \
   ldr  _Reg, [pc, #0]   ;               \
@@ -113,91 +31,8 @@ 
   .long (_Data)         ;               \
 1:
 
-// load _Reg with _Data if eq
-#define LoadConstantToRegIfEq(_Data, _Reg)  \
-  ldreq  _Reg, [pc, #0]   ;                 \
-  b    1f                 ;                 \
-  .long (_Data)           ;                 \
-1:
-
-// Reserve a region at the top of the Primary Core stack
-// for Global variables for the XIP phase
-#define SetPrimaryStack(StackTop, GlobalSize, Tmp)  \
-  and     Tmp, GlobalSize, #7         ;             \
-  rsbne   Tmp, Tmp, #8                ;             \
-  add     GlobalSize, GlobalSize, Tmp ;             \
-  sub     sp, StackTop, GlobalSize    ;             \
-                                      ;             \
-  mov     Tmp, sp                     ;             \
-  mov     GlobalSize, #0x0            ;             \
-_SetPrimaryStackInitGlobals:          ;             \
-  cmp     Tmp, StackTop               ;             \
-  beq     _SetPrimaryStackEnd         ;             \
-  str     GlobalSize, [Tmp], #4       ;             \
-  b       _SetPrimaryStackInitGlobals ;             \
-_SetPrimaryStackEnd:
-
-// Initialize the Global Variable with '0'
-#define InitializePrimaryStack(GlobalSize, Tmp1)    \
-  and     Tmp1, GlobalSize, #7        ;             \
-  rsbne   Tmp1, Tmp1, #8              ;             \
-  add     GlobalSize, GlobalSize, Tmp1 ;            \
-                                      ;             \
-  mov     Tmp1, sp                    ;             \
-  sub     sp, GlobalSize              ;             \
-  mov     GlobalSize, #0x0            ;             \
-_InitializePrimaryStackLoop:          ;             \
-  cmp     Tmp1, sp                    ;             \
-  bls     _InitializePrimaryStackEnd  ;             \
-  str     GlobalSize, [Tmp1, #-4]!    ;             \
-  b       _InitializePrimaryStackLoop ;             \
-_InitializePrimaryStackEnd:
-
 #elif defined (__GNUC__)
 
-#define MmioWrite32(Address, Data) \
-  ldr  r1, =Address ;              \
-  ldr  r0, =Data    ;              \
-  str  r0, [r1]
-
-#define MmioOr32(Address, OrData) \
-  ldr  r1, =Address ;             \
-  ldr  r2, =OrData  ;             \
-  ldr  r0, [r1]     ;             \
-  orr  r0, r0, r2   ;             \
-  str  r0, [r1]
-
-#define MmioAnd32(Address, AndData) \
-  ldr  r1, =Address ;               \
-  ldr  r2, =AndData ;               \
-  ldr  r0, [r1]     ;               \
-  and  r0, r0, r2   ;               \
-  str  r0, [r1]
-
-#define MmioAndThenOr32(Address, AndData, OrData) \
-  ldr  r1, =Address ;                             \
-  ldr  r0, [r1]     ;                             \
-  ldr  r2, =AndData ;                             \
-  and  r0, r0, r2   ;                             \
-  ldr  r2, =OrData  ;                             \
-  orr  r0, r0, r2   ;                             \
-  str  r0, [r1]
-
-#define MmioWriteFromReg32(Address, Reg) \
-  ldr  r1, =Address ;                    \
-  str  Reg, [r1]
-
-#define MmioRead32(Address) \
-  ldr  r1, =Address ;       \
-  ldr  r0, [r1]
-
-#define MmioReadToReg32(Address, Reg) \
-  ldr  r1, =Address ;                 \
-  ldr  Reg, [r1]
-
-#define LoadConstant(Data) \
-  ldr  r0, =Data
-
 #define LoadConstantToReg(Data, Reg) \
   ldr  Reg, =Data
 
@@ -209,59 +44,11 @@  _InitializePrimaryStackEnd:
 //  Less magic in the macros if ldr reg, =expr works
 //
 
-// returns _Data in R0 and _Address in R1
-
-
-
-#define MmioWrite32(Address, Data) MmioWrite32Macro Address, Data
-
-
-
-
-// returns Data in R0 and Address in R1, and OrData in r2
-#define MmioOr32(Address, OrData) MmioOr32Macro Address, OrData
-
-
-// returns _Data in R0 and _Address in R1, and _OrData in r2
-
-
-#define MmioAnd32(Address, AndData)  MmioAnd32Macro Address, AndData
-
-// returns result in R0, _Address in R1, and _OrData in r2
-
-
-#define MmioAndThenOr32(Address, AndData, OrData) MmioAndThenOr32Macro Address, AndData, OrData
-
-
-// returns _Data in _Reg and _Address in R1
-
-
-#define MmioWriteFromReg32(Address, Reg) MmioWriteFromReg32Macro Address, Reg
-
-// returns _Data in R0 and _Address in R1
-
-
-#define MmioRead32(Address)  MmioRead32Macro Address
-
-// returns _Data in Reg and _Address in R1
-
-
-#define MmioReadToReg32(Address, Reg) MmioReadToReg32Macro Address, Reg
-
-
-// load R0 with _Data
-
-
-#define LoadConstant(Data)  LoadConstantMacro Data
-
 // load _Reg with _Data
 
 
 #define LoadConstantToReg(Data, Reg)  LoadConstantToRegMacro Data, Reg
 
-// conditional load testing eq flag
-#define LoadConstantToRegIfEq(Data, Reg)  LoadConstantToRegIfEqMacro Data, Reg
-
 #endif
 
 #endif
diff --git a/ArmPkg/Include/AsmMacroIoLib.inc b/ArmPkg/Include/AsmMacroIoLib.inc
index 95dc640d6fc3..c9cad5230c94 100644
--- a/ArmPkg/Include/AsmMacroIoLib.inc
+++ b/ArmPkg/Include/AsmMacroIoLib.inc
@@ -17,60 +17,6 @@ 
 
 
   MACRO
-  MmioWrite32Macro $Address, $Data
-  ldr  r1, = ($Address)
-  ldr  r0, = ($Data)
-  str  r0, [r1]
-  MEND
-
-  MACRO
-  MmioOr32Macro $Address, $OrData
-  ldr  r1, =($Address)
-  ldr  r2, =($OrData)
-  ldr  r0, [r1]
-  orr  r0, r0, r2
-  str  r0, [r1]
-  MEND
-
-  MACRO
-  MmioAnd32Macro $Address, $AndData
-  ldr  r1, =($Address)
-  ldr  r2, =($AndData)
-  ldr  r0, [r1]
-  and  r0, r0, r2
-  str  r0, [r1]
-  MEND
-
-  MACRO
-  MmioAndThenOr32Macro $Address, $AndData, $OrData
-  ldr  r1, =($Address)
-  ldr  r0, [r1]
-  ldr  r2, =($AndData)
-  and  r0, r0, r2
-  ldr  r2, =($OrData)
-  orr  r0, r0, r2
-  str  r0, [r1]
-  MEND
-
-  MACRO
-  MmioWriteFromReg32Macro $Address, $Reg
-  ldr  r1, =($Address)
-  str  $Reg, [r1]
-  MEND
-
-  MACRO
-  MmioRead32Macro $Address
-  ldr  r1, =($Address)
-  ldr  r0, [r1]
-  MEND
-
-  MACRO
-  MmioReadToReg32Macro $Address, $Reg
-  ldr  r1, =($Address)
-  ldr  $Reg, [r1]
-  MEND
-
-  MACRO
   LoadConstantMacro $Data
   ldr  r0, =($Data)
   MEND