jtag: drivers: bcm2835gpio: don't allow GPIOs > 31 58/6658/2
authorPaul Fertser <fercerpav@gmail.com>
Sat, 9 Oct 2021 20:32:01 +0000 (23:32 +0300)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 5 Nov 2021 22:44:47 +0000 (22:44 +0000)
Current code assumes all the GPIO signals are manipulated via a single
32-bit register so using higher GPIOs silently fails.

Fix the check instead of trying to handle additional GPIOs (available on
Raspberry Pi Compute Modules) as that would slow the driver down.

Change-Id: Ib3b5864afb3b972d952f9b74665201cd93924959
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6658
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
doc/openocd.texi
src/jtag/drivers/bcm2835gpio.c

index cd64c7aecbd34d600af1283f52dd378889e7b420..01bb4f21d11a6733f63a6e51b7c789b434001c3c 100644 (file)
@@ -3207,6 +3207,8 @@ able to coexist nicely with both sysfs bitbanging and various
 peripherals' kernel drivers. The driver restores the previous
 configuration on exit.
 
+GPIO numbers >= 32 can't be used for performance reasons.
+
 See @file{interface/raspberrypi-native.cfg} for a sample config and
 pinout.
 
index 95e077c3343d1592296464ed1a069d0a6754a4bf..fd6c28b964a203f12ff715bb8b8dbfff839dbd66 100644 (file)
@@ -198,7 +198,7 @@ static int bcm2835gpio_speed(int speed)
 
 static int is_gpio_valid(int gpio)
 {
-       return gpio >= 0 && gpio <= 53;
+       return gpio >= 0 && gpio <= 31;
 }
 
 COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionums)

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)