Commit graph

3 commits

Author SHA1 Message Date
Nicholas Sudsgaard
33b2fb93bb util/hda-decoder: Add feature to print configuration defaults as verbs
This feature simply goes through pin configurations stored in a file and
converts them into their corresponding verbs. This can be useful when
trying to find verb data stored inside a binary (e.g. when reverse
engineering).

Input:
	0x16 0x04211040
	0x17 0x91170110
	0x18 0x40f001f0

Output:
	address: 0, node ID: 0x16, configuration default: 0x04211040
	  0x01671c40
	  0x01671d10
	  0x01671e21
	  0x01671f04
	address: 0, node ID: 0x17, configuration default: 0x91170110
	  0x01771c10
	  0x01771d01
	  0x01771e17
	  0x01771f91
	address: 0, node ID: 0x18, configuration default: 0x40f001f0
	  0x01871cf0
	  0x01871d01
	  0x01871ef0
	  0x01871f40

Change-Id: I1fb74ff4b2b654987fd25ee32d0f94e5f2f783e3
Signed-off-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84669
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2024-10-07 21:10:03 +00:00
Maxim Polyakov
7f68483e28 util/hda-decoder: Protect 'fields' slice if empty string
This avoids panic if the file contains an empty string or an incorrect
configuration:

goroutine 1 [running]:
main.decodeFile({0x7ffd63da92a0?, 0xc000014070?}, 0x8?)
	/path/to/coreboot/util/hda-decoder/main.go:72 +0x2ef
main.main()
	/path/to/coreboot/util/hda-decoder/main.go:158 +0x2a5

Change-Id: I9ae8544e52d82e8d8a82a88a85a2de7d2f295ec1
Signed-off-by: Maxim Polyakov <max.senia.poliak@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84101
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
2024-08-29 12:32:01 +00:00
Nicholas Sudsgaard
b205f4e53e util: Add hda-decoder
This tool helps take off the burden of manually decoding default
configuration registers. Using decoded values can make code more
self-documenting compared to shrouding it with magic numbers.

This is also written as a module which allows easy integration with
other tools written in Go (e.g. autoport).

Change-Id: Ib4fb652e178517b2b7aceaac8be005c5b2d3b03e
Signed-off-by: Nicholas Sudsgaard <devel+coreboot@nsudsgaard.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/80470
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
2024-07-15 07:22:32 +00:00