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
////
/** 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.
// Utility functions
////
+bool
+IdeDisk::isDEVSelect()
+{
+ return ctrl->isDiskSelected(this);
+}
+
Addr
IdeDisk::pciToDma(Addr pciAddr)
{
// 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()
{