diff mbox series

[RFC,1/4] Revert "hw/sd: Fix incorrect populated function switch status data structure"

Message ID 20201023131808.3198005-2-f4bug@amsat.org
State New
Headers show
Series tests/acceptance: Test U-Boot/Linux from Armbian 20.08 on Orange Pi PC | expand

Commit Message

Philippe Mathieu-Daudé Oct. 23, 2020, 1:18 p.m. UTC
This reverts commit b638627c723a8d0d2bb73489bc6bf9ff09b8d53a.

Currently booting U-Boot on the Orange Pi PC we get:

  console: U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:16:13 +0200)
  ...
  console: Autoboot in 1 seconds, press <Space> to stop
  console: =>
  console: => setenv extraargs 'printk.time=0 console=ttyS0,115200 loglevel=7 nosmp systemd.default_timeout_start_sec=9000 systemd.mask=armbian-zram-config.service systemd.mask=armbian-ramlog.service'
  console: => boot
  console: unable to select a mode
  console: Device 0: unknown device
  console: BOOTP broadcast 1
  console: DHCP client bound to address 10.0.2.15 (12 ms)
  console: *** Warning: no boot file name; using '0A00020F.img'
  console: Using ethernet@1c30000 device
  console: TFTP from server 10.0.2.2; our IP address is 10.0.2.15
  console: Filename '0A00020F.img'.
  console: Load address: 0x42000000
  console: Loading: *
  console: TFTP error: 'Access violation' (2)
  console: Not retrying...
  console: missing environment variable: pxeuuid
  console: missing environment variable: bootfile
  ...

With commit b638627c723 reverted:

  console: U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:16:13 +0200)
  ...
  console: Autoboot in 1 seconds, press <Space> to stop
  console: =>
  console: => setenv extraargs 'printk.time=0 console=ttyS0,115200 loglevel=7 nosmp systemd.default_timeout_start_sec=9000 systemd.mask=armbian-zram-config.service systemd.mask=armbian-ramlog.service'
  console: => boot
  console: switch to partitions #0, OK
  console: mmc0 is current device
  console: Scanning mmc 0:1...
  console: Found U-Boot script /boot/boot.scr
  console: 3967 bytes read in 16 ms (241.2 KiB/s)
  console: ## Executing script at 43100000
  console: U-boot loaded from SD
  console: Boot script loaded from mmc
  console: 153 bytes read in 10 ms (14.6 KiB/s)
  console: 11185760 bytes read in 6698 ms (1.6 MiB/s)
  console: 7788240 bytes read in 2966 ms (2.5 MiB/s)
  console: Found mainline kernel configuration
  console: 32121 bytes read in 50 ms (627 KiB/s)
  console: 4185 bytes read in 23 ms (176.8 KiB/s)
  console: Applying kernel provided DT fixup script (sun8i-h3-fixup.scr)
  console: ## Executing script at 45000000
  console: ## Loading init Ramdisk from Legacy Image at 43300000 ...
  console: Image Name:   uInitrd
  console: Image Type:   ARM Linux RAMDisk Image (gzip compressed)
  console: Data Size:    11185696 Bytes = 10.7 MiB
  console: Load Address: 00000000
  console: Entry Point:  00000000
  console: Verifying Checksum ... OK
  console: ## Flattened Device Tree blob at 43000000
  console: Booting using the fdt blob at 0x43000000
  console: Loading Ramdisk to 49555000, end 49fffe20 ... OK
  console: Loading Device Tree to 494e4000, end 49554fff ... OK
  console: Starting kernel ...
  console: Uncompressing Linux... done, booting the kernel.

Fixes: b638627c723 ("hw/sd: Fix incorrect populated function switch status data structure")
Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/sd/sd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Niek Linnenbank Oct. 24, 2020, 9:07 p.m. UTC | #1
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>

Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>


On Fri, Oct 23, 2020 at 3:18 PM Philippe Mathieu-Daudé <f4bug@amsat.org>
wrote:

