mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
ahci: Isolate public AHCI interface
Begin separating the public/private interface by removing the minimum set of information used by code outside of hw/ide/ and calling this a new ahci_public.h file, which will be renamed to ahci.h in a future patch. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-id: 20170623220926.11479-3-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
bbe3179a13
commit
5402fda5ad
2 changed files with 96 additions and 52 deletions
|
@ -21,9 +21,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HW_IDE_AHCI_H
|
#ifndef HW_IDE_AHCI_INTERNAL_H
|
||||||
#define HW_IDE_AHCI_H
|
#define HW_IDE_AHCI_INTERNAL_H
|
||||||
|
|
||||||
|
#include "hw/ide/ahci_public.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
|
|
||||||
#define AHCI_MEM_BAR_SIZE 0x1000
|
#define AHCI_MEM_BAR_SIZE 0x1000
|
||||||
|
@ -210,14 +211,6 @@
|
||||||
#define SATA_CAP_REV 0x2
|
#define SATA_CAP_REV 0x2
|
||||||
#define SATA_CAP_BAR 0x4
|
#define SATA_CAP_BAR 0x4
|
||||||
|
|
||||||
typedef struct AHCIControlRegs {
|
|
||||||
uint32_t cap;
|
|
||||||
uint32_t ghc;
|
|
||||||
uint32_t irqstatus;
|
|
||||||
uint32_t impl;
|
|
||||||
uint32_t version;
|
|
||||||
} AHCIControlRegs;
|
|
||||||
|
|
||||||
typedef struct AHCIPortRegs {
|
typedef struct AHCIPortRegs {
|
||||||
uint32_t lst_addr;
|
uint32_t lst_addr;
|
||||||
uint32_t lst_addr_hi;
|
uint32_t lst_addr_hi;
|
||||||
|
@ -251,8 +244,6 @@ typedef struct AHCI_SG {
|
||||||
uint32_t flags_size;
|
uint32_t flags_size;
|
||||||
} QEMU_PACKED AHCI_SG;
|
} QEMU_PACKED AHCI_SG;
|
||||||
|
|
||||||
typedef struct AHCIDevice AHCIDevice;
|
|
||||||
|
|
||||||
typedef struct NCQTransferState {
|
typedef struct NCQTransferState {
|
||||||
AHCIDevice *drive;
|
AHCIDevice *drive;
|
||||||
BlockAIOCB *aiocb;
|
BlockAIOCB *aiocb;
|
||||||
|
@ -286,27 +277,13 @@ struct AHCIDevice {
|
||||||
NCQTransferState ncq_tfs[AHCI_MAX_CMDS];
|
NCQTransferState ncq_tfs[AHCI_MAX_CMDS];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct AHCIState {
|
struct AHCIPCIState {
|
||||||
DeviceState *container;
|
|
||||||
|
|
||||||
AHCIDevice *dev;
|
|
||||||
AHCIControlRegs control_regs;
|
|
||||||
MemoryRegion mem;
|
|
||||||
MemoryRegion idp; /* Index-Data Pair I/O port space */
|
|
||||||
unsigned idp_offset; /* Offset of index in I/O port space */
|
|
||||||
uint32_t idp_index; /* Current IDP index */
|
|
||||||
int32_t ports;
|
|
||||||
qemu_irq irq;
|
|
||||||
AddressSpace *as;
|
|
||||||
} AHCIState;
|
|
||||||
|
|
||||||
typedef struct AHCIPCIState {
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
PCIDevice parent_obj;
|
PCIDevice parent_obj;
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
|
|
||||||
AHCIState ahci;
|
AHCIState ahci;
|
||||||
} AHCIPCIState;
|
};
|
||||||
|
|
||||||
#define TYPE_ICH9_AHCI "ich9-ahci"
|
#define TYPE_ICH9_AHCI "ich9-ahci"
|
||||||
|
|
||||||
|
@ -372,35 +349,11 @@ void ahci_uninit(AHCIState *s);
|
||||||
|
|
||||||
void ahci_reset(AHCIState *s);
|
void ahci_reset(AHCIState *s);
|
||||||
|
|
||||||
int32_t ahci_get_num_ports(PCIDevice *dev);
|
|
||||||
void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
|
|
||||||
|
|
||||||
#define TYPE_SYSBUS_AHCI "sysbus-ahci"
|
#define TYPE_SYSBUS_AHCI "sysbus-ahci"
|
||||||
#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
|
#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
|
||||||
|
|
||||||
typedef struct SysbusAHCIState {
|
|
||||||
/*< private >*/
|
|
||||||
SysBusDevice parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
AHCIState ahci;
|
|
||||||
uint32_t num_ports;
|
|
||||||
} SysbusAHCIState;
|
|
||||||
|
|
||||||
#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
|
#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
|
||||||
#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
|
#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
|
||||||
TYPE_ALLWINNER_AHCI)
|
TYPE_ALLWINNER_AHCI)
|
||||||
|
|
||||||
#define ALLWINNER_AHCI_MMIO_OFF 0x80
|
|
||||||
#define ALLWINNER_AHCI_MMIO_SIZE 0x80
|
|
||||||
|
|
||||||
struct AllwinnerAHCIState {
|
|
||||||
/*< private >*/
|
|
||||||
SysbusAHCIState parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
MemoryRegion mmio;
|
|
||||||
uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* HW_IDE_AHCI_H */
|
#endif /* HW_IDE_AHCI_H */
|
||||||
|
|
91
include/hw/ide/ahci_public.h
Normal file
91
include/hw/ide/ahci_public.h
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
/*
|
||||||
|
* QEMU AHCI Emulation
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010 qiaochong@loongson.cn
|
||||||
|
* Copyright (c) 2010 Roland Elek <elek.roland@gmail.com>
|
||||||
|
* Copyright (c) 2010 Sebastian Herbszt <herbszt@gmx.de>
|
||||||
|
* Copyright (c) 2010 Alexander Graf <agraf@suse.de>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef HW_IDE_AHCI_H
|
||||||
|
#define HW_IDE_AHCI_H
|
||||||
|
|
||||||
|
#include "hw/sysbus.h"
|
||||||
|
|
||||||
|
typedef struct AHCIDevice AHCIDevice;
|
||||||
|
|
||||||
|
typedef struct AHCIControlRegs {
|
||||||
|
uint32_t cap;
|
||||||
|
uint32_t ghc;
|
||||||
|
uint32_t irqstatus;
|
||||||
|
uint32_t impl;
|
||||||
|
uint32_t version;
|
||||||
|
} AHCIControlRegs;
|
||||||
|
|
||||||
|
typedef struct AHCIState {
|
||||||
|
DeviceState *container;
|
||||||
|
|
||||||
|
AHCIDevice *dev;
|
||||||
|
AHCIControlRegs control_regs;
|
||||||
|
MemoryRegion mem;
|
||||||
|
MemoryRegion idp; /* Index-Data Pair I/O port space */
|
||||||
|
unsigned idp_offset; /* Offset of index in I/O port space */
|
||||||
|
uint32_t idp_index; /* Current IDP index */
|
||||||
|
int32_t ports;
|
||||||
|
qemu_irq irq;
|
||||||
|
AddressSpace *as;
|
||||||
|
} AHCIState;
|
||||||
|
|
||||||
|
typedef struct AHCIPCIState AHCIPCIState;
|
||||||
|
|
||||||
|
#define TYPE_ICH9_AHCI "ich9-ahci"
|
||||||
|
|
||||||
|
#define ICH_AHCI(obj) \
|
||||||
|
OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
|
||||||
|
|
||||||
|
int32_t ahci_get_num_ports(PCIDevice *dev);
|
||||||
|
void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
|
||||||
|
|
||||||
|
#define TYPE_SYSBUS_AHCI "sysbus-ahci"
|
||||||
|
#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
|
||||||
|
|
||||||
|
typedef struct SysbusAHCIState {
|
||||||
|
/*< private >*/
|
||||||
|
SysBusDevice parent_obj;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
AHCIState ahci;
|
||||||
|
uint32_t num_ports;
|
||||||
|
} SysbusAHCIState;
|
||||||
|
|
||||||
|
#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
|
||||||
|
#define ALLWINNER_AHCI(obj) OBJECT_CHECK(AllwinnerAHCIState, (obj), \
|
||||||
|
TYPE_ALLWINNER_AHCI)
|
||||||
|
|
||||||
|
#define ALLWINNER_AHCI_MMIO_OFF 0x80
|
||||||
|
#define ALLWINNER_AHCI_MMIO_SIZE 0x80
|
||||||
|
|
||||||
|
struct AllwinnerAHCIState {
|
||||||
|
/*< private >*/
|
||||||
|
SysbusAHCIState parent_obj;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
MemoryRegion mmio;
|
||||||
|
uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4];
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* HW_IDE_AHCI_H */
|
Loading…
Add table
Add a link
Reference in a new issue