mem: Fix for CFI memory

Subtile modification of the CFI memory to bring back u-boot compatibility :
- Ignoring AMD_RESET_CMD (0xf0)
- Increasing CFIQueryTable size to have 4 Erase Block Region Information (3 are
just empty)

Change-Id: I49e7a78a89a46b1298f04132559debafdeddb8ef
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/49570
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Giacomo Travaglini <giacomo.travaglini@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Quentin Forcioli
2021-08-25 17:24:54 +02:00
parent bec41479af
commit 32fd8cfa80
2 changed files with 10 additions and 2 deletions

View File

@@ -219,6 +219,9 @@ CfiMemory::CfiMemory(const CfiMemoryParams &p)
static_cast<uint8_t>(bits(blocks.number(), 15, 8)),
static_cast<uint8_t>(bits(blocks.size(), 7, 0)),
static_cast<uint8_t>(bits(blocks.size(), 15, 8)),
0x00,0x00,0x00,0x00,//empty Block region 2 info
0x00,0x00,0x00,0x00,//empty Block region 3 info
0x00,0x00,0x00,0x00//empty Block region 4 info
}
{}
@@ -709,6 +712,11 @@ CfiMemory::handleCommand(CfiCommand new_cmd)
writeState = CfiCommand::BUFFERED_PROGRAM_SETUP;
readState = CfiCommand::READ_STATUS_REG;
break;
case CfiCommand::AMD_RESET:
//because of how u-boot works and reset the flash
//we have to ignore the AMD RESET explicitly
// (see the function __flash_cmd_reset in drivers/mtd/cfi_flash.c)
break;
default:
panic("Don't know what to do with %#x\n",
static_cast<uint16_t>(new_cmd));

View File

@@ -86,8 +86,8 @@ class CfiMemory : public AbstractMemory
BUFFERED_PROGRAM_CONFIRM = 0xD0,
BLOCK_ERASE_CONFIRM = 0xD0,
UNLOCK_BLOCK = 0xD0,
AMD_RESET=0xF0,
READ_ARRAY = 0xFF,
/** This is not a real command, but it is used by the internal
* model only to represent the 2nd write cycle state for a buffered
* program (when the buffer size is supplied) */
@@ -343,7 +343,7 @@ class CfiMemory : public AbstractMemory
ProgramBuffer programBuffer;
uint8_t cfiQueryTable[49];
uint8_t cfiQueryTable[61];
public:
CfiMemory(const CfiMemoryParams &p);