> This reverts commit b638627c723a8d0d2bb73489bc6bf9ff09b8d53a.

>

> Currently booting U-Boot on the Orange Pi PC we get:

>

>   console: U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:16:13 +0200)

>   ...

>   console: Autoboot in 1 seconds, press <Space> to stop

>   console: =>

>   console: => setenv extraargs 'printk.time=0 console=ttyS0,115200

> loglevel=7 nosmp systemd.default_timeout_start_sec=9000

> systemd.mask=armbian-zram-config.service

> systemd.mask=armbian-ramlog.service'

>   console: => boot

>   console: unable to select a mode

>   console: Device 0: unknown device

>   console: BOOTP broadcast 1

>   console: DHCP client bound to address 10.0.2.15 (12 ms)

>   console: *** Warning: no boot file name; using '0A00020F.img'

>   console: Using ethernet@1c30000 device

>   console: TFTP from server 10.0.2.2; our IP address is 10.0.2.15

>   console: Filename '0A00020F.img'.

>   console: Load address: 0x42000000

>   console: Loading: *

>   console: TFTP error: 'Access violation' (2)

>   console: Not retrying...

>   console: missing environment variable: pxeuuid

>   console: missing environment variable: bootfile

>   ...

>

> With commit b638627c723 reverted:

>

>   console: U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:16:13 +0200)

>   ...

>   console: Autoboot in 1 seconds, press <Space> to stop

>   console: =>

>   console: => setenv extraargs 'printk.time=0 console=ttyS0,115200

> loglevel=7 nosmp systemd.default_timeout_start_sec=9000

> systemd.mask=armbian-zram-config.service

> systemd.mask=armbian-ramlog.service'

>   console: => boot

>   console: switch to partitions #0, OK

>   console: mmc0 is current device

>   console: Scanning mmc 0:1...

>   console: Found U-Boot script /boot/boot.scr

>   console: 3967 bytes read in 16 ms (241.2 KiB/s)

>   console: ## Executing script at 43100000

>   console: U-boot loaded from SD

>   console: Boot script loaded from mmc

>   console: 153 bytes read in 10 ms (14.6 KiB/s)

>   console: 11185760 bytes read in 6698 ms (1.6 MiB/s)

>   console: 7788240 bytes read in 2966 ms (2.5 MiB/s)

>   console: Found mainline kernel configuration

>   console: 32121 bytes read in 50 ms (627 KiB/s)

>   console: 4185 bytes read in 23 ms (176.8 KiB/s)

>   console: Applying kernel provided DT fixup script (sun8i-h3-fixup.scr)

>   console: ## Executing script at 45000000

>   console: ## Loading init Ramdisk from Legacy Image at 43300000 ...

>   console: Image Name:   uInitrd

>   console: Image Type:   ARM Linux RAMDisk Image (gzip compressed)

>   console: Data Size:    11185696 Bytes = 10.7 MiB

>   console: Load Address: 00000000

>   console: Entry Point:  00000000

>   console: Verifying Checksum ... OK

>   console: ## Flattened Device Tree blob at 43000000

>   console: Booting using the fdt blob at 0x43000000

>   console: Loading Ramdisk to 49555000, end 49fffe20 ... OK

>   console: Loading Device Tree to 494e4000, end 49554fff ... OK

>   console: Starting kernel ...

>   console: Uncompressing Linux... done, booting the kernel.

>

> Fixes: b638627c723 ("hw/sd: Fix incorrect populated function switch status

> data structure")

> Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>

> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

>  hw/sd/sd.c | 3 +--

>  1 file changed, 1 insertion(+), 2 deletions(-)

>

> diff --git a/hw/sd/sd.c b/hw/sd/sd.c

> index c3febed2434..c17197785bc 100644

> --- a/hw/sd/sd.c

> +++ b/hw/sd/sd.c

> @@ -823,12 +823,11 @@ static void sd_function_switch(SDState *sd, uint32_t

> arg)

>      sd->data[11] = 0x43;

>      sd->data[12] = 0x80;       /* Supported group 1 functions */

>      sd->data[13] = 0x03;

> -

>      for (i = 0; i < 6; i ++) {

>          new_func = (arg >> (i * 4)) & 0x0f;

>          if (mode && new_func != 0x0f)

>              sd->function_group[i] = new_func;

> -        sd->data[16 - (i >> 1)] |= new_func << ((i % 2) * 4);

> +        sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);

>      }

