2 Copyright © 2017-2019, The AROS Development Team. All rights reserved.
5 Desc: Elbox FastATA HIDD
9 #include <aros/debug.h>
10 #include <proto/exec.h>
12 #include <hardware/ata.h>
17 #include <utility/tagitem.h>
18 #include <proto/kernel.h>
19 #include <proto/oop.h>
20 #include <proto/utility.h>
21 #include <hardware/intbits.h>
23 #include "bus_class.h"
24 #include "interface_pio.h"
26 AROS_INTH1(IDE_Handler_FASTATA
, struct ATA_BusData
*, bus
)
30 D(bug("[ATA:FastATA] %s()\n", __func__
);)
37 static BOOL
ata_CreateFastATAInterrupt(struct ATA_BusData
*bus
, UBYTE num
)
39 D(bug("[ATA:FastATA] %s()\n", __func__
);)
42 static void ata_RemoveFastATAInterrupt(struct ATA_BusData
*bus
)
44 D(bug("[ATA:FastATA] %s()\n", __func__
);)
47 OOP_Object
*FASTATA__Root__New(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_New
*msg
)
49 struct ataBase
*base
= cl
->UserData
;
50 struct ata_ProbedBus
*bus
= (struct ata_ProbedBus
*)GetTagData(aHidd_DriverData
, 0, msg
->attrList
);
52 D(bug("[ATA:FastATA] %s()\n", __func__
);)
57 o
= (OOP_Object
*)OOP_DoSuperMethod(cl
, o
, (OOP_Msg
)msg
);
60 struct ATA_BusData
*data
= OOP_INST_DATA(cl
, o
);
63 data
->gaylebase
= data
->bus
->port
;
64 data
->gayleirqbase
= data
->bus
->gayleirqbase
;
65 ata_CreateFastATAInterrupt(data
, 0);
68 D(bug("[ATA:FastATA] %s: Instance @ %p\n", __func__
, o
);)
72 void FASTATA__Root__Dispose(OOP_Class
*cl
, OOP_Object
*o
, OOP_Msg msg
)
74 struct ATA_BusData
*data
= OOP_INST_DATA(cl
, o
);
76 D(bug("[ATA:FastATA] %s()\n", __func__
);)
78 ata_RemoveFastATAInterrupt(data
);
81 OOP_DoSuperMethod(cl
, o
, msg
);
84 void FASTATA__Root__Get(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_Get
*msg
)
86 struct ataBase
*base
= cl
->UserData
;
89 D(bug("[ATA:FastATA] %s()\n", __func__
);)
91 Hidd_ATABus_Switch(msg
->attrID
, idx
)
93 case aoHidd_ATABus_Use80Wire
:
94 *msg
->storage
= FALSE
;
97 case aoHidd_ATABus_UseDMA
:
98 *msg
->storage
= FALSE
;
101 case aoHidd_ATABus_Use32Bit
:
102 *msg
->storage
= TRUE
;
106 OOP_DoSuperMethod(cl
, o
, &msg
->mID
);
109 void FASTATA__Root__Set(OOP_Class
*cl
, OOP_Object
*o
, struct pRoot_Set
*msg
)
111 struct ataBase
*base
= cl
->UserData
;
112 struct ATA_BusData
*data
= OOP_INST_DATA(cl
, o
);
113 struct TagItem
*tstate
= msg
->attrList
;
116 D(bug("[ATA:FastATA] %s()\n", __func__
);)
118 while ((tag
= NextTagItem(&tstate
)))
122 Hidd_Bus_Switch(tag
->ti_Tag
, idx
)
124 case aoHidd_Bus_IRQHandler
:
125 data
->ata_HandleIRQ
= (APTR
)tag
->ti_Data
;
128 case aoHidd_Bus_IRQData
:
129 data
->irqData
= (APTR
)tag
->ti_Data
;
135 APTR
FASTATA__Hidd_ATABus__GetPIOInterface(OOP_Class
*cl
, OOP_Object
*o
, OOP_Msg msg
)
137 struct ATA_BusData
*data
= OOP_INST_DATA(cl
, o
);
138 struct pio_data
*pio
= (struct pio_data
*)OOP_DoSuperMethod(cl
, o
, msg
);
140 D(bug("[ATA:FastATA] %s()\n", __func__
);)
144 pio
->port
= data
->bus
->port
;
145 pio
->altport
= data
->bus
->altport
;
146 pio
->dataport
= (UBYTE
*)(((ULONG
)pio
->port
) & ~3);
152 BOOL
FASTATA__Hidd_ATABus__SetXferMode(OOP_Class
*cl
, OOP_Object
*obj
, OOP_Msg msg
)
154 D(bug("[ATA:FastATA] %s()\n", __func__
);)
159 void FASTATA__Hidd_ATABus__Shutdown(OOP_Class
*cl
, OOP_Object
*o
, OOP_Msg msg
)
161 D(bug("[ATA:FastATA] %s()\n", __func__
);)
163 OOP_DoSuperMethod(cl
, o
, msg
);