Added the AMD Am28F010 Flash chip.

This commit is contained in:
OBattler
2025-06-10 01:34:15 +02:00
parent a82bb4269f
commit 4a971a7fbc
2 changed files with 42 additions and 13 deletions

View File

@@ -20,6 +20,7 @@
#ifndef EMU_FLASH_H #ifndef EMU_FLASH_H
#define EMU_FLASH_H #define EMU_FLASH_H
extern const device_t amd_am28f010_flash_device;
extern const device_t catalyst_flash_device; extern const device_t catalyst_flash_device;
extern const device_t intel_flash_bxt_ami_device; extern const device_t intel_flash_bxt_ami_device;

View File

@@ -29,6 +29,7 @@
#include <86box/timer.h> #include <86box/timer.h>
#include <86box/nvr.h> #include <86box/nvr.h>
#include <86box/plat.h> #include <86box/plat.h>
#include <86box/plat_fallthrough.h>
#define FLAG_WORD 4 #define FLAG_WORD 4
#define FLAG_BXB 2 #define FLAG_BXB 2
@@ -44,21 +45,22 @@ enum {
}; };
enum { enum {
CMD_SET_READ = 0x00, CMD_SET_READ = 0x00,
CMD_READ_SIGNATURE = 0x90, CMD_READ_AUTO_SELECT = 0x80,
CMD_ERASE = 0x20, CMD_READ_SIGNATURE = 0x90,
CMD_ERASE_CONFIRM = 0x20, CMD_ERASE = 0x20,
CMD_ERASE_VERIFY = 0xA0, CMD_ERASE_CONFIRM = 0x20,
CMD_PROGRAM = 0x40, CMD_ERASE_VERIFY = 0xA0,
CMD_PROGRAM_VERIFY = 0xC0, CMD_PROGRAM = 0x40,
CMD_RESET = 0xFF CMD_PROGRAM_VERIFY = 0xC0,
CMD_RESET = 0xFF
}; };
typedef struct flash_t { typedef struct flash_t {
uint8_t command; uint8_t command;
uint8_t is_amd;
uint8_t pad; uint8_t pad;
uint8_t pad0; uint8_t pad0;
uint8_t pad1;
uint8_t *array; uint8_t *array;
mem_mapping_t mapping; mem_mapping_t mapping;
@@ -83,11 +85,22 @@ flash_read(uint32_t addr, void *priv)
ret = dev->array[addr]; ret = dev->array[addr];
break; break;
case CMD_READ_AUTO_SELECT:
if (!dev->is_amd)
break;
fallthrough;
case CMD_READ_SIGNATURE: case CMD_READ_SIGNATURE:
if (addr == 0x00000) if (dev->is_amd) {
ret = 0x31; /* CATALYST */ if (addr == 0x00000)
else if (addr == 0x00001) ret = 0x01; /* AMD */
ret = 0xB4; /* 28F010 */ else if (addr == 0x00001)
ret = 0xa7; /* Am28F010 */
} else {
if (addr == 0x00000)
ret = 0x31; /* CATALYST */
else if (addr == 0x00001)
ret = 0xb4; /* 28F010 */
}
break; break;
default: default:
@@ -205,6 +218,7 @@ catalyst_flash_init(UNUSED(const device_t *info))
catalyst_flash_add_mappings(dev); catalyst_flash_add_mappings(dev);
dev->command = CMD_RESET; dev->command = CMD_RESET;
dev->is_amd = info->local;
fp = nvr_fopen(flash_path, "rb"); fp = nvr_fopen(flash_path, "rb");
if (fp) { if (fp) {
@@ -244,3 +258,17 @@ const device_t catalyst_flash_device = {
.force_redraw = NULL, .force_redraw = NULL,
.config = NULL .config = NULL
}; };
const device_t amd_am28f010_flash_device = {
.name = "AMD Am28F010-D Flash BIOS",
.internal_name = "amd_am28f010_flash",
.flags = DEVICE_PCI,
.local = 1,
.init = catalyst_flash_init,
.close = catalyst_flash_close,
.reset = catalyst_flash_reset,
.available = NULL,
.speed_changed = NULL,
.force_redraw = NULL,
.config = NULL
};