Fix to properly shadow the DEV bit in the Drive/Head register so other

disks are properly detected and handled

--HG--
extra : convert_revision : ffc3046deb68458ee2ef6fa5263dc471488abc45
This commit is contained in:
Andrew Schultz 2004-06-23 15:37:05 -04:00
parent 556b2a9098
commit 06d8f0af5d
4 changed files with 27 additions and 1 deletions

View file

@ -192,6 +192,22 @@ IdeController::getDisk(IdeDisk *diskPtr)
return -1;
}
bool
IdeController::isDiskSelected(IdeDisk *diskPtr)
{
for (int i = 0; i < 4; i++) {
if ((long)diskPtr == (long)disks[i]) {
// is disk is on primary or secondary channel
int channel = i/2;
// is disk the master or slave
int devID = i%2;
return (dev[channel] == devID);
}
}
panic("Unable to find disk by pointer!!\n");
}
////
// Command completion
////

View file

@ -144,6 +144,10 @@ class IdeController : public PciDev
/** Select the disk based on a pointer */
int getDisk(IdeDisk *diskPtr);
public:
/** See if a disk is selected based on its pointer */
bool isDiskSelected(IdeDisk *diskPtr);
public:
/**
* Constructs and initializes this controller.

View file

@ -167,6 +167,12 @@ IdeDisk::reset(int id)
// Utility functions
////
bool
IdeDisk::isDEVSelect()
{
return ctrl->isDiskSelected(this);
}
Addr
IdeDisk::pciToDma(Addr pciAddr)
{

View file

@ -320,7 +320,7 @@ class IdeDisk : public SimObject
// Utility functions
bool isBSYSet() { return (status & STATUS_BSY_BIT); }
bool isIENSet() { return nIENBit; }
bool isDEVSelect() { return ((cmdReg.drive & SELECT_DEV_BIT) == devID); }
bool isDEVSelect();
void setComplete()
{