[coreboot] [RFC] [flashrom] "accelerated" high-level external programmer functions and serial external programmer protocol

Urja Rannikko urjaman at gmail.com
Sun Jun 7 00:55:54 CEST 2009

The newest version of the specification is attached.

-------------- next part --------------
Serial Flasher Protocol Specification

Command And Answer Sequence - not all commands give an answer
DEV: ACK/NAK(8bit) <OPTIONAL RETURN BYTES (only if ACK)> or nothing

ACK = 0x10
NAK = 0xBA

All multibyte values are little-endian.

COMMAND	Description			Parameters			Return Value
0x00	NOPACK				none				ACK
0x01	Query programmer iface version	none				ACK + 16bit version (nonzero)
0x02	Query programmer name		none				ACK + 16 bytes string (null padding)
0x03	Query serial buffer size	none				ACK + 16bit size / NAK
0x04	Query supported bustypes	none				ACK + 8-bit flags (as per flashrom) / NAK:
									bit 0: PARALLEL
									bit 1: LPC
									bit 2: FWH
									bit 3: SPI if ever supported
0x05	Query supported chip size	none				ACK + 8bit power of two / NAK
0x06	Query operation buffer size	none				ACK + 16bit size / NAK
0x07	Read byte			24-bit addr			ACK + BYTE / NAK
0x08	Read n bytes			24-bit addr + 24-bit length	ACK + length bytes / NAK
0x09	Initialize operation buffer	none				ACK / NAK
0x0A	Write to opbuf: Write byte	24-bit addr + 8-bit byte	ACK / NAK (NOTE: takes 6 bytes in opbuf)
0x0B	Write to opbuf: Write byte seq	8-bit byte			ACK / NAK (NOTE: takes 1 bytes in opbuf)
0x0C	Write to opbuf: delay		32-bit usecs			ACK / NAK (NOTE: takes 5 bytes in opbuf)
0x0D	Execute operation buffer	none				ACK / NAK
		- Execute operation buffer will also clear it, regardless of the return value
0x0E	Query write-n maximum data len	none				ACK + 24bit maximum length / NAK
0x0F	Write to opbuf: Write n		16-bit length field extension	ACK / NAK (NOTE: takes 7+n bytes in opbuf)
					 + 24-bit address + n == (length-5) bytes of data
0x??	unimplemented command		any				NAK

Write to opbuf: Write n should only be called after querying it's maximum data length, since it's parameter
	length field is extended by 16-bit's after the command
	If a device doesnt want to support write-n, it can simply NAK the query
	----------------''-------- support the length field extension, it can simply set write-n maximum length to 250
	and consider those bytes as padding.

This define listing should help C coders - (it's here to be the single source for copying - will be a .h someday i think)
#define S_ACK 0x10
#define S_NAK 0xBA
#define S_CMD_NOPACK            0x00            /* No operation                                 */
#define S_CMD_Q_IFACE           0x01            /* Query interface version                      */
#define S_CMD_Q_PGMNAME         0x02            /* Query programmer name                        */
#define S_CMD_Q_SERBUF          0x03            /* Query Serial Buffer Size                     */
#define S_CMD_Q_BUSTYPE         0x04            /* Query supported bustypes                     */
#define S_CMD_Q_CHIPSIZE        0x05            /* Query supported chipsize (2^n format)        */
#define S_CMD_Q_OPBUF           0x06            /* Query operation buffer size                  */
#define S_CMD_R_BYTE            0x07            /* Read a single byte                           */
#define S_CMD_R_NBYTES          0x08            /* Read n bytes                                 */
#define S_CMD_O_INIT            0x09            /* Initialize operation buffer                  */
#define S_CMD_O_WBA             0x0A            /* Write opbuf: Write byte with address         */
#define S_CMD_O_WBC             0x0B            /* Write opbuf: Write byte (addr=previous+1)    */
#define S_CMD_O_DELAY           0x0C            /* Write opbuf: udelay                          */
#define S_CMD_O_EXEC            0x0D            /* Execute operation buffer                     */
#define S_CMD_Q_WRNMAXLEN	0x0E		/* Query Write to opbuf: Write-N maximum lenght */
#define S_CMD_O_WRITEN		0x0F		/* Write to opbuf: Write-N			*/

More information about the coreboot mailing list