>      memset(&sd->data[17], 0, 47);

>      stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));

> --

> 2.26.2

>

>


-- 
Niek Linnenbank
<div dir="ltr"><div>Tested-by: Niek Linnenbank &lt;<a href="mailto:nieklinnenbank@gmail.com">nieklinnenbank@gmail.com</a>&gt;</div><div>Reviewed-by: Niek Linnenbank &lt;<a href="mailto:nieklinnenbank@gmail.com">nieklinnenbank@gmail.com</a>&gt;<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 23, 2020 at 3:18 PM Philippe Mathieu-Daudé &lt;<a href="mailto:f4bug@amsat.org">f4bug@amsat.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This reverts commit b638627c723a8d0d2bb73489bc6bf9ff09b8d53a.<br>
<br>
Currently booting U-Boot on the Orange Pi PC we get:<br>
<br>
  console: U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:16:13 +0200)<br>
  ...<br>
  console: Autoboot in 1 seconds, press &lt;Space&gt; to stop<br>
  console: =&gt;<br>
  console: =&gt; setenv extraargs &#39;printk.time=0 console=ttyS0,115200 loglevel=7 nosmp systemd.default_timeout_start_sec=9000 systemd.mask=armbian-zram-config.service systemd.mask=armbian-ramlog.service&#39;<br>
  console: =&gt; boot<br>
  console: unable to select a mode<br>
  console: Device 0: unknown device<br>
  console: BOOTP broadcast 1<br>
  console: DHCP client bound to address 10.0.2.15 (12 ms)<br>
  console: *** Warning: no boot file name; using &#39;0A00020F.img&#39;<br>
  console: Using ethernet@1c30000 device<br>
  console: TFTP from server 10.0.2.2; our IP address is 10.0.2.15<br>
  console: Filename &#39;0A00020F.img&#39;.<br>
  console: Load address: 0x42000000<br>
  console: Loading: *<br>
  console: TFTP error: &#39;Access violation&#39; (2)<br>
  console: Not retrying...<br>
  console: missing environment variable: pxeuuid<br>
  console: missing environment variable: bootfile<br>
  ...<br>
<br>
With commit b638627c723 reverted:<br>
<br>
  console: U-Boot SPL 2020.04-armbian (Sep 02 2020 - 10:16:13 +0200)<br>
  ...<br>
  console: Autoboot in 1 seconds, press &lt;Space&gt; to stop<br>
  console: =&gt;<br>
  console: =&gt; setenv extraargs &#39;printk.time=0 console=ttyS0,115200 loglevel=7 nosmp systemd.default_timeout_start_sec=9000 systemd.mask=armbian-zram-config.service systemd.mask=armbian-ramlog.service&#39;<br>
  console: =&gt; boot<br>
  console: switch to partitions #0, OK<br>
  console: mmc0 is current device<br>
  console: Scanning mmc 0:1...<br>
  console: Found U-Boot script /boot/boot.scr<br>
  console: 3967 bytes read in 16 ms (241.2 KiB/s)<br>
  console: ## Executing script at 43100000<br>
  console: U-boot loaded from SD<br>
  console: Boot script loaded from mmc<br>
  console: 153 bytes read in 10 ms (14.6 KiB/s)<br>
  console: 11185760 bytes read in 6698 ms (1.6 MiB/s)<br>
  console: 7788240 bytes read in 2966 ms (2.5 MiB/s)<br>
  console: Found mainline kernel configuration<br>
  console: 32121 bytes read in 50 ms (627 KiB/s)<br>
  console: 4185 bytes read in 23 ms (176.8 KiB/s)<br>
  console: Applying kernel provided DT fixup script (sun8i-h3-fixup.scr)<br>
  console: ## Executing script at 45000000<br>
  console: ## Loading init Ramdisk from Legacy Image at 43300000 ...<br>
  console: Image Name:   uInitrd<br>
  console: Image Type:   ARM Linux RAMDisk Image (gzip compressed)<br>
  console: Data Size:    11185696 Bytes = 10.7 MiB<br>
  console: Load Address: 00000000<br>
  console: Entry Point:  00000000<br>
  console: Verifying Checksum ... OK<br>
  console: ## Flattened Device Tree blob at 43000000<br>
  console: Booting using the fdt blob at 0x43000000<br>
  console: Loading Ramdisk to 49555000, end 49fffe20 ... OK<br>
  console: Loading Device Tree to 494e4000, end 49554fff ... OK<br>
  console: Starting kernel ...<br>
  console: Uncompressing Linux... done, booting the kernel.<br>
