public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm'
@ 2018-03-01  9:38 Ard Biesheuvel
  2018-03-01 15:09 ` Carsey, Jaben
  0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2018-03-01  9:38 UTC (permalink / raw)
  To: edk2-devel; +Cc: heyi.guo, ruiyu.ni, jaben.carsey, Ard Biesheuvel

Neither the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL nor the EFI_CPU_IO2_PROTOCOL
impose any restrictions when it comes to the range of valid I/O
addresses. Even so, the 'mm' command in -IO mode refuses to perform
accesses to addresses >= 0xffff.

It is not up to 'mm' to impose this restriction, so remove it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c                           | 11 -----------
 ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni |  2 --
 2 files changed, 13 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
index 9f97f1d345f7..d1fd42b1cd4d 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
@@ -525,12 +525,6 @@ ShellCommandRunMm (
       goto Done;
     }
 
-    if ((AccessType == ShellMmIo) && (Address + Size > MAX_UINT16 + 1)) {
-      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_IO_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm");
-      ShellStatus = SHELL_INVALID_PARAMETER;
-      goto Done;
-    }
-
     //
     // locate IO protocol interface
     //
@@ -592,11 +586,6 @@ ShellCommandRunMm (
     //
     Complete = FALSE;
     do {
-      if ((AccessType == ShellMmIo) && (Address + Size > MAX_UINT16 + 1)) {
-        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS_RANGE2), gShellDebug1HiiHandle, L"mm");
-        break;
-      }
-
       ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address, Size, &Buffer);
       ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType], gShellDebug1HiiHandle);
       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni
index b6a133a45444..011a7bfc2db6 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.uni
@@ -128,7 +128,6 @@
 
 #string STR_MM_NOT_ALIGNED        #language en-US "%H%s%N: Address parameter %016LX is not aligned.\r\n"
 #string STR_MM_PCIE_ADDRESS_RANGE #language en-US "%H%s%N: Address parameter %016LX is not a valid PCI/PCIE address.\r\n"
-#string STR_MM_IO_ADDRESS_RANGE   #language en-US "%H%s%N: IO address out of range 0 - 0xFFFF\r\n"
 #string STR_MM_MMIO               #language en-US "%HMMIO%N"
 #string STR_MM_IO                 #language en-US "%HIO%N"
 #string STR_MM_PCI                #language en-US "%HPCI%N"
@@ -136,7 +135,6 @@
 #string STR_MM_PCIE               #language en-US "%HPCIE%N"
 #string STR_MM_ADDRESS            #language en-US "  0x%016lx : "
 #string STR_MM_BUF                #language en-US "0x%0*lx"
-#string STR_MM_ADDRESS_RANGE2     #language en-US "%H%s%N: IO address out of range\r\n"
 #string STR_MM_ERROR              #language en-US "%H%s%N: Input had incorrect format\r\n"
 
 #string STR_SETVAR_PRINT          #language en-US "%g - %s - %04x Bytes\r\n"
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm'
  2018-03-01  9:38 [PATCH] ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm' Ard Biesheuvel
@ 2018-03-01 15:09 ` Carsey, Jaben
  2018-03-01 17:02   ` Ard Biesheuvel
  0 siblings, 1 reply; 3+ messages in thread
From: Carsey, Jaben @ 2018-03-01 15:09 UTC (permalink / raw)
  To: Ard Biesheuvel, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu, heyi.guo@linaro.org

Good catch. I wonder why that arbitrary restriction originated.

Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Ard Biesheuvel
> Sent: Thursday, March 01, 2018 1:39 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
> <jaben.carsey@intel.com>; heyi.guo@linaro.org; Ard Biesheuvel
> <ard.biesheuvel@linaro.org>
> Subject: [edk2] [PATCH] ShellPkg/UefiShellDebug1CommandsLib: remove
> I/O address limit from 'mm'
> Importance: High
> 
> Neither the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL nor the
> EFI_CPU_IO2_PROTOCOL
> impose any restrictions when it comes to the range of valid I/O
> addresses. Even so, the 'mm' command in -IO mode refuses to perform
> accesses to addresses >= 0xffff.
> 
> It is not up to 'mm' to impose this restriction, so remove it.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c                           | 11 -----
> ------
> 
> ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands
> Lib.uni |  2 --
>  2 files changed, 13 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> index 9f97f1d345f7..d1fd42b1cd4d 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
> @@ -525,12 +525,6 @@ ShellCommandRunMm (
>        goto Done;
>      }
> 
> -    if ((AccessType == ShellMmIo) && (Address + Size > MAX_UINT16 + 1)) {
> -      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_MM_IO_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm");
> -      ShellStatus = SHELL_INVALID_PARAMETER;
> -      goto Done;
> -    }
> -
>      //
>      // locate IO protocol interface
>      //
> @@ -592,11 +586,6 @@ ShellCommandRunMm (
>      //
>      Complete = FALSE;
>      do {
> -      if ((AccessType == ShellMmIo) && (Address + Size > MAX_UINT16 + 1)) {
> -        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
> (STR_MM_ADDRESS_RANGE2), gShellDebug1HiiHandle, L"mm");
> -        break;
> -      }
> -
>        ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address,
> Size, &Buffer);
>        ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType],
> gShellDebug1HiiHandle);
>        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS),
> gShellDebug1HiiHandle, Address);
> diff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.uni
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.uni
> index b6a133a45444..011a7bfc2db6 100644
> ---
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.uni
> +++
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
> dsLib.uni
> @@ -128,7 +128,6 @@
> 
>  #string STR_MM_NOT_ALIGNED        #language en-US "%H%s%N: Address
> parameter %016LX is not aligned.\r\n"
>  #string STR_MM_PCIE_ADDRESS_RANGE #language en-US "%H%s%N:
> Address parameter %016LX is not a valid PCI/PCIE address.\r\n"
> -#string STR_MM_IO_ADDRESS_RANGE   #language en-US "%H%s%N: IO
> address out of range 0 - 0xFFFF\r\n"
>  #string STR_MM_MMIO               #language en-US "%HMMIO%N"
>  #string STR_MM_IO                 #language en-US "%HIO%N"
>  #string STR_MM_PCI                #language en-US "%HPCI%N"
> @@ -136,7 +135,6 @@
>  #string STR_MM_PCIE               #language en-US "%HPCIE%N"
>  #string STR_MM_ADDRESS            #language en-US "  0x%016lx : "
>  #string STR_MM_BUF                #language en-US "0x%0*lx"
> -#string STR_MM_ADDRESS_RANGE2     #language en-US "%H%s%N: IO
> address out of range\r\n"
>  #string STR_MM_ERROR              #language en-US "%H%s%N: Input had
> incorrect format\r\n"
> 
>  #string STR_SETVAR_PRINT          #language en-US "%g - %s - %04x Bytes\r\n"
> --
> 2.11.0
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm'
  2018-03-01 15:09 ` Carsey, Jaben
