print proper values for zero-based numbers

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22141 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2007-09-01 16:52:46 +00:00
parent e5c9c9e371
commit 105f622310
3 changed files with 12 additions and 5 deletions

View File

@ -17,6 +17,8 @@ AHCIController::AHCIController(device_node_handle node, pci_device_info *device)
: fNode(node) : fNode(node)
, fPCIDevice(device) , fPCIDevice(device)
, fDevicePresentMask(0) , fDevicePresentMask(0)
, fCommandSlotCount(0)
, fPortCount(0)
, fInstanceCheck(-1) , fInstanceCheck(-1)
{ {
} }
@ -73,9 +75,12 @@ AHCIController::Init()
return B_ERROR; return B_ERROR;
} }
TRACE("cap: Interface Speed Support: %lu\n", (fRegs->cap >> CAP_ISS_SHIFT) & CAP_ISS_MASK); fCommandSlotCount = 1 + ((fRegs->cap >> CAP_NCS_SHIFT) & CAP_NCS_MASK);
TRACE("cap: Number of Command Slots: %lu\n", (fRegs->cap >> CAP_NCS_SHIFT) & CAP_NCS_MASK); fPortCount = 1 + ((fRegs->cap >> CAP_NP_SHIFT) & CAP_NP_MASK);
TRACE("cap: Number of Ports: %lu\n", (fRegs->cap >> CAP_NP_SHIFT) & CAP_NP_MASK);
TRACE("cap: Interface Speed Support: generation %lu\n", (fRegs->cap >> CAP_ISS_SHIFT) & CAP_ISS_MASK);
TRACE("cap: Number of Command Slots: %d (raw %#lx)\n", fCommandSlotCount, (fRegs->cap >> CAP_NCS_SHIFT) & CAP_NCS_MASK);
TRACE("cap: Number of Ports: %d (raw %#lx)\n", fPortCount, (fRegs->cap >> CAP_NCS_SHIFT) & CAP_NCS_MASK);
TRACE("cap: Supports Port Multiplier: %s\n", (fRegs->cap & CAP_SPM) ? "yes" : "no"); TRACE("cap: Supports Port Multiplier: %s\n", (fRegs->cap & CAP_SPM) ? "yes" : "no");
TRACE("cap: Supports External SATA: %s\n", (fRegs->cap & CAP_SXS) ? "yes" : "no"); TRACE("cap: Supports External SATA: %s\n", (fRegs->cap & CAP_SXS) ? "yes" : "no");
TRACE("cap: Enclosure Management Supported: %s\n", (fRegs->cap & CAP_EMS) ? "yes" : "no"); TRACE("cap: Enclosure Management Supported: %s\n", (fRegs->cap & CAP_EMS) ? "yes" : "no");

View File

@ -35,6 +35,8 @@ private:
ahci_hba * fRegs; ahci_hba * fRegs;
area_id fRegsArea; area_id fRegsArea;
int fCommandSlotCount;
int fPortCount;
// --- Instance check workaround begin // --- Instance check workaround begin

View File

@ -29,12 +29,12 @@ enum {
CAP_PMD = (1 << 15), // PIO Multiple DRQ Block CAP_PMD = (1 << 15), // PIO Multiple DRQ Block
CAP_SSC = (1 << 14), // Slumber State Capable CAP_SSC = (1 << 14), // Slumber State Capable
CAP_PSC = (1 << 13), // Partial State Capable CAP_PSC = (1 << 13), // Partial State Capable
CAP_NCS_MASK = 0x1f, // Number of Command Slots CAP_NCS_MASK = 0x1f, // Number of Command Slots (zero-based number)
CAP_NCS_SHIFT = 8, CAP_NCS_SHIFT = 8,
CAP_CCCS = (1 << 7), // Command Completion Coalescing Supported CAP_CCCS = (1 << 7), // Command Completion Coalescing Supported
CAP_EMS = (1 << 6), // Enclosure Management Supported CAP_EMS = (1 << 6), // Enclosure Management Supported
CAP_SXS = (1 << 5), // Supports External SATA CAP_SXS = (1 << 5), // Supports External SATA
CAP_NP_MASK = 0x1f, // Number of Ports CAP_NP_MASK = 0x1f, // Number of Ports (zero-based number)
CAP_NP_SHIFT = 0, CAP_NP_SHIFT = 0,
}; };