<br>
Fixes: b638627c723 (&quot;hw/sd: Fix incorrect populated function switch status data structure&quot;)<br>
Reported-by: Michael Roth &lt;<a href="mailto:mdroth@linux.vnet.ibm.com" target="_blank">mdroth@linux.vnet.ibm.com</a>&gt;<br>
Signed-off-by: Philippe Mathieu-Daudé &lt;<a href="mailto:f4bug@amsat.org" target="_blank">f4bug@amsat.org</a>&gt;<br>

---<br>
 hw/sd/sd.c | 3 +--<br>
 1 file changed, 1 insertion(+), 2 deletions(-)<br>
<br>
diff --git a/hw/sd/sd.c b/hw/sd/sd.c<br>
index c3febed2434..c17197785bc 100644<br>
--- a/hw/sd/sd.c<br>
+++ b/hw/sd/sd.c<br>
@@ -823,12 +823,11 @@ static void sd_function_switch(SDState *sd, uint32_t arg)<br>
     sd-&gt;data[11] = 0x43;<br>
     sd-&gt;data[12] = 0x80;       /* Supported group 1 functions */<br>
     sd-&gt;data[13] = 0x03;<br>
-<br>
     for (i = 0; i &lt; 6; i ++) {<br>
         new_func = (arg &gt;&gt; (i * 4)) &amp; 0x0f;<br>
         if (mode &amp;&amp; new_func != 0x0f)<br>
             sd-&gt;function_group[i] = new_func;<br>
-        sd-&gt;data[16 - (i &gt;&gt; 1)] |= new_func &lt;&lt; ((i % 2) * 4);<br>
+        sd-&gt;data[14 + (i &gt;&gt; 1)] = new_func &lt;&lt; ((i * 4) &amp; 4);<br>
     }<br>
     memset(&amp;sd-&gt;data[17], 0, 47);<br>
     stw_be_p(sd-&gt;data + 64, sd_crc16(sd-&gt;data, 64));<br>
-- <br>
2.26.2<br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Niek Linnenbank<br><br></div></div></div></div>
diff mbox series

Patch

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index c3febed2434..c17197785bc 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -823,12 +823,11 @@  static void sd_function_switch(SDState *sd, uint32_t arg)
     sd->data[11] = 0x43;
     sd->data[12] = 0x80;	/* Supported group 1 functions */
     sd->data[13] = 0x03;
-
     for (i = 0; i < 6; i ++) {
         new_func = (arg >> (i * 4)) & 0x0f;
         if (mode && new_func != 0x0f)
             sd->function_group[i] = new_func;
-        sd->data[16 - (i >> 1)] |= new_func << ((i % 2) * 4);
+        sd->data[14 + (i >> 1)] = new_func << ((i * 4) & 4);
     }
     memset(&sd->data[17], 0, 47);
     stw_be_p(sd->data + 64, sd_crc16(sd->data, 64));