[flashrom] [PATCH] Check availability of GPO lines on Intel PIIX4

Michael Karcher flashrom at mkarcher.dialup.fu-berlin.de
Fri Aug 13 16:06:31 CEST 2010


Am Sonntag, den 18.07.2010, 06:15 +0200 schrieb Mattias Mattsson:
> Hi,
> 
> I'm not a skilled programmer so this patch may look rather
> ugly. (Suggestions to improve it are very welcome.)
I think using a table-based approach instead of a switch-based approach
is sensible. Something like

static const unsigned int forbidden_gpios = 0x00000100; /* never available */
static const unsigned int nonmuxed_gpios = 0x58000001;  /* always available */
static const struct { unsigned int reg,  bitmask, bitvalue } piix4_gpio =
 {0,0},
 {0xB0, 0x0001, 0x0000},	/* GPO1... */
 {0xB0, 0x0001, 0x0000},
 {0xB0, 0x0001, 0x0000},
 {0xB0, 0x0001, 0x0000},
 {0xB0, 0x0001, 0x0000},
 {0xB0, 0x0001, 0x0000},
 {0xB0, 0x0001, 0x0000},	/* ...GPO7: GENCFG bit 0 (IOCHK#+LA17-23)
  ...
 {0xB2, 0x0004, 0x0004},	/* GPO18: GENCFG bit 18 */
  ...

Use word reads for GENCFG lower/upper part, just as you use for 

This will avoid that you have to put the info about the GPO
configuration bits both to the safety-checking procedure and the setting
procedure.

Also, your code uses "== 1" where it should use "!= 0".

Regards,
  Michael Karcher





More information about the flashrom mailing list