Google is committed to advancing racial equity for Black communities. See how.

fuchsia.nand.flashmap

PROTOCOLS

Flashmap

Defined in fuchsia.nand.flashmap/flashmap.fidl

A protocol that allows clients to read, write, and erase areas of a NAND flash device whose layout is defined by a coreboot flashmap. https://doc.coreboot.org/lib/flashmap.html

Erase

Erase the given region of flash. If |offset| or |size| are not erase-block-aligned, then the erase will fail.

  • ZX_ERR_NOT_FOUND - if the area |name| was not found.
  • ZX_ERR_OUT_OF_RANGE - if the requested range of data lies outside the bounds of the area.
  • ZX_ERR_INTERNAL - if an internal error occurred, e.g. failure to send FIDL requests to the underlying flash device.
  • ZX_ERR_INVALID_ARGS - if |offset| or |range| were not erase-block-aligned.
  • Any errors that are returned by the underlying NAND implementation.

Request

NameType
name string[32]
offset uint32
range uint32

Response

NameType
result Flashmap_Erase_Result

GetAreas

Get all the areas in the flashmap.

Request

<EMPTY>

Response

NameType
areas vector<Area>[255]

GetEraseBlockSize

Get the smallest unit of flash that can be erased, in bytes.

Request

<EMPTY>

Response

NameType
erase_block_size uint32

Read

Read |size| bytes from |offset| in area |name| and return it in |range|. Returns:

  • ZX_ERR_NOT_FOUND - if the area |name| was not found.
  • ZX_ERR_OUT_OF_RANGE - if the requested range of data lies outside the bounds of the area.
  • ZX_ERR_INTERNAL - if an internal error occurred, e.g. failure to send FIDL requests to the underlying flash device.
  • Any errors that are returned by the underlying NAND implementation.

Request

NameType
name string[32]
offset uint32
size uint32

Response

NameType
result Flashmap_Read_Result

Write

Write |data| into area |name| at |offset| (within the area). This function will read back the written data, and fail if it was not written correctly.

  • ZX_ERR_NOT_FOUND - if the area |name| was not found.
  • ZX_ERR_OUT_OF_RANGE - if the requested range of data lies outside the bounds of the area.
  • ZX_ERR_INTERNAL - if an internal error occurred, e.g. failure to send FIDL requests to the underlying flash device.
  • ZX_ERR_IO_DATA_INTEGRITY - if data read back after writing did not match what was written.
  • Any errors that are returned by the underlying NAND implementation.

Request

NameType
name string[32]
offset uint32
data fuchsia.mem/Buffer

Response

NameType
result Flashmap_Write_Result

Manager

Defined in fuchsia.nand.flashmap/flashmap.fidl

Start

Find and parse the flashmap on NAND device |device| and start serving a |Flashmap| on |server|.

Request

NameType
device fuchsia.nand/Broker
server request<Flashmap>

STRUCTS

Area

Defined in fuchsia.nand.flashmap/flashmap.fidl

A single area of the flash.

FieldTypeDescriptionDefault
offset uint32

Start address of this area on the flash, in bytes.

No default
size uint32

Size of this area, in bytes.

No default
name string[32]

Name of the area, used to identify it.

No default
flags AreaFlags

Bitfield of flags for this area.

No default

Flashmap_Erase_Response

Defined in fuchsia.nand.flashmap/flashmap.fidl

<EMPTY>

Flashmap_Read_Response resource

Defined in fuchsia.nand.flashmap/flashmap.fidl

FieldTypeDescriptionDefault
range fuchsia.mem/Range No default

Flashmap_Write_Response

Defined in fuchsia.nand.flashmap/flashmap.fidl

<EMPTY>

UNIONS

Flashmap_Erase_Result strict

Defined in fuchsia.nand.flashmap/flashmap.fidl

Ordinal
VariantTypeDescription
1 response Flashmap_Erase_Response
2 err zx/status

Flashmap_Read_Result strict resource

Defined in fuchsia.nand.flashmap/flashmap.fidl

Ordinal
VariantTypeDescription
1 response Flashmap_Read_Response
2 err zx/status

Flashmap_Write_Result strict

Defined in fuchsia.nand.flashmap/flashmap.fidl

Ordinal
VariantTypeDescription
1 response Flashmap_Write_Response
2 err zx/status

BITS

AreaFlags flexible

Type: uint16

Defined in fuchsia.nand.flashmap/flashmap.fidl

Flags for an area. https://doc.coreboot.org/lib/flashmap.html#area-flags

NameValueDescription
STATIC 1

Not really used.

COMPRESSED 2

Not really used.

RO 4

Not really used.

PRESERVE 8

Indicates that the contents of this area should be preserved when the firmware is being rewritten.

CONSTANTS

NameValueTypeDescription
MAX_NAME_LEN 32 uint32
MAX_NUM_AREAS 255 uint32