From 2d8d21fe7416871920c96b53b7d3ae5d02964575 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 4 Dec 2006 19:06:07 +0000 Subject: Added the generic block-splitting code to nvs.c --- src/include/gpxe/nvs.h | 9 +++++++-- src/include/gpxe/threewire.h | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'src/include') diff --git a/src/include/gpxe/nvs.h b/src/include/gpxe/nvs.h index 38bc9c555..b026dd462 100644 --- a/src/include/gpxe/nvs.h +++ b/src/include/gpxe/nvs.h @@ -11,8 +11,13 @@ /** A non-volatile storage device */ struct nvs_device { - /** Word length, in bits */ - unsigned int word_len; + /** Word length + * + * This is expressed as the base-2 logarithm of the word + * length in bytes. A value of 0 therefore translates as + * 8-bit words, and a value of 1 translates as 16-bit words. + */ + unsigned int word_len_log2; /** Device size (in words) */ unsigned int size; /** Data block size (in words) diff --git a/src/include/gpxe/threewire.h b/src/include/gpxe/threewire.h index cbf6180a0..d60e1a714 100644 --- a/src/include/gpxe/threewire.h +++ b/src/include/gpxe/threewire.h @@ -32,7 +32,7 @@ extern int threewire_read ( struct nvs_device *nvs, unsigned int address, static inline __attribute__ (( always_inline )) void init_at93cx6 ( struct spi_device *device, unsigned int organisation ) { - device->nvs.word_len = organisation; + device->nvs.word_len_log2 = ( ( organisation == 8 ) ? 0 : 1 ); device->nvs.block_size = 1; device->command_len = 3, device->nvs.read = threewire_read; -- cgit v1.2.3-55-g7522