xref: /openbmc/phosphor-mboxd/Documentation/mbox_protocol.md (revision acdbdd141ece313f259ad6231e132f0a4bc3e062)
1Copyright 2017,2018 IBM
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7  http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is distributed on an "AS IS" BASIS,
11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14
15## Intro
16
17This document describes a protocol for host to BMC communication via the
18mailbox registers present on the Aspeed 2400 and 2500 chips.
19This protocol is specifically designed to allow a host to request and manage
20access to a flash device(s) with the specifics of how the host is required to
21control this described below.
22
23## Version
24
25Version specific protocol functionalities are represented by the version number
26in brackets next to the definition of the functionality. (e.g. (V2) for version
272 specific funtionality). All version specific functionality must also be
28implemented by proceeding versions up to and not including the version a command
29was removed.
30
31## Problem Overview
32
33"mbox" is the name we use to represent a protocol we have established between
34the host and the BMC via the Aspeed mailbox registers. This protocol is used
35for the host to control access to the flash device(s).
36
37Prior to the mbox protocol, the host uses a backdoor into the BMC address space
38(the iLPC-to-AHB bridge) to directly manipulate the BMCs own flash controller.
39
40This is not sustainable for a number of reasons. The main ones are:
41
421. Every piece of the host software stack that needs flash access (HostBoot,
43   OCC, OPAL, ...) has to have a complete driver for the flash controller,
44   update it on each BMC generation, have all the quirks for all the flash
45   chips supported etc... We have 3 copies on the host already in addition to
46   the one in the BMC itself.
47
482. There are serious issues of access conflicts to that controller between the
49   host and the BMC.
50
513. It's very hard to support "BMC reboots" when doing that
52
534. It's slow
54
555. Last but probably most important, having that backdoor open is a security
56   risk. It means the host can access any address on the BMC internal bus and
57   implant malware in the BMC itself. So if the host is a "bare metal" shared
58   system in some kind of data center, not only the host flash needs to be
59   reflashed when switching from one customer to another, but the entire BMC
60   flash too as nothing can be trusted. So we want to disable it.
61
62To address all these, we have implemented a new mechanism that we call mbox.
63
64When using this mechanism, the BMC is solely responsible for directly accessing
65the flash controller. All flash erase and write operations are performed by the
66BMC and the BMC only. (We can allow direct reads from flash under some
67circumstances but we tend to prefer going via memory).
68
69The host uses the mailbox registers to send "commands" to the BMC, which
70responds via the same mechanism. Those commands allow the host to control a
71"window" (which is the LPC -> AHB FW space mapping) that is either a read
72window or a write window onto the flash.
73
74When set for writing, the BMC makes the window point to a chunk of RAM instead.
75When the host "commits" a change (via MBOX), then the BMC can perform the
76actual flashing from the data in the RAM window.
77
78The idea is to have the LPC FW space be routed to an active "window".  That
79window can be a read or a write window. The commands allow to control which
80window and which offset into the flash it maps.
81
82* A read window can be a direct window to the flash controller space (ie.
83  0x3000\_0000) or it can be a window to a RAM image of a flash. It doesn't have
84  to be the full size of the flash per protocol (commands can be used to "slide"
85  it to various parts of the flash) but if it's set to map the actual flash
86  controller space at 0x3000\_0000, it's probably simpler to make it the full
87  flash. The host makes no assumption, it's your choice what to provide. The
88  simplest implementation is to just route to the flash read/only.
89
90* A write window has to be a chunk of BMC memory. The minimum size is not
91  defined in the spec, but it should be at least one block (4k for now but it
92  should support larger block sizes in the future). When the BMC receive the
93  command to map the write window at a given offset of the flash, the BMC should
94  copy that portion of the flash into a reserved memory buffer, and modify the
95  LPC mapping to point to that buffer.
96
97The host can then write to that window directly (updating the BMC memory) and
98send a command to "commit" those updates to flash.
99
100Finally, there is a `RESET_STATE`. It's the state in which the bootloader in the
101SEEPROM of the POWER9 chip will find what it needs to load HostBoot. The
102details are still being ironed out: either mapping the full flash read only or
103reset to a "window" that is either at the bottom or top of the flash. The
104current implementation resets to point to the full flash.
105
106## Where is the code?
107
108The mbox userspace is available [on GitHub](https://github.com/openbmc/mboxbridge)
109This is Apache licensed but we are keen to see any enhancements you may have.
110
111The kernel driver is still in the process of being upstreamed but can be found
112in the OpenBMC Linux kernel staging tree:
113
114https://github.com/openbmc/linux/commit/85770a7d1caa6a1fa1a291c33dfe46e05755a2ef
115
116## Building
117
118The Autotools of this requires the autoconf-archive package for your
119system
120
121## The Hardware
122
123The Aspeed mailbox consists of 16 (8 bit) data registers see Layout for their
124use. Mailbox interrupt enabling, masking and triggering is done using a pair
125of control registers, one accessible by the host the other by the BMC.
126Interrupts can also be raised per write to each data register, for BMC and
127host. Write triggered interrupts are configured using two 8 bit registers where
128each bit represents a data register and if an interrupt should fire on write.
129Two 8 bit registers are present to act as a mask for write triggered
130interrupts.
131
132### Layout
133
134```
135Byte 0: COMMAND
136Byte 1: Sequence
137Byte 2-12: Arguments
138Byte 13: Response code
139Byte 14: Host controlled status reg
140Byte 15: BMC controlled status reg
141```
142
143Note: when the BMC is writing a response to the mbox registers (as described
144above), the "Response Code" (Register 13) must be the last register written to.
145Writing register 13 will trigger an interrupt to the host indicating a complete
146response has been written. Triggering the interrupt by writing register 13
147prior to completing the response may lead to a data race, and must, therefore,
148be avoided.
149
150## Low Level Protocol Flow
151
152What we essentially have is a set of registers which either the host or BMC can
153write to in order to communicate to the other which will respond in some way.
154There are 3 basic types of communication.
155
1561. Commands sent from the Host to the BMC
1572. Responses sent from the BMC to the Host in response to commands
1583. Asynchronous events raised by the BMC
159
160### General Use
161
162Messages usually originate from the host to the BMC. There are special
163cases for a back channel for the BMC to pass new information to the
164host which will be discussed later.
165
166To initiate a request the host must set a command code (see Commands) into
167mailbox data register 0, and generate a sequence number (see Sequence Numbers)
168to write to mailbox register data 1. After these two values, any
169command-specific data should be written (see Layout). The host must then
170generate an interrupt to the BMC by using bit 0 of its control register and
171wait for an interrupt on the response register.  Generating an interrupt
172automatically sets bit 7 of the corresponding control register. This bit can be
173used to poll for messages.
174
175On receiving an interrupt (or polling on bit 7 of its Control
176Register) the BMC should read the message from the general registers
177of the mailbox and perform the necessary action before responding. On
178responding the BMC must ensure that the sequence number is the same as
179the one in the request from the host. The BMC must also ensure that
180mailbox data register 13 is a valid response code (see Responses). The
181BMC should then use its control register to generate an interrupt for
182the host to notify it of a response.
183
184### Asynchronous BMC to Host Events
185
186BMC to host communication is also possible for notification of events
187from the BMC. This requires that the host have interrupts enabled on
188mailbox data register 15 (or otherwise poll on bit 7 of mailbox status
189register 1). On receiving such a notification the host should read
190mailbox data register 15 to determine the event code which was set by the
191BMC (see BMC Event notifications in Commands for detail). Events which are
192defined as being able to be acknowledged by the host must be with a
193BMC_EVENT_ACK command.
194
195## High Level Protocol Flow
196
197When a host wants to communicate with the BMC via the mbox protocol the first
198thing it should do it call MBOX_GET_INFO in order to establish the protocol
199version which each understands. Before this, the only other commands which are
200allowed are RESET_STATE and BMC_EVENT_ACK.
201
202After this, the host can open and close windows with the CREATE_READ_WINDOW,
203CREATE_WRITE_WINDOW and CLOSE_WINDOW commands. Creating a window is how the
204host requests access to a section of flash. It is worth noting that the host
205can only ever have one window that it is accessing at a time - hence forth
206referred to as the active window.
207
208When the active window is a write window the host can perform MARK_WRITE_DIRTY,
209MARK_WRITE_ERASED and WRITE_FLUSH commands to identify changed blocks and
210control when the changed blocks are written to flash.
211
212Independently, and at any point not during an existing mbox command
213transaction, the BMC may raise asynchronous events with the host to
214communicate a change in state.
215
216### Version Negotiation
217
218Given that a majority of command and response arguments are specified as a
219multiple of block size it is necessary for the host and BMC to agree on a
220protocol version as this determines the block size. In V1 it is hard coded at
2214K, in V2 the BMC chooses and in V3 the host is allowed to request a specific
222block size with the actual size chosen communicated back to the host as a
223response argument to `MBOX_GET_INFO`. Thus the host must always call
224`MBOX_GET_INFO` before any other command which specifies an argument in block
225size.
226
227When invoking `MBOX_GET_INFO` the host must provide the BMC its highest
228supported version of the protocol. The BMC must respond with a protocol version
229less than or equal to that requested by the host, or in the event that there is
230no such value, an error code. In the event that an error is returned the host
231must not continue to communicate with the BMC. Otherwise, the protocol version
232returned by the BMC is the agreed protocol version for all further
233communication. The host may at a future point request a change in protocol
234version by issuing a subsequent `MBOX_GET_INFO` command.
235
236### Window Management
237
238In order to access flash contents, the host must request a window be opened at
239the flash offset it would like to access with the CREATE_{READ,WRITE}_WINDOW
240commands. The host may give a hint as to how much data it would like to access
241or otherwise set this argument to zero. The BMC must respond with the LPC bus
242address to access this window and the window size. The host must not access
243past the end of the active window. On returning success to either of the create
244window commands the BMC must guarantee that the window provided contains data
245which correctly represents the state of flash at the time the response is given.
246
247There is only ever one active window which is the window created by the most
248recent CREATE_READ_WINDOW or CREATE_WRITE_WINDOW call which succeeded. Even
249though there are two types of windows there can still only be one active window
250irrespective of type. A host must not write to a read window. A host may read
251from a write window and the BMC must guarantee that the window reflects what
252the host has written there.
253
254A window can be closed by calling CLOSE_WINDOW in which case there is no active
255window and the host must not access the LPC window after it has been closed.
256If the host closes an active write window then the BMC must perform an
257implicit flush. If the host tries to open a new window with an already active
258window then the active window is closed (and implicitly flushed if it was a
259write window). If the new window is successfully opened then it is the new
260active window, if the command fails then there is no active window and the
261previously active window must no longer be accessed.
262
263The host must not access an LPC address other than that which is contained by
264the active window. The host must not use write management functions (see below)
265if the active window is a read window or if there is no active window.
266
267### Write Management
268
269The BMC has no method for intercepting writes that occur over the LPC bus. Thus
270the host must explicitly notify the BMC of where and when a write has
271occurred. The host must use the MARK_WRITE_DIRTY command to tell the BMC where
272within the write window it has modified. The host may also use the
273MARK_WRITE_ERASED command to erase large parts of the active window without the
274need to write 0xFF. The BMC must ensure that if the host
275reads from an area it has erased that the read values are 0xFF. Any part of the
276active window marked dirty/erased is only marked for the lifetime of the current
277active write window and does not persist if the active window is closed either
278implicitly or explicitly by the host or the BMC. The BMC may at any time
279or must on a call to WRITE_FLUSH flush the changes which it has been notified
280of back to the flash, at which point the dirty or erased marking is cleared
281for the active window. The host must not assume that any changes have been
282written to flash unless an explicit flush call was successful, a close of an
283active write window was successful or a create window command with an active
284write window was successful - otherwise consistency between the flash and memory
285contents cannot be guaranteed.
286
287The host is not required to perform an erase before a write command and the
288BMC must ensure that a write performs as expected - that is if an erase is
289required before a write then the BMC must perform this itself (unless the
290no_erase flag is set in the MARK_WRITE_DIRTY command in which case the BMC will
291blindly write without a prior erase (V3)).
292
293The host may lock an area of flash using the MARK_LOCKED command. Any attempt
294to mark dirty or erased this area of flash must fail with the LOCKED_ERROR
295response code. The host may open a write window which contains a locked area
296of flash however changes to a locked area of flash must never be written back
297to the backing data source (i.e. that area of flash must be treated as read
298only with respect to the backing store at all times). An attempt to lock an area
299of flash which is not clean in the current window must fail with PARAM_ERROR.
300Locked flash regions must persist across a BMC reboot or daemon restart. It is
301only possible to clear the lock state through a clear_locked dbus command. (V3)
302
303### BMC Events
304
305The BMC can raise events with the host asynchronously to communicate to the
306host a change in state which it should take notice of. The host must (if
307possible for the given event) acknowledge it to inform the BMC it has been
308received.
309
310If the BMC raises a BMC Reboot event then the host must renegotiate the
311protocol version so that both the BMC and the host agree on the block size.
312A BMC Reboot event implies a BMC Windows Reset event.
313If the BMC raises a BMC Windows Reset event then the host must
314assume that there is no longer an active window - that is if there was an
315active window it has been closed by the BMC and if it was a write window
316then the host must not assume that it was flushed unless a previous explicit
317flush call was successful.
318
319The BMC may at some points require access to the flash and the BMC daemon must
320set the BMC Flash Control Lost event when the BMC is accessing the flash behind
321the BMC daemons back. When this event is set the host must assume that the
322contents of the active window could be inconsistent with the contents of flash.
323
324## Protocol Definition
325
326### Commands
327
328```
329RESET_STATE          0x01
330GET_MBOX_INFO        0x02
331GET_FLASH_INFO       0x03
332CREATE_READ_WINDOW   0x04
333CLOSE_WINDOW         0x05
334CREATE_WRITE_WINDOW  0x06
335MARK_WRITE_DIRTY     0x07
336WRITE_FLUSH          0x08
337BMC_EVENT_ACK        0x09
338MARK_WRITE_ERASED    0x0a	(V2)
339GET_FLASH_NAME       0x0b	(V3)
340MARK_LOCKED          0x0c	(V3)
341```
342
343### Responses
344
345```
346SUCCESS		1
347PARAM_ERROR	2
348WRITE_ERROR	3
349SYSTEM_ERROR	4
350TIMEOUT		5
351BUSY		6	(V2)
352WINDOW_ERROR	7	(V2)
353SEQ_ERROR	8	(V2)
354LOCKED_ERROR	9	(V3)
355```
356
357### Sequence Numbers
358
359Sequence numbers are included in messages for correlation of commands and
360responses. V1, V2 and V3 of the protocol permit either zero or one commands to
361be in progress (yet to receive a response).
362
363For generality, the host must generate a sequence number that is unique with
364respect to the previous command (one that has received a response) and any
365in-progress commands. Sequence numbers meeting this requirement are considered
366valid. The BMC's response to a command must contain the same sequence number
367issued by the host as found in the relevant command.
368
369Sequence numbers may be reused in accordance with the constraints outlined
370above. However, it is not an error if the BMC receives a `GET_MBOX_INFO` with an
371invalid sequence number. For all other cases, the BMC must respond with
372`SEQ_ERROR` if the constraints are violated. If the host receives a `SEQ_ERROR`
373response it must consider any in-progress commands to have failed. The host may
374retry the affected command(s) after generating a suitable sequence number.
375
376#### Description:
377
378SUCCESS		- Command completed successfully
379
380PARAM_ERROR	- Error with parameters supplied or command invalid
381
382WRITE_ERROR	- Error writing to the backing file system
383
384SYSTEM_ERROR	- Error in BMC performing system action
385
386TIMEOUT		- Timeout in performing action
387
388BUSY		- Daemon in suspended state (currently unable to access flash)
389		- Retry again later
390
391WINDOW_ERROR	- Command not valid for active window or no active window
392		- Try opening an appropriate window and retrying the command
393
394SEQ_ERROR	- Invalid sequence number supplied with command
395
396LOCKED_ERROR	- Tried to mark dirty or erased locked area of flash
397
398### Information
399- All multibyte messages are LSB first (little endian)
400- All responses must have a valid return code in byte 13
401
402
403### Commands in detail
404
405Block size refers to an agreed value which is used as a unit for the
406arguments of various commands and responses. Having a block size multiplier
407allows us to specify larger values with fewer command and response fields.
408
409In V1 block size is hard coded to 4K.
410In V2 it is variable and must be queried with the GET_MBOX_INFO command.
411In V3 the host can request a given block size however it is ultimately up to
412the daemon to choose a block size which is returned as part of the GET_MBOX_INFO
413command response. The host must respect the daemons choice. The ability for the
414host to request a block size is provided such that it can choose an appropriate
415size to be able to utilise commands which only operate at the block level.
416
417Note that for simplicity block size must always be a power-of-2.
418Block size must also be greater than or equal to 4K. This is due to the
419fact that we have a 28-bit LPC address space and commands which return an
420LPC address do so in 16 bits, thus we need at least a 12-bit unit to ensure
421that we can specify the entire address space. This additionally allows us
422to specify flash addresses of at least 256MB.
423
424Sizes and addresses are specified in either bytes - (bytes)
425					 or blocks - (blocks)
426Sizes and addresses specified in blocks must be converted to bytes by
427multiplying by the block size.
428```
429Command:
430	RESET_STATE
431	Added in:	V1
432	Arguments:
433		-
434	Response:
435		-
436	Notes:
437		This command is designed to inform the BMC that it should put
438		host LPC mapping back in a state where the SBE will be able to
439		use it. Currently, this means pointing back to BMC flash
440		pre mailbox protocol. Final behavior is still TBD.
441
442Command:
443	GET_MBOX_INFO
444	Added in:	V1
445	Arguments:
446		V1:
447		Args 0: API version
448
449		V2:
450		Args 0: API version
451
452		V3:
453		Args 0: API version
454		Args 1: Requested block size (shift)
455
456	Response:
457		V1:
458		Args 0: API version
459		Args 1-2: default read window size (blocks)
460		Args 3-4: default write window size (blocks)
461
462		V2:
463		Args 0: API version
464		Args 1-2: reserved
465		Args 3-4: reserved
466		Args 5: Block size as power of two (encoded as a shift)
467		Args 6-7: Suggested Timeout (seconds)
468
469		V3:
470		Args 0: API version
471		Args 1-2: reserved
472		Args 3-4: reserved
473		Args 5: Block size as power of two (encoded as a shift)
474		Args 6-7: Suggested Timeout (seconds)
475		Args 8: Num Allocated Flash IDs
476	Notes:
477		The suggested timeout is a hint to the host as to how long
478		it should wait after issuing a command to the BMC before it
479		times out waiting for a response. This is the maximum time
480		which the BMC thinks it could take to service any command which
481		the host could issue. This may be set to zero to indicate that
482		the BMC	does not wish to provide a hint in which case the host
483		must choose some reasonable value.
484
485		The host may desire a specific block size and thus can request
486		this by giving a hint to the daemon (may be zero). The daemon
487		may use this to select the block size which it will use however
488		is free to ignore it. The value in the response is the block
489		size which must be used for all further requests until a new
490		size is	negotiated by another call to GET_MBOX_INFO. (V3)
491
492Command:
493	GET_FLASH_INFO
494	Added in:	V1
495	Arguments:
496		V1, V2:
497		-
498
499		V3:
500		Args 0: Flash ID
501	Response:
502		V1:
503		Args 0-3: Flash size (bytes)
504		Args 4-7: Erase granule (bytes)
505
506		V2, V3:
507		Args 0-1: Flash size (blocks)
508		Args 2-3: Erase granule (blocks)
509
510Command:
511	CREATE_{READ/WRITE}_WINDOW
512	Added in:	V1
513	Arguments:
514		V1:
515		Args 0-1: Requested flash offset (blocks)
516
517		V2:
518		Args 0-1: Requested flash offset (blocks)
519		Args 2-3: Requested flash size to access (blocks)
520
521		V3:
522		Args 0-1: Requested flash offset (blocks)
523		Args 2-3: Requested flash size to access (blocks)
524		Args 4: Flash ID
525	Response:
526		V1:
527		Args 0-1: LPC bus address of window (blocks)
528
529		V2, V3:
530		Args 0-1: LPC bus address of window (blocks)
531		Args 2-3: Window size (blocks)
532		Args 4-5: Flash offset mapped by window (blocks)
533	Notes:
534		The flash offset which the host requests access to is always
535		taken from the start of flash - that is it is an absolute
536		offset into flash.
537
538		LPC bus address is always given from the start of the LPC
539		address space - that is it is an absolute address.
540
541		The requested access size is only a hint. The response
542		indicates the actual size of the window. The BMC may
543		want to use the requested size to pre-load the remainder
544		of the request. The host must not access past the end of the
545		active window.
546
547		The flash offset mapped by the window is an absolute flash
548		offset and must be less than or equal to the flash offset
549		requested by the host. It is the responsibility of the host
550		to use this information to access any offset which is required.
551
552		The requested window size may be zero. In this case the
553		BMC is free to create any sized window but it must contain
554		atleast the first block of data requested by the host. A large
555		window is of course preferred and should correspond to
556		the default size returned in the GET_MBOX_INFO command.
557
558		If this command returns successfully then the created window
559		is the active window. If it fails then there is no active
560		window.
561
562Command:
563	CLOSE_WINDOW
564	Added in:	V1
565	Arguments:
566		V1:
567		-
568
569		V2:
570		Args 0: Flags
571	Response:
572		-
573	Notes:
574		Closes the active window. Any further access to the LPC bus
575		address specified to address the previously active window will
576		have undefined effects. If the active window is a
577		write window then the BMC must perform an implicit flush.
578
579		The Flags argument allows the host to provide some
580		hints to the BMC. Defined Values:
581			0x01 - Short Lifetime:
582				The window is unlikely to be accessed
583				anytime again in the near future. The effect of
584				this will depend on BMC implementation. In
585				the event that the BMC performs some caching
586				the BMC daemon could mark data contained in a
587				window closed with this flag as first to be
588				evicted from the cache.
589
590Command:
591	MARK_WRITE_DIRTY
592	Added in:	V1
593	Arguments:
594		V1:
595		Args 0-1: Flash offset to mark from base of flash (blocks)
596		Args 2-5: Number to mark dirty at offset (bytes)
597
598		V2:
599		Args 0-1: Window offset to mark (blocks)
600		Args 2-3: Number to mark dirty at offset (blocks)
601		Args 4  : Don't Erase Before Write (V3)
602
603	Response:
604		-
605	Notes:
606		The BMC has no method for intercepting writes that
607		occur over the LPC bus. The host must explicitly notify
608		the daemon of where and when a write has occurred so it
609		can be flushed to backing storage.
610
611		Offsets are given as an absolute (either into flash (V1) or the
612		active window (V2)) and a zero offset refers to the first
613		block. If the offset + number exceeds the size of the active
614		window then the command must not succeed.
615
616		The host can give a hint to the daemon that is doesn't have to
617		erase a flash area before writing to it by setting ARG[4]. This
618		means that the daemon will blindly perform a write to that area
619		and will not try to erase it before hand. This can be used if
620		the host knows that a large area has already been erased for
621		example but then wants to perform many small writes.
622
623Command
624	WRITE_FLUSH
625	Added in:	V1
626	Arguments:
627		V1:
628		Args 0-1: Flash offset to mark from base of flash (blocks)
629		Args 2-5: Number to mark dirty at offset (bytes)
630
631		V2:
632		-
633
634	Response:
635		-
636	Notes:
637		Flushes any dirty/erased blocks in the active window to
638		the backing storage.
639
640		In V1 this can also be used to mark parts of the flash
641		dirty and flush in a single command. In V2 the explicit
642		mark dirty command must be used before a call to flush
643		since there are no longer any arguments. If the offset + number
644		exceeds the size of the active window then the command must not
645		succeed.
646
647
648Command:
649	BMC_EVENT_ACK
650	Added in:	V1
651	Arguments:
652		Args 0:	Bits in the BMC status byte (mailbox data
653			register 15) to ack
654	Response:
655		*clears the bits in mailbox data register 15*
656	Notes:
657		The host should use this command to acknowledge BMC events
658		supplied in mailbox register 15.
659
660Command:
661	MARK_WRITE_ERASED
662	Added in:	V2
663	Arguments:
664		V2:
665		Args 0-1: Window offset to erase (blocks)
666		Args 2-3: Number to erase at offset (blocks)
667	Response:
668		-
669	Notes:
670		This command allows the host to erase a large area
671		without the need to individually write 0xFF
672		repetitively.
673
674		Offset is the offset within the active window to start erasing
675		from (zero refers to the first block of the active window) and
676		number is the number of blocks of the active window to erase
677		starting at offset. If the offset + number exceeds the size of
678		the active window then the command must not succeed.
679
680Command:
681	GET_FLASH_NAME
682	Added in:	V3
683	Arguments:
684		Args 0: Flash ID
685	Response:
686		Args 0   : Flash Name Length (bytes)
687		Args 1-10: Flash Name / UID
688	Notes:
689		Describes a flash with some kind of identifier useful to the
690		host system. This is typically a null-padded string.
691
692		The length in the response is the number of response arguments
693		as part of the flash name field which the host should expect to
694		have been populated.
695
696Command:
697	MARK_LOCKED
698	Added in:	V3
699	Arguments:
700		Args 0-1: Flash offset to lock (blocks)
701		Args 2-3: Number to lock at offset (blocks)
702		Args 4: Flash ID
703	Response:
704		-
705	Notes:
706		Lock an area of flash so that the host can't mark it dirty or
707		erased. If the requested area is within the current window and
708		that area is currently marked dirty or erased then this command
709		must fail with PARAM_ERROR.
710
711```
712
713### BMC Events in Detail:
714
715If the BMC needs to tell the host something then it simply
716writes to Byte 15. The host should have interrupts enabled
717on that register, or otherwise be polling it.
718
719#### Bit Definitions:
720
721Events which must be ACKed:
722```
7230x01: BMC Reboot
7240x02: BMC Windows Reset (V2)
725```
726
727Events which cannot be ACKed (BMC will clear when no longer
728applicable):
729```
7300x40: BMC Flash Control Lost (V2)
7310x80: BMC MBOX Daemon Ready (V2)
732```
733
734#### Event Description:
735
736Events which must be ACKed:
737The host should acknowledge these events with BMC_EVENT_ACK to
738let the BMC know that they have been received and understood.
739```
7400x01 - BMC Reboot:
741	Used to inform the host that a BMC reboot has occurred.
742	The host must perform protocol version negotiation again and
743	must assume it has no active window. The host must not assume
744	that any commands which didn't respond as such succeeded.
7450x02 - BMC Windows Reset: (V2)
746	The host must assume that its active window has been closed and
747	that it no longer has an active window. The host is not
748	required to perform protocol version negotiation again. The
749	host must not assume that any commands which didn't respond as such
750	succeeded.
751```
752
753Events which cannot be ACKed:
754These events cannot be acknowledged by the host and a call to
755BMC_EVENT_ACK with these bits set will have no effect. The BMC
756will clear these bits when they are no longer applicable.
757```
7580x40 - BMC Flash Control Lost: (V2)
759	The BMC daemon has been suspended and thus no longer
760	controls access to the flash (most likely because some
761	other process on the BMC required direct access to the
762	flash and has suspended the BMC daemon to preclude
763	concurrent access).
764	The BMC daemon must clear this bit itself when it regains
765	control of the flash (the host isn't able to clear it
766	through an acknowledge command).
767	The host must not assume that the contents of the active window
768	correctly reflect the contents of flash while this bit is set.
7690x80 - BMC MBOX Daemon Ready: (V2)
770	Used to inform the host that the BMC daemon is ready to
771	accept command requests. The host isn't able to clear
772	this bit through an acknowledge command, the BMC daemon must
773	clear it before it terminates (assuming it didn't
774	terminate unexpectedly).
775	The host should not expect a response while this bit is
776	not set.
777	Note that this bit being set is not a guarantee that the BMC daemon
778	will respond as it or the BMC may have crashed without clearing
779	it.
780```
781