mirror of
https://github.com/LIV2/lide.device.git
synced 2025-12-06 00:32:45 +00:00
Remove unused/unneeded parts of IDEUnit struct
This commit is contained in:
parent
657151b6e8
commit
6696cadfd2
24
ata.c
24
ata.c
@ -342,9 +342,10 @@ void ata_set_xfer(struct IDEUnit *unit, enum xfer method) {
|
||||
*
|
||||
* Initialize a unit, check if it is there and responding
|
||||
* @param unit Pointer to an IDEUnit struct
|
||||
* @param base Base address of the drive registers
|
||||
* @returns false on error
|
||||
*/
|
||||
bool ata_init_unit(struct IDEUnit *unit) {
|
||||
bool ata_init_unit(struct IDEUnit *unit, void *base) {
|
||||
struct ExecBase *SysBase = unit->SysBase;
|
||||
|
||||
unit->cylinders = 0;
|
||||
@ -354,20 +355,17 @@ bool ata_init_unit(struct IDEUnit *unit) {
|
||||
unit->present = false;
|
||||
unit->mediumPresent = false;
|
||||
|
||||
ULONG offset;
|
||||
UWORD *buf;
|
||||
bool dev_found = false;
|
||||
|
||||
offset = (unit->channel == 0) ? CHANNEL_0 : CHANNEL_1;
|
||||
|
||||
unit->drive.data = (UWORD*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_data);
|
||||
unit->drive.error_features = (UBYTE*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_error);
|
||||
unit->drive.sectorCount = (UBYTE*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_sectorCount);
|
||||
unit->drive.lbaLow = (UBYTE*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_lbaLow);
|
||||
unit->drive.lbaMid = (UBYTE*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_lbaMid);
|
||||
unit->drive.lbaHigh = (UBYTE*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_lbaHigh);
|
||||
unit->drive.devHead = (UBYTE*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_devHead);
|
||||
unit->drive.status_command = (UBYTE*) ((void *)unit->cd->cd_BoardAddr + offset + ata_reg_status);
|
||||
unit->drive.data = (UWORD*) (base + ata_reg_data);
|
||||
unit->drive.error_features = (UBYTE*) (base + ata_reg_error);
|
||||
unit->drive.sectorCount = (UBYTE*) (base + ata_reg_sectorCount);
|
||||
unit->drive.lbaLow = (UBYTE*) (base + ata_reg_lbaLow);
|
||||
unit->drive.lbaMid = (UBYTE*) (base + ata_reg_lbaMid);
|
||||
unit->drive.lbaHigh = (UBYTE*) (base + ata_reg_lbaHigh);
|
||||
unit->drive.devHead = (UBYTE*) (base + ata_reg_devHead);
|
||||
unit->drive.status_command = (UBYTE*) (base + ata_reg_status);
|
||||
|
||||
*unit->shadowDevHead = *unit->drive.devHead = (unit->primary) ? 0xE0 : 0xF0; // Select drive
|
||||
|
||||
@ -376,7 +374,7 @@ bool ata_init_unit(struct IDEUnit *unit) {
|
||||
|
||||
for (int i=0; i<(8*NEXT_REG); i+=NEXT_REG) {
|
||||
// Check if the bus is floating (D7/6 pulled-up with resistors)
|
||||
if ((i != ata_reg_devHead) && (*((volatile UBYTE *)unit->cd->cd_BoardAddr + offset + i) & 0xC0) != 0xC0) {
|
||||
if ((i != ata_reg_devHead) && (*((volatile UBYTE *)base + i) & 0xC0) != 0xC0) {
|
||||
dev_found = true;
|
||||
Trace("INIT: Unit base: %08lx; Drive base %08lx\n",unit, unit->drive);
|
||||
break;
|
||||
|
||||
2
ata.h
2
ata.h
@ -104,7 +104,7 @@ enum xfer_dir {
|
||||
#define ATA_RDY_WAIT_COUNT (ATA_RDY_WAIT_S * 1000 * (1000 / ATA_RDY_WAIT_LOOP_US))
|
||||
|
||||
|
||||
bool ata_init_unit(struct IDEUnit *);
|
||||
bool ata_init_unit(struct IDEUnit *unit, void *base);
|
||||
bool ata_select(struct IDEUnit *unit, UBYTE select, bool wait);
|
||||
bool ata_identify(struct IDEUnit *, UWORD *);
|
||||
bool ata_set_multiple(struct IDEUnit *unit, BYTE multiple);
|
||||
|
||||
17
device.c
17
device.c
@ -236,22 +236,6 @@ static void Cleanup(struct DeviceBase *dev) {
|
||||
Info("Cleaning up...\n");
|
||||
struct ExecBase *SysBase = *(struct ExecBase **)4UL;
|
||||
char *devName = dev->lib.lib_Node.ln_Name;
|
||||
struct IDEUnit *unit;
|
||||
|
||||
if (SysBase->LibNode.lib_Version >= 36) {
|
||||
ObtainSemaphoreShared(&dev->ulSem);
|
||||
} else {
|
||||
ObtainSemaphore(&dev->ulSem);
|
||||
}
|
||||
|
||||
for (unit = (struct IDEUnit *)dev->units.mlh_Head;
|
||||
unit->mn_Node.mln_Succ != NULL;
|
||||
unit = (struct IDEUnit *)unit->mn_Node.mln_Succ)
|
||||
{
|
||||
unit->cd->cd_Flags |= CDF_CONFIGME;
|
||||
}
|
||||
|
||||
ReleaseSemaphore(&dev->ulSem);
|
||||
|
||||
if (dev->ExpansionBase) CloseLibrary((struct Library *)dev->ExpansionBase);
|
||||
|
||||
@ -261,6 +245,7 @@ static void Cleanup(struct DeviceBase *dev) {
|
||||
itask->mn_Node.mln_Succ != NULL;
|
||||
itask = (struct IDETask *)itask->mn_Node.mln_Succ)
|
||||
{
|
||||
itask->cd->cd_Flags |= CDF_CONFIGME;
|
||||
FreeMem(itask,sizeof(struct IDETask));
|
||||
}
|
||||
|
||||
|
||||
3
device.h
3
device.h
@ -44,8 +44,6 @@ struct Drive {
|
||||
|
||||
struct IDEUnit {
|
||||
struct MinNode mn_Node;
|
||||
struct Unit io_unit;
|
||||
struct ConfigDev *cd;
|
||||
struct ExecBase *SysBase;
|
||||
struct IDETask *itask;
|
||||
struct Drive drive;
|
||||
@ -58,7 +56,6 @@ struct IDEUnit {
|
||||
volatile UBYTE *shadowDevHead;
|
||||
volatile void *changeInt;
|
||||
UBYTE unitNum;
|
||||
UBYTE channel;
|
||||
UBYTE deviceType;
|
||||
UBYTE last_error[6];
|
||||
bool primary;
|
||||
|
||||
@ -422,14 +422,13 @@ static BYTE init_units(struct IDETask *itask) {
|
||||
|
||||
for (BYTE i=0; i < 2; i++) {
|
||||
struct IDEUnit *unit = AllocMem(sizeof(struct IDEUnit),MEMF_ANY|MEMF_CLEAR);
|
||||
|
||||
if (unit != NULL) {
|
||||
// Setup each unit structure
|
||||
unit->itask = itask;
|
||||
unit->unitNum = ((itask->boardNum * 4) + (itask->channel << 1) + i);
|
||||
unit->SysBase = SysBase;
|
||||
unit->cd = itask->cd;
|
||||
unit->primary = ((i%2) == 1) ? false : true;
|
||||
unit->channel = itask->channel;
|
||||
unit->openCount = 0;
|
||||
unit->changeCount = 1;
|
||||
unit->deviceType = DG_DIRECT_ACCESS;
|
||||
@ -449,7 +448,10 @@ static BYTE init_units(struct IDETask *itask) {
|
||||
|
||||
Warn("testing unit %ld\n",unit->unitNum);
|
||||
|
||||
if (ata_init_unit(unit)) {
|
||||
void *base = itask->cd->cd_BoardAddr;
|
||||
base += (itask->channel == 0) ? CHANNEL_0 : CHANNEL_1;
|
||||
|
||||
if (ata_init_unit(unit,base)) {
|
||||
if (unit->atapi) itask->hasRemovables = true;
|
||||
num_units++;
|
||||
itask->dev->numUnits++;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user