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

Urja Rannikko urjaman at gmail.com
Sat Jun 6 02:42:09 CEST 2009

> Hmm... the only ACK from a write on the buffer is got when executing
> the buffer ("the whole buffer was executed") as a reply to execute
> buffer, this is in purpose not to have PC's doing "ping-pong" with the
> AVR during writing of the buffer - the host can do non-blocking I/O to
> check for a NAK after streaming the write commands. (Or send an NOPACK
> and read until you get an ACK - then there were no NAK's when
> writing). Of course it would also be possible to have them all return
> ACK and then do write lots + count all the ACK's on the host side, but
> i dont see that as necessary.
Ok scratch that :P, i changed those commands to return ACK too,
because that allows me to get by with less job on the flow control,
eg. i can wait for all the ACK's to "come home" - then the serial
buffer is empty. Simpler, and it allows to use a generic ping-style
command function on any command (in case this streaming performance is
not needed).

I'm still pondering on the n-byte write ---

Anyways, i attach (just for getting an idea on the protocol, dunno)
the main AVR parser source and the newest version of the protocol
specification. The AVR source isnt stand alone as in the project has
many other .c files which arent needed to understand the protocol, but
i dont mean you to compile it, just to be looked at (it does compile
though (with all the support files)). It also lacks license header.
(It'll be GPLv2+ when tested as working - eg. when i get the flashrom
part done).

Now to sleep...

-------------- 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	Query programmer iface version	none				ACK + 16bit version (nonzero)
0x01	Query programmer name		none				ACK + 16 bytes string (null padding)
0x02	NOPACK				none				ACK
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 lenght	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
0x??	unimplemented command		any				NAK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: frser.c
Type: application/octet-stream
Size: 6997 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20090606/583c34ab/attachment.obj>

More information about the coreboot mailing list