/* Collect the number of bits set within a port bitmap. */
UINT8 AhciGetNumberOfPortsFromMap(IN UINT32 PortBitMap)
/* Collect the number of bits set within a port bitmap. */
UINT8 AhciGetNumberOfPortsFromMap(IN UINT32 PortBitMap)
{
  UINT8  NumberOfPorts;
  NumberOfPorts = 0;
  while (PortBitMap != 0) {
    if ((PortBitMap & ((UINT32)BIT0)) != 0) {
      NumberOfPorts++;
    }
    PortBitMap = PortBitMap >> 1;
  }
  return NumberOfPorts;
}