hw/ide: Move IDE DMA related definitions to a separate header ide-dma.h

These definitions are required outside of the hw/ide/ code, too,
so lets's move them from internal.h to a new header called ide-dma.h.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240220085505.30255-4-thuth@redhat.com>
[PMD: Use IDEDMAOps typedef in struct IDEDMA]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
Thomas Huth 2024-02-20 09:55:01 +01:00 committed by Philippe Mathieu-Daudé
parent 7bd8b0d4f5
commit 1b986676eb
2 changed files with 38 additions and 28 deletions

37
include/hw/ide/ide-dma.h Normal file
View File

@ -0,0 +1,37 @@
#ifndef HW_IDE_DMA_H
#define HW_IDE_DMA_H
#include "block/aio.h"
#include "qemu/iov.h"
typedef struct IDEState IDEState;
typedef struct IDEDMAOps IDEDMAOps;
typedef struct IDEDMA IDEDMA;
typedef void DMAStartFunc(const IDEDMA *, IDEState *, BlockCompletionFunc *);
typedef void DMAVoidFunc(const IDEDMA *);
typedef int DMAIntFunc(const IDEDMA *, bool);
typedef int32_t DMAInt32Func(const IDEDMA *, int32_t len);
typedef void DMAu32Func(const IDEDMA *, uint32_t);
typedef void DMAStopFunc(const IDEDMA *, bool);
struct IDEDMAOps {
DMAStartFunc *start_dma;
DMAVoidFunc *pio_transfer;
DMAInt32Func *prepare_buf;
DMAu32Func *commit_buf;
DMAIntFunc *rw_buf;
DMAVoidFunc *restart;
DMAVoidFunc *restart_dma;
DMAStopFunc *set_inactive;
DMAVoidFunc *cmd_done;
DMAVoidFunc *reset;
};
struct IDEDMA {
const IDEDMAOps *ops;
QEMUIOVector qiov;
BlockAIOCB *aiocb;
};
#endif

View File

@ -11,6 +11,7 @@
#include "sysemu/dma.h"
#include "hw/block/block.h"
#include "exec/ioport.h"
#include "hw/ide/ide-dma.h"
/* debug IDE devices */
#define USE_DMA_CDROM
@ -18,8 +19,6 @@
typedef struct IDEDevice IDEDevice;
typedef struct IDEState IDEState;
typedef struct IDEDMA IDEDMA;
typedef struct IDEDMAOps IDEDMAOps;
#define TYPE_IDE_BUS "IDE"
OBJECT_DECLARE_SIMPLE_TYPE(IDEBus, IDE_BUS)
@ -332,13 +331,6 @@ typedef enum { IDE_HD, IDE_CD, IDE_CFATA } IDEDriveKind;
typedef void EndTransferFunc(IDEState *);
typedef void DMAStartFunc(const IDEDMA *, IDEState *, BlockCompletionFunc *);
typedef void DMAVoidFunc(const IDEDMA *);
typedef int DMAIntFunc(const IDEDMA *, bool);
typedef int32_t DMAInt32Func(const IDEDMA *, int32_t len);
typedef void DMAu32Func(const IDEDMA *, uint32_t);
typedef void DMAStopFunc(const IDEDMA *, bool);
struct unreported_events {
bool eject_request;
bool new_media;
@ -460,25 +452,6 @@ struct IDEState {
int ncq_queues;
};
struct IDEDMAOps {
DMAStartFunc *start_dma;
DMAVoidFunc *pio_transfer;
DMAInt32Func *prepare_buf;
DMAu32Func *commit_buf;
DMAIntFunc *rw_buf;
DMAVoidFunc *restart;
DMAVoidFunc *restart_dma;
DMAStopFunc *set_inactive;
DMAVoidFunc *cmd_done;
DMAVoidFunc *reset;
};
struct IDEDMA {
const struct IDEDMAOps *ops;
QEMUIOVector qiov;
BlockAIOCB *aiocb;
};
struct IDEBus {
BusState qbus;
IDEDevice *master;