coreboot-kgpe-d16/src/lib
Julius Werner 886d29bcd8 gpio: Remove non-ternary tristate mode, make ternaries easier
The function to read board IDs from tristate GPIOs currently supports
two output modes: a normal base-3 integer, or a custom format where
every two bits represent one tristate pin. Each board decides which
representation to use on its own, which is inconsistent and provides
another possible gotcha to trip over when reading unfamiliar code.

The two-bits-per-pin format creates the additional problem that a
complete list of IDs (such as some boards use to build board-ID tables)
necessarily has "holes" in them (since 0b11 does not correspond to a
possible pin state), which makes them extremely tricky to write, read
and expand. It's also very unintuitive in my opinion, although it was
intended to make it easier to read individual pin states from a hex
representation.

This patch switches all boards over to base-3 and removes the other
format to improve consistency. The tristate reading function will just
print the pin states as they are read to make it easier to debug them,
and we add a new BASE3() macro that can generate ternary numbers from
pin states. Also change the order of all static initializers of board ID
pin lists to write the most significant bit first, hoping that this can
help clear up confusion about the endianness of the pins.

CQ-DEPEND=CL:219902
BUG=None
TEST=Booted on a Nyan_Blaze (with board ID 1, unfortunately the only one
I have). Compiled on Daisy, Peach_Pit, Nyan, Nyan_Big, Nyan_Blaze, Rush,
Rush_Ryu, Storm, Veryon_Pinky and Falco for good measure.

Change-Id: I3ce5a0829f260db7d7df77e6788c2c6d13901b8f
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 2fa9545ac431c9af111ee4444d593ee4cf49554d
Original-Change-Id: I6133cdaf01ed6590ae07e88d9e85a33dc013211a
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/219901
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/9401
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
2015-04-10 11:57:44 +02:00
..
loaders New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
Makefile.inc timer: Add generic udelay() implementation 2015-04-08 18:35:01 +02:00
bootblock.ld New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
bootmem.c coreboot: introduce notion of bootmem for memory map at boot 2014-03-03 21:47:27 +01:00
bootmode.c ChromeOS: Remove oprom_is_loaded 2014-05-01 15:39:26 +02:00
cbfs.c cbfs: Enforce media->map() result checking, improve error messages 2015-04-07 23:02:18 +02:00
cbfs_core.c cbfs: expose init_backing_media() 2015-03-24 22:48:51 +01:00
cbfs_core.h build system: rename __BOOT_BLOCK__ and __VER_STAGE__ 2015-04-04 20:07:18 +02:00
cbfs_spi.c New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
cbmem_common.c coreboot: fix munged license text 2015-03-09 02:32:19 +01:00
cbmem_console.c New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
clog2.c src/lib/clog2.c: Fix style and clarity, remove some cruft 2014-06-20 08:06:51 +02:00
compute_ip_checksum.c lib: Fix spelling 2013-07-10 20:17:51 +02:00
coreboot_table.c chromeos: move VPD MAC address retrieval function 2015-04-10 11:57:24 +02:00
debug.c misc: Drop print_ implementation from non-romcc boards 2015-01-09 06:12:22 +01:00
delay.c
dynamic_cbmem.c hardwaremain: explicitly call cbmem_initialize() early 2015-04-07 23:02:32 +02:00
edid.c drivers/xgi/z9s: Port Linux framebuffer initialization to coreboot 2015-02-05 17:37:05 +01:00
fallback_boot.c lib: Add Kconfig option to enable/disable auto fallback control 2015-03-17 04:22:23 +01:00
gcc.c lib: Trivial - drop trailing blank lines at EOF 2014-07-08 13:52:15 +02:00
gcov-glue.c bootstate: use structure pointers for scheduling callbacks 2015-03-18 16:41:43 +01:00
gcov-io.c
gcov-io.h lib: Fix spelling 2013-07-10 20:17:51 +02:00
gcov-iov.h
generic_dump_spd.c misc: Drop print_ implementation from non-romcc boards 2015-01-09 06:12:22 +01:00
generic_sdram.c misc: Drop print_ implementation from non-romcc boards 2015-01-09 06:12:22 +01:00
halt.c Introduce halt() 2014-11-30 12:20:05 +01:00
hardwaremain.c hardwaremain: explicitly call cbmem_initialize() early 2015-04-07 23:02:32 +02:00
hexdump.c lib/hexdump: Use `size_t` for length parameter of `hexdump32()` 2014-05-05 08:59:05 +02:00
jpeg.c
jpeg.h
libgcov.c Fix whitespace leaked into tree 2013-09-17 21:04:35 +02:00
lzma.c Add and consistently use wrapper macro for romstage static variables 2015-03-09 22:42:28 +01:00
lzmadecode.c RISCV: get RISCV to build again 2014-12-04 19:17:51 +01:00
lzmadecode.h
malloc.c lib/malloc.c: Remove pre-proc guard around include 2014-11-11 12:33:01 +01:00
memchr.c
memcmp.c
memcpy.c
memmove.c
memrange.c coreboot memrange: Two changes for zero size or empty memrange 2015-03-04 19:55:19 +01:00
memset.c
primitive_memtest.c Primitive memory test 2015-01-09 16:50:55 +01:00
prog_ops.c program loading: add prog_run() function 2015-04-03 14:52:47 +02:00
ramstage.ld New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
ramstage_cache.c program loading: introduce struct prog 2015-04-03 14:51:51 +02:00
ramtest.c misc: Drop print_ implementation from non-romcc boards 2015-01-09 06:12:22 +01:00
reg_script.c baytrail: Change all SoC headers to <soc/headername.h> system 2015-04-07 18:23:21 +02:00
rmodule.c rmodule: remove cbmem_entry usage 2015-04-07 23:03:45 +02:00
rmodule.ld New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
romstage.ld New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
selfboot.c New mechanism to define SRAM/memory map with automatic bounds checking 2015-04-06 22:05:01 +02:00
stack.c stack check: cosmetics 2014-09-12 22:03:53 +02:00
thread.c Possible thread stack implementation. 2014-08-07 23:55:15 +02:00
timer.c timer: Add generic udelay() implementation 2015-04-08 18:35:01 +02:00
timer_queue.c
timestamp.c timestamps: Switch from tsc_t to uint64_t 2015-01-05 22:21:49 +01:00
tlcl.c vboot2: read secdata and nvdata 2015-03-23 19:51:47 +01:00
tlcl_internal.h vboot2: read secdata and nvdata 2015-03-23 19:51:47 +01:00
tlcl_structures.h vboot2: copy tlcl from vboot_reference as a preparation for vboot2 integration 2015-01-27 01:43:57 +01:00
tpm_error_messages.h TPM: Fix whitespace 2015-02-06 00:25:59 +01:00
trace.c
tristate_gpios.c gpio: Remove non-ternary tristate mode, make ternaries easier 2015-04-10 11:57:44 +02:00
version.c build.h: remove variable for the builduser, -hostname and -domain 2015-03-09 17:53:16 +01:00