| 
									
										
										
										
											2011-02-01 15:51:27 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * 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 | 
					
						
							| 
									
										
										
										
											2020-10-23 12:44:24 +00:00
										 |  |  |  * version 2.1 of the License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:27 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * 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/>.
 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | #ifndef HW_IDE_AHCI_H
 | 
					
						
							|  |  |  | #define HW_IDE_AHCI_H
 | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-22 19:11:19 +02:00
										 |  |  | #include "hw/sysbus.h"
 | 
					
						
							| 
									
										
										
										
											2020-09-03 16:43:22 -04:00
										 |  |  | #include "qom/object.h"
 | 
					
						
							| 
									
										
										
										
											2015-09-08 17:38:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | typedef struct AHCIDevice AHCIDevice; | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | typedef struct AHCIControlRegs { | 
					
						
							|  |  |  |     uint32_t    cap; | 
					
						
							|  |  |  |     uint32_t    ghc; | 
					
						
							|  |  |  |     uint32_t    irqstatus; | 
					
						
							|  |  |  |     uint32_t    impl; | 
					
						
							|  |  |  |     uint32_t    version; | 
					
						
							|  |  |  | } AHCIControlRegs; | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | typedef struct AHCIState { | 
					
						
							|  |  |  |     DeviceState *container; | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  |     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; | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:26 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-24 16:55:45 +10:00
										 |  |  | #define TYPE_ICH9_AHCI "ich9-ahci"
 | 
					
						
							| 
									
										
										
										
											2020-09-16 14:25:19 -04:00
										 |  |  | OBJECT_DECLARE_SIMPLE_TYPE(AHCIPCIState, ICH9_AHCI) | 
					
						
							| 
									
										
										
										
											2013-06-24 16:55:45 +10:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | int32_t ahci_get_num_ports(PCIDevice *dev); | 
					
						
							|  |  |  | void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd); | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:26 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-08 17:38:45 +01:00
										 |  |  | #define TYPE_SYSBUS_AHCI "sysbus-ahci"
 | 
					
						
							| 
									
										
										
										
											2020-09-16 14:25:19 -04:00
										 |  |  | OBJECT_DECLARE_SIMPLE_TYPE(SysbusAHCIState, SYSBUS_AHCI) | 
					
						
							| 
									
										
										
										
											2015-09-08 17:38:45 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-03 16:43:22 -04:00
										 |  |  | struct SysbusAHCIState { | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  |     /*< private >*/ | 
					
						
							|  |  |  |     SysBusDevice parent_obj; | 
					
						
							|  |  |  |     /*< public >*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     AHCIState ahci; | 
					
						
							|  |  |  |     uint32_t num_ports; | 
					
						
							| 
									
										
										
										
											2020-09-03 16:43:22 -04:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-06 14:09:01 -05:00
										 |  |  | #define TYPE_ALLWINNER_AHCI "allwinner-ahci"
 | 
					
						
							| 
									
										
										
										
											2020-09-16 14:25:19 -04:00
										 |  |  | OBJECT_DECLARE_SIMPLE_TYPE(AllwinnerAHCIState, ALLWINNER_AHCI) | 
					
						
							| 
									
										
										
										
											2015-11-06 14:09:01 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | #define ALLWINNER_AHCI_MMIO_OFF  0x80
 | 
					
						
							|  |  |  | #define ALLWINNER_AHCI_MMIO_SIZE 0x80
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-03 16:43:22 -04:00
										 |  |  | struct AllwinnerAHCIState { | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  |     /*< private >*/ | 
					
						
							|  |  |  |     SysbusAHCIState parent_obj; | 
					
						
							|  |  |  |     /*< public >*/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     MemoryRegion mmio; | 
					
						
							|  |  |  |     uint32_t regs[ALLWINNER_AHCI_MMIO_SIZE/4]; | 
					
						
							| 
									
										
										
										
											2020-09-03 16:43:22 -04:00
										 |  |  | }; | 
					
						
							| 
									
										
										
										
											2017-07-18 11:47:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-01 15:51:26 +01:00
										 |  |  | #endif /* HW_IDE_AHCI_H */
 |