20 #include "IsaAtaController.h" 21 #include "PciAtaController.h" 22 #include "modules/Module.h" 23 #include "pedigree/kernel/Log.h" 24 #include "pedigree/kernel/machine/Controller.h" 25 #include "pedigree/kernel/machine/Device.h" 26 #include "pedigree/kernel/processor/types.h" 27 #include "pedigree/kernel/utilities/String.h" 28 #include "pedigree/kernel/utilities/Vector.h" 29 #include "pedigree/kernel/utilities/new" 31 static int nController = 0;
33 static bool bFound =
false;
37 static bool bPiixControllerFound =
false;
38 static int piixLevel = -1;
39 static bool bFallBackISA =
false;
41 static bool allowProbing =
false;
55 static uint8_t interrupt = 14;
68 ERROR(
"PCI IDE: Controller found with no IRQ and IRQs 14 and 15 " 69 "are already allocated");
70 delete pDevController;
90 bool foundCommand =
false;
91 bool foundControl =
false;
92 for (
unsigned int j = 0; j < dev->
addresses().count(); j++)
95 if (dev->
addresses()[j]->m_Name ==
"command")
97 if (dev->
addresses()[j]->m_Name ==
"control")
101 if (foundCommand && foundControl)
115 if ((!allowProbing) &&
120 "Found a SATA controller of some sort, hoping for ISA fallback.");
131 bool shouldProbe =
false;
135 if (allowProbing && piixLevel == 0)
139 else if (piixLevel < 0)
146 if (allowProbing && piixLevel == 3)
150 else if (piixLevel < 3)
157 if (allowProbing && piixLevel == 4)
161 else if (piixLevel < 4)
170 bPiixControllerFound =
true;
173 if (allowProbing && shouldProbe)
175 return probePiixController(pDev);
181 if (!bPiixControllerFound && bFallBackISA)
188 bool foundCommand =
false;
189 bool foundControl =
false;
190 for (
unsigned int j = 0; j < pDev->
addresses().count(); j++)
193 if (pDev->
addresses()[j]->m_Name ==
"command")
195 if (pDev->
addresses()[j]->m_Name ==
"control")
198 if (allowProbing && foundCommand && foundControl)
199 return probeIsaDevice(static_cast<Controller *>(pDev));
217 if (bPiixControllerFound)
241 MODULE_INFO(
"ata", &entry, &exit,
"scsi",
"ata-specific", 0);
242 #elif defined(X86_COMMON) 243 MODULE_INFO(
"ata", &entry, &exit,
"scsi",
"pci", 0);
uint8_t getPciSubclassCode()
virtual void setInterruptNumber(uintptr_t n)
virtual Vector< Address * > & addresses()
virtual uintptr_t getInterruptNumber()
uint16_t getPciDeviceId()
static void foreach(Callback callback, Device *root=0)
uint8_t getPciClassCode()
uint16_t getPciVendorId()