Kernel: Replace __atomic builtins with BAN::atomic wrappers
This commit is contained in:
@@ -351,17 +351,17 @@ namespace Kernel
|
|||||||
// give processor upto 100 * 100 us + 200 us to boot
|
// give processor upto 100 * 100 us + 200 us to boot
|
||||||
PageTable::with_fast_page(ap_init_paddr, [&] {
|
PageTable::with_fast_page(ap_init_paddr, [&] {
|
||||||
for (int i = 0; i < 100; i++, udelay(100))
|
for (int i = 0; i < 100; i++, udelay(100))
|
||||||
if (__atomic_load_n(&PageTable::fast_page_as<ap_init_info_t>(8).ready, __ATOMIC_SEQ_CST))
|
if (BAN::atomic_load(PageTable::fast_page_as<ap_init_info_t>(8).ready))
|
||||||
break;
|
break;
|
||||||
});
|
});
|
||||||
|
|
||||||
initialized_aps++;
|
initialized_aps++;
|
||||||
}
|
}
|
||||||
|
|
||||||
__atomic_store_n(&g_ap_startup_done[0], 1, __ATOMIC_SEQ_CST);
|
BAN::atomic_store(g_ap_startup_done[0], 1);
|
||||||
|
|
||||||
const size_t timeout_ms = SystemTimer::get().ms_since_boot() + 500;
|
const size_t timeout_ms = SystemTimer::get().ms_since_boot() + 500;
|
||||||
while (__atomic_load_n(&g_ap_running_count[0], __ATOMIC_SEQ_CST) < initialized_aps)
|
while (BAN::atomic_load(g_ap_running_count[0]) < initialized_aps)
|
||||||
{
|
{
|
||||||
if (SystemTimer::get().ms_since_boot() >= timeout_ms)
|
if (SystemTimer::get().ms_since_boot() >= timeout_ms)
|
||||||
Kernel::panic("Could not start all APs ({}/{} started)", g_ap_running_count[0], initialized_aps);
|
Kernel::panic("Could not start all APs ({}/{} started)", g_ap_running_count[0], initialized_aps);
|
||||||
|
|||||||
@@ -514,7 +514,7 @@ namespace Kernel
|
|||||||
doorbell_reg(0) = 0;
|
doorbell_reg(0) = 0;
|
||||||
|
|
||||||
uint64_t timeout_ms = SystemTimer::get().ms_since_boot() + 1000;
|
uint64_t timeout_ms = SystemTimer::get().ms_since_boot() + 1000;
|
||||||
while ((__atomic_load_n(&completion_trb.raw.dword2, __ATOMIC_SEQ_CST) >> 24) == 0)
|
while ((BAN::atomic_load(completion_trb.raw.dword2, BAN::memory_order_acquire) >> 24) == 0)
|
||||||
if (SystemTimer::get().ms_since_boot() > timeout_ms)
|
if (SystemTimer::get().ms_since_boot() > timeout_ms)
|
||||||
return BAN::Error::from_errno(ETIMEDOUT);
|
return BAN::Error::from_errno(ETIMEDOUT);
|
||||||
|
|
||||||
@@ -592,7 +592,7 @@ namespace Kernel
|
|||||||
completion_trb.raw.dword0 = trb.raw.dword0;
|
completion_trb.raw.dword0 = trb.raw.dword0;
|
||||||
completion_trb.raw.dword1 = trb.raw.dword1;
|
completion_trb.raw.dword1 = trb.raw.dword1;
|
||||||
completion_trb.raw.dword3 = trb.raw.dword3;
|
completion_trb.raw.dword3 = trb.raw.dword3;
|
||||||
__atomic_store_n(&completion_trb.raw.dword2, trb.raw.dword2, __ATOMIC_SEQ_CST);
|
BAN::atomic_store(completion_trb.raw.dword2, trb.raw.dword2, BAN::memory_order_release);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -396,7 +396,7 @@ namespace Kernel
|
|||||||
completion_trb.raw.dword0 = trb.raw.dword0;
|
completion_trb.raw.dword0 = trb.raw.dword0;
|
||||||
completion_trb.raw.dword1 = trb.raw.dword1;
|
completion_trb.raw.dword1 = trb.raw.dword1;
|
||||||
completion_trb.raw.dword3 = trb.raw.dword3;
|
completion_trb.raw.dword3 = trb.raw.dword3;
|
||||||
__atomic_store_n(&completion_trb.raw.dword2, trb.raw.dword2, __ATOMIC_SEQ_CST);
|
BAN::atomic_store(completion_trb.raw.dword2, trb.raw.dword2, BAN::memory_order_release);
|
||||||
}
|
}
|
||||||
|
|
||||||
BAN::ErrorOr<size_t> XHCIDevice::send_request(const USBDeviceRequest& request, paddr_t buffer_paddr)
|
BAN::ErrorOr<size_t> XHCIDevice::send_request(const USBDeviceRequest& request, paddr_t buffer_paddr)
|
||||||
@@ -485,7 +485,7 @@ namespace Kernel
|
|||||||
m_controller.doorbell_reg(m_info.slot_id) = 1;
|
m_controller.doorbell_reg(m_info.slot_id) = 1;
|
||||||
|
|
||||||
const uint64_t timeout_ms = SystemTimer::get().ms_since_boot() + 1000;
|
const uint64_t timeout_ms = SystemTimer::get().ms_since_boot() + 1000;
|
||||||
while ((__atomic_load_n(&completion_trb.raw.dword2, __ATOMIC_SEQ_CST) >> 24) == 0)
|
while ((BAN::atomic_load(completion_trb.raw.dword2, BAN::memory_order_acquire) >> 24) == 0)
|
||||||
if (SystemTimer::get().ms_since_boot() > timeout_ms)
|
if (SystemTimer::get().ms_since_boot() > timeout_ms)
|
||||||
return BAN::Error::from_errno(ETIMEDOUT);
|
return BAN::Error::from_errno(ETIMEDOUT);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user