]>
Commit | Line | Data |
---|---|---|
f83a40dc AG |
1 | /* |
2 | * QEMU AHCI Emulation | |
3 | * | |
4 | * Copyright (c) 2010 qiaochong@loongson.cn | |
5 | * Copyright (c) 2010 Roland Elek <elek.roland@gmail.com> | |
6 | * Copyright (c) 2010 Sebastian Herbszt <herbszt@gmx.de> | |
7 | * Copyright (c) 2010 Alexander Graf <agraf@suse.de> | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License as published by the Free Software Foundation; either | |
12 | * version 2 of the License, or (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public | |
20 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. | |
21 | * | |
22 | */ | |
23 | ||
70e23370 JS |
24 | #ifndef HW_IDE_AHCI_H |
25 | #define HW_IDE_AHCI_H | |
03c7a6a8 | 26 | |
a9c94277 | 27 | #include "hw/sysbus.h" |
db1015e9 | 28 | #include "qom/object.h" |
5ea8b9c5 | 29 | |
70e23370 | 30 | typedef struct AHCIDevice AHCIDevice; |
03c7a6a8 | 31 | |
70e23370 JS |
32 | typedef struct AHCIControlRegs { |
33 | uint32_t cap; | |
34 | uint32_t ghc; | |
35 | uint32_t irqstatus; | |
36 | uint32_t impl; | |
37 | uint32_t version; | |
38 | } AHCIControlRegs; | |
03c7a6a8 | 39 | |
70e23370 JS |
40 | typedef struct AHCIState { |
41 | DeviceState *container; | |
03c7a6a8 | 42 | |
70e23370 JS |
43 | AHCIDevice *dev; |
44 | AHCIControlRegs control_regs; | |
45 | MemoryRegion mem; | |
46 | MemoryRegion idp; /* Index-Data Pair I/O port space */ | |
47 | unsigned idp_offset; /* Offset of index in I/O port space */ | |
48 | uint32_t idp_index; /* Current IDP index */ | |
49 | int32_t ports; | |
50 | qemu_irq irq; | |
51 | AddressSpace *as; | |
52 | } AHCIState; | |
03c7a6a8 | 53 | |
70e23370 | 54 | typedef struct AHCIPCIState AHCIPCIState; |
03c7a6a8 | 55 | |
fd58922c | 56 | #define TYPE_ICH9_AHCI "ich9-ahci" |
8110fa1d EH |
57 | DECLARE_INSTANCE_CHECKER(AHCIPCIState, ICH_AHCI, |
58 | TYPE_ICH9_AHCI) | |
fd58922c | 59 | |
70e23370 JS |
60 | int32_t ahci_get_num_ports(PCIDevice *dev); |
61 | void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd); | |
03c7a6a8 | 62 | |
5ea8b9c5 | 63 | #define TYPE_SYSBUS_AHCI "sysbus-ahci" |
db1015e9 | 64 | typedef struct SysbusAHCIState SysbusAHCIState; |
8110fa1d EH |
65 | DECLARE_INSTANCE_CHECKER(SysbusAHCIState, SYSBUS_AHCI, |
66 | TYPE_SYSBUS_AHCI) | |
5ea8b9c5 | 67 | |
db1015e9 | 68 | struct SysbusAHCIState { |
70e23370 JS |
69 | /*< private >*/ |
70 | SysBusDevice parent_obj; | |
71 | /*< public >*/ | |
72 | ||
73 | AHCIState ahci; | |
74 | uint32_t num_ports; | |
db1015e9 | 75 | }; |
70e23370 | 76 | |
377e2145 | 77 | #define TYPE_ALLWINNER_AHCI "allwinner-ahci" |
db1015e9 | 78 | typedef struct AllwinnerAHCIState AllwinnerAHCIState; |
8110fa1d EH |
79 | DECLARE_INSTANCE_CHECKER(AllwinnerAHCIState, ALLWINNER_AHCI, |
80 | TYPE_ALLWINNER_AHCI) | |
377e2145 | 81 | |
70e23370 JS |
82 | #define ALLWINNER_AHCI_MMIO_OFF 0x80 |
83 | #define ALLWINNER_AHCI_MMIO_SIZE 0x80 | |
84 | ||
db1015e9 | 85 | struct AllwinnerAHCIState { |
70e23370 JS |
86 | /*< private >*/ |
87 | SysbusAHCIState parent_obj; | |
88 | /*< public >*/ | |
89 | ||
90 | MemoryRegion mmio; | |
91 | uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4]; | |
db1015e9 | 92 | }; |
70e23370 | 93 | |
03c7a6a8 | 94 | #endif /* HW_IDE_AHCI_H */ |