amex/eeprom.c: Handle ABI version ioctl

This commit is contained in:
Felix Anderson 2021-09-01 22:52:32 +00:00
parent c6b245d103
commit 0b9f81fb2a
Signed by untrusted user: felix
GPG Key ID: 69ADF8AEB6C8B5D1

View File

@ -20,6 +20,10 @@
#include "util/dprintf.h" #include "util/dprintf.h"
#include "util/str.h" #include "util/str.h"
enum {
EEPROM_IOCTL_GET_ABI_VERSION = 0x80006000,
};
static HRESULT eeprom_handle_irp(struct irp *irp); static HRESULT eeprom_handle_irp(struct irp *irp);
static HRESULT eeprom_handle_open(struct irp *irp); static HRESULT eeprom_handle_open(struct irp *irp);
static HRESULT eeprom_handle_close(struct irp *irp); static HRESULT eeprom_handle_close(struct irp *irp);
@ -28,6 +32,7 @@ static HRESULT eeprom_handle_read(struct irp *irp);
static HRESULT eeprom_handle_write(struct irp *irp); static HRESULT eeprom_handle_write(struct irp *irp);
static HRESULT eeprom_ioctl_get_geometry(struct irp *irp); static HRESULT eeprom_ioctl_get_geometry(struct irp *irp);
static HRESULT eeprom_ioctl_get_abi_version(struct irp *irp);
static struct eeprom_config eeprom_config; static struct eeprom_config eeprom_config;
static HANDLE eeprom_file; static HANDLE eeprom_file;
@ -117,6 +122,9 @@ static HRESULT eeprom_handle_ioctl(struct irp *irp)
case IOCTL_DISK_GET_DRIVE_GEOMETRY: case IOCTL_DISK_GET_DRIVE_GEOMETRY:
return eeprom_ioctl_get_geometry(irp); return eeprom_ioctl_get_geometry(irp);
case EEPROM_IOCTL_GET_ABI_VERSION:
return eeprom_ioctl_get_abi_version(irp);
default: default:
dprintf("EEPROM: Unknown ioctl %x, write %i read %i\n", dprintf("EEPROM: Unknown ioctl %x, write %i read %i\n",
irp->ioctl, irp->ioctl,
@ -150,6 +158,11 @@ static HRESULT eeprom_ioctl_get_geometry(struct irp *irp)
return hr; return hr;
} }
static HRESULT eeprom_ioctl_get_abi_version(struct irp *irp)
{
return iobuf_write_le16(&irp->read, 256);
}
static HRESULT eeprom_handle_read(struct irp *irp) static HRESULT eeprom_handle_read(struct irp *irp)
{ {
if (irp->ovl == NULL) { if (irp->ovl == NULL) {