diff mbox

rtas: Improve rtas-do-config-@ and rtas-do-config-! a little bit

Message ID 1475676665-4755-1-git-send-email-thuth@redhat.com
State Accepted
Headers show

Commit Message

Thomas Huth Oct. 5, 2016, 2:11 p.m. UTC
As soon as we are booting with at least one PCI device, the
rtas-do-config-@ Forth word is called quite often, so it
makes sense that we look up the corresponding RTAS token
only once instead of each time the function is called.
Also the "ffffffff and" operation on the lower half of the
PUID is not really required and can be removed, since the
"l!" Forth word is storing the lower four bytes only anyway.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 board-qemu/slof/rtas.fs | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Alexey Kardashevskiy Oct. 12, 2016, 1:04 a.m. UTC | #1
On 06/10/16 01:11, Thomas Huth wrote:
> As soon as we are booting with at least one PCI device, the
> rtas-do-config-@ Forth word is called quite often, so it
> makes sense that we look up the corresponding RTAS token
> only once instead of each time the function is called.
> Also the "ffffffff and" operation on the lower half of the
> PUID is not really required and can be removed, since the
> "l!" Forth word is storing the lower four bytes only anyway.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Thanks, applied.

> ---
>  board-qemu/slof/rtas.fs | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/board-qemu/slof/rtas.fs b/board-qemu/slof/rtas.fs
> index 2e10b0a..54d3929 100644
> --- a/board-qemu/slof/rtas.fs
> +++ b/board-qemu/slof/rtas.fs
> @@ -108,12 +108,11 @@ find-qemu-rtas
>  0 value puid
>  
>  : rtas-do-config-@ ( config-addr size -- value)
> -    \ We really want to cache this !
> -    " ibm,read-pci-config" rtas-get-token rtas-cb rtas>token l!
> +    [ s" ibm,read-pci-config" rtas-get-token ] LITERAL rtas-cb rtas>token l!
>      4 rtas-cb rtas>nargs l!
>      2 rtas-cb rtas>nret l!
>      ( addr size ) rtas-cb rtas>args3 l!
> -    puid ffffffff and rtas-cb rtas>args2 l!
> +    puid rtas-cb rtas>args2 l!
>      puid 20 rshift rtas-cb rtas>args1 l!
>      ( addr ) rtas-cb rtas>args0 l!
>      enter-rtas
> @@ -127,12 +126,11 @@ find-qemu-rtas
>  ;
>  
>  : rtas-do-config-! ( value config-addr size )
> -    \ We really want to cache this !
> -    " ibm,write-pci-config" rtas-get-token rtas-cb rtas>token l!
> +    [ s" ibm,write-pci-config" rtas-get-token ] LITERAL rtas-cb rtas>token l!
>      5 rtas-cb rtas>nargs l!
>      1 rtas-cb rtas>nret l!
>      ( value addr size ) rtas-cb rtas>args3 l!
> -    puid ffffffff and rtas-cb rtas>args2 l!
> +    puid rtas-cb rtas>args2 l!
>      puid 20 rshift rtas-cb rtas>args1 l!
>      ( value addr ) rtas-cb rtas>args0 l!
>      ( value ) rtas-cb rtas>args4 l!
>
diff mbox

Patch

diff --git a/board-qemu/slof/rtas.fs b/board-qemu/slof/rtas.fs
index 2e10b0a..54d3929 100644
--- a/board-qemu/slof/rtas.fs
+++ b/board-qemu/slof/rtas.fs
@@ -108,12 +108,11 @@  find-qemu-rtas
 0 value puid
 
 : rtas-do-config-@ ( config-addr size -- value)
-    \ We really want to cache this !
-    " ibm,read-pci-config" rtas-get-token rtas-cb rtas>token l!
+    [ s" ibm,read-pci-config" rtas-get-token ] LITERAL rtas-cb rtas>token l!
     4 rtas-cb rtas>nargs l!
     2 rtas-cb rtas>nret l!
     ( addr size ) rtas-cb rtas>args3 l!
-    puid ffffffff and rtas-cb rtas>args2 l!
+    puid rtas-cb rtas>args2 l!
     puid 20 rshift rtas-cb rtas>args1 l!
     ( addr ) rtas-cb rtas>args0 l!
     enter-rtas
@@ -127,12 +126,11 @@  find-qemu-rtas
 ;
 
 : rtas-do-config-! ( value config-addr size )
-    \ We really want to cache this !
-    " ibm,write-pci-config" rtas-get-token rtas-cb rtas>token l!
+    [ s" ibm,write-pci-config" rtas-get-token ] LITERAL rtas-cb rtas>token l!
     5 rtas-cb rtas>nargs l!
     1 rtas-cb rtas>nret l!
     ( value addr size ) rtas-cb rtas>args3 l!
-    puid ffffffff and rtas-cb rtas>args2 l!
+    puid rtas-cb rtas>args2 l!
     puid 20 rshift rtas-cb rtas>args1 l!
     ( value addr ) rtas-cb rtas>args0 l!
     ( value ) rtas-cb rtas>args4 l!