xref: /qemu/include/hw/ide/ahci.h (revision fc524567087c2537b5103cdfc1d41e4f442892b6)
1f83a40dcSAlexander Graf /*
2f83a40dcSAlexander Graf  * QEMU AHCI Emulation
3f83a40dcSAlexander Graf  *
4f83a40dcSAlexander Graf  * Copyright (c) 2010 qiaochong@loongson.cn
5f83a40dcSAlexander Graf  * Copyright (c) 2010 Roland Elek <elek.roland@gmail.com>
6f83a40dcSAlexander Graf  * Copyright (c) 2010 Sebastian Herbszt <herbszt@gmx.de>
7f83a40dcSAlexander Graf  * Copyright (c) 2010 Alexander Graf <agraf@suse.de>
8f83a40dcSAlexander Graf  *
9f83a40dcSAlexander Graf  * This library is free software; you can redistribute it and/or
10f83a40dcSAlexander Graf  * modify it under the terms of the GNU Lesser General Public
11f83a40dcSAlexander Graf  * License as published by the Free Software Foundation; either
1261f3c91aSChetan Pant  * version 2.1 of the License, or (at your option) any later version.
13f83a40dcSAlexander Graf  *
14f83a40dcSAlexander Graf  * This library is distributed in the hope that it will be useful,
15f83a40dcSAlexander Graf  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16f83a40dcSAlexander Graf  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17f83a40dcSAlexander Graf  * Lesser General Public License for more details.
18f83a40dcSAlexander Graf  *
19f83a40dcSAlexander Graf  * You should have received a copy of the GNU Lesser General Public
20f83a40dcSAlexander Graf  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21f83a40dcSAlexander Graf  *
22f83a40dcSAlexander Graf  */
23f83a40dcSAlexander Graf 
2470e23370SJohn Snow #ifndef HW_IDE_AHCI_H
2570e23370SJohn Snow #define HW_IDE_AHCI_H
2603c7a6a8SSebastian Herbszt 
27*8be545baSRichard Henderson #include "system/memory.h"
285ea8b9c5SAlistair Francis 
2970e23370SJohn Snow typedef struct AHCIDevice AHCIDevice;
3003c7a6a8SSebastian Herbszt 
3170e23370SJohn Snow typedef struct AHCIControlRegs {
3270e23370SJohn Snow     uint32_t    cap;
3370e23370SJohn Snow     uint32_t    ghc;
3470e23370SJohn Snow     uint32_t    irqstatus;
3570e23370SJohn Snow     uint32_t    impl;
3670e23370SJohn Snow     uint32_t    version;
3770e23370SJohn Snow } AHCIControlRegs;
3803c7a6a8SSebastian Herbszt 
3970e23370SJohn Snow typedef struct AHCIState {
4070e23370SJohn Snow     AHCIDevice *dev;
4170e23370SJohn Snow     AHCIControlRegs control_regs;
4270e23370SJohn Snow     MemoryRegion mem;
4370e23370SJohn Snow     MemoryRegion idp;       /* Index-Data Pair I/O port space */
4470e23370SJohn Snow     unsigned idp_offset;    /* Offset of index in I/O port space */
4570e23370SJohn Snow     uint32_t idp_index;     /* Current IDP index */
4644c11b2eSPhilippe Mathieu-Daudé     uint32_t ports;
4770e23370SJohn Snow     qemu_irq irq;
4870e23370SJohn Snow     AddressSpace *as;
4970e23370SJohn Snow } AHCIState;
5003c7a6a8SSebastian Herbszt 
5103c7a6a8SSebastian Herbszt 
52e2f8d280SPhilippe Mathieu-Daudé void ahci_ide_create_devs(AHCIState *ahci, DriveInfo **hd);
5303c7a6a8SSebastian Herbszt 
5403c7a6a8SSebastian Herbszt #endif /* HW_IDE_AHCI_H */
55