mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
AHCI: Use fls() from BitUtils.
This commit is contained in:
parent
2cac2468d1
commit
09b0f82c10
@ -11,6 +11,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <new>
|
||||
#include <util/BitUtils.h>
|
||||
|
||||
#define TRACE(a...) dprintf("ahci: " a)
|
||||
#define FLOW(a...) dprintf("ahci: " a)
|
||||
@ -335,7 +336,8 @@ AHCIController::ResetController()
|
||||
if (fPCIVendorID == PCI_VENDOR_INTEL) {
|
||||
// Intel PCS—Port Control and Status
|
||||
// SATA port enable bits must be set
|
||||
int portCount = std::max(fls(fRegs->pi), 1 + (int)((fRegs->cap >> CAP_NP_SHIFT) & CAP_NP_MASK));
|
||||
int portCount = std::max((int)fls(fRegs->pi),
|
||||
1 + (int)((fRegs->cap >> CAP_NP_SHIFT) & CAP_NP_MASK));
|
||||
if (portCount > 8) {
|
||||
// TODO: fix this when specification available
|
||||
TRACE("don't know how to enable SATA ports 9 to %d\n", portCount);
|
||||
|
@ -126,17 +126,3 @@ swap_words(void *data, size_t size)
|
||||
word++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fls(unsigned mask)
|
||||
{
|
||||
if (mask == 0)
|
||||
return 0;
|
||||
int pos = 1;
|
||||
while (mask != 1) {
|
||||
mask >>= 1;
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
@ -20,8 +20,6 @@ status_t sg_memcpy(const physical_entry *sgTable, int sgCount, const void *data,
|
||||
|
||||
void swap_words(void *data, size_t size);
|
||||
|
||||
int fls(unsigned mask);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user