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>
This commit is contained in:
Nicholas Sudsgaard 2024-10-05 05:25:51 +00:00 committed by Martin L Roth
commit 33b2fb93bb
3 changed files with 86 additions and 12 deletions

View file

@ -177,3 +177,12 @@ func ToHumanReadable(fields Fields[uint32]) Fields[string] {
Sequence: fmt.Sprintf("%d", fields.Sequence),
}
}
func ConfigToVerbs(address uint32, nodeId uint32, config uint32) [4]uint32 {
return [4]uint32{
(address << 28) | (nodeId << 20) | (0x71c << 8) | ((config >> 0) & 0xff),
(address << 28) | (nodeId << 20) | (0x71d << 8) | ((config >> 8) & 0xff),
(address << 28) | (nodeId << 20) | (0x71e << 8) | ((config >> 16) & 0xff),
(address << 28) | (nodeId << 20) | (0x71f << 8) | ((config >> 24) & 0xff),
}
}