hw/nvram/aspeed_otp: Add ASPEED OTP memory device model

Introduce a QEMU device model for ASPEED's One-Time Programmable (OTP)
memory.

This model simulates a word-addressable OTP region used for secure
fuse storage. The OTP memory can operate with an internal memory
buffer.

The OTP model provides a memory-like interface through a dedicated
AddressSpace, allowing other device models (e.g., SBC) to issue
transactions as if accessing a memory-mapped region.

Signed-off-by: Kane-Chen-AS <kane_chen@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20250812094011.2617526-2-kane_chen@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Kane-Chen-AS 2025-08-12 17:39:58 +08:00 committed by Cédric Le Goater
parent 4975b64efb
commit 688a3dae78
3 changed files with 136 additions and 0 deletions

View file

@ -0,0 +1,33 @@
/*
* ASPEED OTP (One-Time Programmable) memory
*
* Copyright (C) 2025 Aspeed
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef ASPEED_OTP_H
#define ASPEED_OTP_H
#include "system/memory.h"
#include "hw/block/block.h"
#include "system/address-spaces.h"
#define TYPE_ASPEED_OTP "aspeed-otp"
OBJECT_DECLARE_SIMPLE_TYPE(AspeedOTPState, ASPEED_OTP)
typedef struct AspeedOTPState {
DeviceState parent_obj;
BlockBackend *blk;
uint64_t size;
AddressSpace as;
MemoryRegion mmio;
uint8_t *storage;
} AspeedOTPState;
#endif /* ASPEED_OTP_H */