1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-02 14:33:18 +02:00

tree/: Convert flashchip decode range func ptr to enum

Replace the `decode_range` function pointer in `struct flashchip` to an
enum value. The enum value can be used to find the corresponding
function pointer by passing it to `lookup_decode_range_func_ptr()`.

Removing function pointers like `decode_range` makes it possible to represent chip data in a declarative format that does not have to be
stored as C source code.

BUG=b:242479049
BRANCH=none
TEST=ninja && ninja test

Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Change-Id: If6d08d414d3d1ddadc95ca1d407fc87c23ab543d
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67195
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nikolai Artemiev
2022-08-30 11:11:13 +10:00
committed by Edward O'Callaghan
parent bd8a02de6c
commit 2e00f73671
4 changed files with 51 additions and 28 deletions

View File

@ -2451,7 +2451,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -5183,7 +5183,7 @@ const struct flashchip flashchips[] = {
.bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}},
.tb = {STATUS1, 5, RW}, /* Called BP3 in datasheet, acts like TB */
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -6371,7 +6371,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -6537,7 +6537,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -6665,7 +6665,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -6798,7 +6798,7 @@ const struct flashchip flashchips[] = {
.bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}, {STATUS1, 5, RW}},
.tb = {STATUS1, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -6847,7 +6847,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -6969,7 +6969,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW}, /* Called BP4 in datasheet, acts like SEC */
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -16236,7 +16236,7 @@ const struct flashchip flashchips[] = {
.cmp = {STATUS2, 6, RW},
.wps = {STATUS3, 2, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -16729,7 +16729,7 @@ const struct flashchip flashchips[] = {
.cmp = {STATUS2, 6, RW},
.wps = {STATUS3, 2, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -17347,7 +17347,7 @@ const struct flashchip flashchips[] = {
.cmp = {STATUS2, 6, RW},
.wps = {STATUS3, 2, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -17395,7 +17395,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -17445,7 +17445,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -17493,7 +17493,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -17663,7 +17663,7 @@ const struct flashchip flashchips[] = {
.tb = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -17718,7 +17718,7 @@ const struct flashchip flashchips[] = {
.tb = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -17773,7 +17773,7 @@ const struct flashchip flashchips[] = {
.tb = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -18238,7 +18238,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -18290,7 +18290,7 @@ const struct flashchip flashchips[] = {
.cmp = {STATUS2, 6, RW},
.wps = {STATUS3, 2, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -18380,7 +18380,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -19752,7 +19752,7 @@ const struct flashchip flashchips[] = {
.sec = {STATUS1, 6, RW},
.cmp = {STATUS2, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{
@ -19842,7 +19842,7 @@ const struct flashchip flashchips[] = {
.bp = {{STATUS1, 2, RW}, {STATUS1, 3, RW}, {STATUS1, 4, RW}, {STATUS1, 5, RW}},
.tb = {STATUS1, 6, RW},
},
.decode_range = decode_range_spi25,
.decode_range = DECODE_RANGE_SPI25,
},
{