@ 2018-03-01 17:02   ` Ard Biesheuvel
  0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2018-03-01 17:02 UTC (permalink / raw)
  To: Carsey, Jaben; +Cc: edk2-devel@lists.01.org, Ni, Ruiyu, heyi.guo@linaro.org

On 1 March 2018 at 15:09, Carsey, Jaben <jaben.carsey@intel.com> wrote:
> Good catch. I wonder why that arbitrary restriction originated.
>
> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
>

Thanks

Pushed as 23b53ede358d


>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Ard Biesheuvel
>> Sent: Thursday, March 01, 2018 1:39 AM
>> To: edk2-devel@lists.01.org
>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Carsey, Jaben
>> <jaben.carsey@intel.com>; heyi.guo@linaro.org; Ard Biesheuvel
>> <ard.biesheuvel@linaro.org>
>> Subject: [edk2] [PATCH] ShellPkg/UefiShellDebug1CommandsLib: remove
>> I/O address limit from 'mm'
>> Importance: High
>>
>> Neither the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL nor the
>> EFI_CPU_IO2_PROTOCOL
>> impose any restrictions when it comes to the range of valid I/O
>> addresses. Even so, the 'mm' command in -IO mode refuses to perform
>> accesses to addresses >= 0xffff.
>>
>> It is not up to 'mm' to impose this restriction, so remove it.
>>
>> Contributed-under: TianoCore Contribution Agreement 1.1
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>  ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c                           | 11 -----
>> ------
>>
>> ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Commands
>> Lib.uni |  2 --
>>  2 files changed, 13 deletions(-)
>>
>> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
>> b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
>> index 9f97f1d345f7..d1fd42b1cd4d 100644
>> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
>> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
>> @@ -525,12 +525,6 @@ ShellCommandRunMm (
>>        goto Done;
>>      }
>>
>> -    if ((AccessType == ShellMmIo) && (Address + Size > MAX_UINT16 + 1)) {
>> -      ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
>> (STR_MM_IO_ADDRESS_RANGE), gShellDebug1HiiHandle, L"mm");
>> -      ShellStatus = SHELL_INVALID_PARAMETER;
>> -      goto Done;
>> -    }
>> -
>>      //
>>      // locate IO protocol interface
>>      //
>> @@ -592,11 +586,6 @@ ShellCommandRunMm (
>>      //
>>      Complete = FALSE;
>>      do {
>> -      if ((AccessType == ShellMmIo) && (Address + Size > MAX_UINT16 + 1)) {
>> -        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN
>> (STR_MM_ADDRESS_RANGE2), gShellDebug1HiiHandle, L"mm");
>> -        break;
>> -      }
>> -
>>        ShellMmAccess (AccessType, PciRootBridgeIo, CpuIo, TRUE, Address,
>> Size, &Buffer);
>>        ShellPrintHiiEx (-1, -1, NULL, mShellMmAccessTypeStr[AccessType],
>> gShellDebug1HiiHandle);
>>        ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS),
>> gShellDebug1HiiHandle, Address);
>> diff --git
>> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
>> dsLib.uni
>> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
>> dsLib.uni
>> index b6a133a45444..011a7bfc2db6 100644
>> ---
>> a/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
>> dsLib.uni
>> +++
>> b/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comman
>> dsLib.uni
>> @@ -128,7 +128,6 @@
>>
>>  #string STR_MM_NOT_ALIGNED        #language en-US "%H%s%N: Address
>> parameter %016LX is not aligned.\r\n"
>>  #string STR_MM_PCIE_ADDRESS_RANGE #language en-US "%H%s%N:
>> Address parameter %016LX is not a valid PCI/PCIE address.\r\n"
>> -#string STR_MM_IO_ADDRESS_RANGE   #language en-US "%H%s%N: IO
>> address out of range 0 - 0xFFFF\r\n"
>>  #string STR_MM_MMIO               #language en-US "%HMMIO%N"
>>  #string STR_MM_IO                 #language en-US "%HIO%N"
>>  #string STR_MM_PCI                #language en-US "%HPCI%N"
>> @@ -136,7 +135,6 @@
>>  #string STR_MM_PCIE               #language en-US "%HPCIE%N"
>>  #string STR_MM_ADDRESS            #language en-US "  0x%016lx : "
>>  #string STR_MM_BUF                #language en-US "0x%0*lx"
>> -#string STR_MM_ADDRESS_RANGE2     #language en-US "%H%s%N: IO
>> address out of range\r\n"
>>  #string STR_MM_ERROR              #language en-US "%H%s%N: Input had
>> incorrect format\r\n"
>>
>>  #string STR_SETVAR_PRINT          #language en-US "%g - %s - %04x Bytes\r\n"
>> --
>> 2.11.0
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-01 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-01  9:38 [PATCH] ShellPkg/UefiShellDebug1CommandsLib: remove I/O address limit from 'mm' Ard Biesheuvel
2018-03-01 15:09 ` Carsey, Jaben
2018-03-01 17:02   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox