Skip to content

Commit

Permalink
src: fix wbuild warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
HidenoriMatsubayashi committed Aug 14, 2024
1 parent b25b3e8 commit 427d403
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 55 deletions.
6 changes: 3 additions & 3 deletions src/arch/arm64/arm_generic_timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ namespace evisor {
namespace {

/* CNTHCTL_EL2 definitions */
constexpr uint64_t kCnthctlEl2Evntdir = BIT64(3);
constexpr uint64_t kCnthctlEl2Evnten = BIT64(2);
[[maybe_unused]] constexpr uint64_t kCnthctlEl2Evntdir = BIT64(3);
[[maybe_unused]] constexpr uint64_t kCnthctlEl2Evnten = BIT64(2);
constexpr uint64_t kCnthctlEl2El1Pcen = BIT64(1);
constexpr uint64_t kCnthctlEl2El1Pcten = BIT64(0);

/* CNTHP_CTL_EL2 definitions */
constexpr uint64_t kCnthpCtlEl2IStatus = BIT64(2);
[[maybe_unused]] constexpr uint64_t kCnthpCtlEl2IStatus = BIT64(2);
constexpr uint64_t kCnthpCtlEl2IMask = BIT64(1);
constexpr uint64_t kCnthpCtlEl2Enable = BIT64(0);

Expand Down
4 changes: 2 additions & 2 deletions src/arch/arm64/boot_el2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ constexpr uint64_t kSctlrEl2InitVal =
kSctlrEl2SctlrEl1 | kSctlrEl2SaEl1 | kSctlrEl2SaEl2;

/* HCR_EL2, Hypervisor Configuration Register */
constexpr uint64_t kHcrEl2E2H = BIT64(34);
[[maybe_unused]] constexpr uint64_t kHcrEl2E2H = BIT64(34);
constexpr uint64_t kHcrEl2RW = BIT64(31);
constexpr uint64_t kHcrEl2TGE = BIT64(27);
[[maybe_unused]] constexpr uint64_t kHcrEl2TGE = BIT64(27);
constexpr uint64_t kHcrEl2TACR = BIT64(21);
constexpr uint64_t kHcrEl2TID3 = BIT64(18);
constexpr uint64_t kHcrEl2TID2 = BIT64(17);
Expand Down
2 changes: 1 addition & 1 deletion src/arch/arm64/irq/gic_v2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ constexpr uint32_t kGichHcrEn = (1 << 0);
/* GICH_LR */
constexpr uint32_t kGichLrHw = (1 << 31);
constexpr uint32_t kGichLrVirtualIrqGrp0 = (0 << 30);
constexpr uint32_t kGichLrVirtualIrqGrp1 = (1 << 30);
[[maybe_unused]] constexpr uint32_t kGichLrVirtualIrqGrp1 = (1 << 30);
constexpr uint32_t kGichLrStatePending = (1 << 28);
constexpr uint32_t GICH_LR_PRIORITY(uint32_t x) {
return x << 23;
Expand Down
34 changes: 17 additions & 17 deletions src/arch/arm64/irq/trap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,24 @@ constexpr uint8_t kOp1SCR = 0b000;
constexpr uint8_t kOp1PCR = 0b001;
constexpr uint8_t kOp1DBG = 0b010;
constexpr uint8_t kOp1VMSA_SCR = 0b011;
constexpr uint8_t kOp1VMSA_HCR = 0b100;
constexpr uint8_t kOp1VMSA_VTCR = 0b101;
[[maybe_unused]] constexpr uint8_t kOp1VMSA_HCR = 0b100;
[[maybe_unused]] constexpr uint8_t kOp1VMSA_VTCR = 0b101;
constexpr uint8_t kCrnSCTLR_EL1 = 0;
constexpr uint8_t kCrnACTLR_EL1 = 1;
constexpr uint8_t kCrnCPACR_EL1 = 2;
constexpr uint8_t kCrnSCR_EL1 = 3;
constexpr uint8_t kCrnSDER32_EL3 = 4;
constexpr uint8_t kCrnAFSR0_EL1 = 5;
constexpr uint8_t kCrnAFSR1_EL1 = 6;
constexpr uint8_t kCrnESR_EL1 = 7;
constexpr uint8_t kCrnFAR_EL1 = 8;
constexpr uint8_t kCrnHPFAR_EL2 = 9;
constexpr uint8_t kCrnPAR_EL1 = 10;
constexpr uint8_t kCrnPMCR_EL0 = 11;
constexpr uint8_t kCrnPMCCFILTR_EL0 = 12;
[[maybe_unused]] constexpr uint8_t kCrnCPACR_EL1 = 2;
[[maybe_unused]] constexpr uint8_t kCrnSCR_EL1 = 3;
[[maybe_unused]] constexpr uint8_t kCrnSDER32_EL3 = 4;
[[maybe_unused]] constexpr uint8_t kCrnAFSR0_EL1 = 5;
[[maybe_unused]] constexpr uint8_t kCrnAFSR1_EL1 = 6;
[[maybe_unused]] constexpr uint8_t kCrnESR_EL1 = 7;
[[maybe_unused]] constexpr uint8_t kCrnFAR_EL1 = 8;
[[maybe_unused]] constexpr uint8_t kCrnHPFAR_EL2 = 9;
[[maybe_unused]] constexpr uint8_t kCrnPAR_EL1 = 10;
[[maybe_unused]] constexpr uint8_t kCrnPMCR_EL0 = 11;
[[maybe_unused]] constexpr uint8_t kCrnPMCCFILTR_EL0 = 12;

constexpr uint8_t kIssDirectionWrite = 0b0;
constexpr uint8_t kIssDirectionRead = 0b1;
[[maybe_unused]] constexpr uint8_t kIssDirectionRead = 0b1;

inline uint8_t EsrEl2Ec(uint64_t esr) {
return ((esr >> kEsrEl2EcShift) & 0x3f);
Expand Down Expand Up @@ -263,9 +263,9 @@ inline void HandleTrapSystem(uint32_t iss) {
inline uint8_t ESR_EL2_ISS_EXCEPTION_FROM_DATA_ABORT_DFSC(uint64_t esr) {
return esr & 0x3f;
}
constexpr uint8_t kEsrEl2DfscAddressSizeFault = 0b0000;
[[maybe_unused]] constexpr uint8_t kEsrEl2DfscAddressSizeFault = 0b0000;
constexpr uint8_t kEsrEl2DfscTranslationFault = 0b0001;
constexpr uint8_t kEsrEl2DfscAccessFlagFault = 0b0010;
[[maybe_unused]] constexpr uint8_t kEsrEl2DfscAccessFlagFault = 0b0010;
constexpr uint8_t kEsrEl2DfscPermissionFault = 0b0011;

/// SRT, bits [20:16]:
Expand All @@ -283,7 +283,7 @@ inline uint8_t ESR_EL2_ISS_EXCEPTION_FROM_DATA_ABORT_WNR(uint64_t esr) {
return (esr >> 6) & 0x1;
}
constexpr uint8_t kEsrEl2IssExceptionFromDataAboartCausedByRead = 0;
constexpr uint8_t kEsrEl2IssExceptionFromDataAboartCausedByWrite = 1;
[[maybe_unused]] constexpr uint8_t kEsrEl2IssExceptionFromDataAboartCausedByWrite = 1;

inline bool HandleTrapMemAbort(va_t addr, uint64_t esr) {
const auto dfsc = ESR_EL2_ISS_EXCEPTION_FROM_DATA_ABORT_DFSC(esr);
Expand Down
16 changes: 8 additions & 8 deletions src/drivers/mailbox/mailbox_bcm2711.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ constexpr uint32_t kStatus0MessageFull = 0x8000'0000;
/// Channel 9: Request from VC for response by ARM (none currently defined)

// Mailbox Channel 0: Power Management Interface
constexpr uint8_t kChannelPower = 0;
[[maybe_unused]] constexpr uint8_t kChannelPower = 0;
// Mailbox Channel 1: Frame Buffer
constexpr uint8_t kChannelFb = 1;
[[maybe_unused]] constexpr uint8_t kChannelFb = 1;
// Mailbox Channel 2: Virtual UART
constexpr uint8_t kChannelUart = 2;
[[maybe_unused]] constexpr uint8_t kChannelUart = 2;
// Mailbox Channel 3: VCHIQ Interface
constexpr uint8_t kChannelVChiq = 3;
[[maybe_unused]] constexpr uint8_t kChannelVChiq = 3;
// Mailbox Channel 4: LEDs Interface
constexpr uint8_t kChannelLeds = 4;
[[maybe_unused]] constexpr uint8_t kChannelLeds = 4;
// Mailbox Channel 5: Buttons Interface
constexpr uint8_t kChannelButtons = 5;
[[maybe_unused]] constexpr uint8_t kChannelButtons = 5;
// Mailbox Channel 6: Touchscreen Interface
constexpr uint8_t kChannelTouch = 6;
[[maybe_unused]] constexpr uint8_t kChannelTouch = 6;
// Mailbox Channel 7: Counter
constexpr uint8_t kChannelCount = 7;
[[maybe_unused]] constexpr uint8_t kChannelCount = 7;
// Mailbox Channel 8: Tags (ARM to VC)
constexpr uint8_t kChannelTags = 8;

Expand Down
14 changes: 7 additions & 7 deletions src/fs/fat/fat32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,22 @@ constexpr uint32_t kFat32MaxFileNameSize = 255;

constexpr uint16_t kBootSignature = 0xAA55;

constexpr uint8_t kAttrReadOnly = 0x01;
constexpr uint8_t kAttrHidden = 0x02;
constexpr uint8_t kAttrSystem = 0x04;
constexpr uint8_t kAttrVolumeId = 0x08;
[[maybe_unused]] constexpr uint8_t kAttrReadOnly = 0x01;
[[maybe_unused]] constexpr uint8_t kAttrHidden = 0x02;
[[maybe_unused]] constexpr uint8_t kAttrSystem = 0x04;
[[maybe_unused]] constexpr uint8_t kAttrVolumeId = 0x08;
constexpr uint8_t kAttrLongName = 0x0f;
constexpr uint8_t kAttrDirectory = 0x10;
constexpr uint8_t kAttrArchive = 0x20;
[[maybe_unused]] constexpr uint8_t kAttrArchive = 0x20;

constexpr uint8_t kDirNameEmptyEntry = 0x00;
constexpr uint8_t kDirNameKanjiEntry = 0x05;
constexpr uint8_t kDirNameRemovedEntry = 0xE5;

constexpr uint8_t kLfnLastLongEntry = 0x40;

constexpr uint32_t kUnusedCluster = 0;
constexpr uint32_t kReservedCluster = 1;
[[maybe_unused]] constexpr uint32_t kUnusedCluster = 0;
[[maybe_unused]] constexpr uint32_t kReservedCluster = 1;
constexpr uint32_t kBadCluster = 0x0FFFFFF7;
} // namespace

Expand Down
6 changes: 2 additions & 4 deletions src/mm/heap/kmm_malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ namespace {
bool kernelHeapMemMap[HEAP_PAGES] = {false};
} // namespace

void* kmm_malloc(size_t size) {
void* kmm_malloc([[maybe_unused]] size_t size) {
if (size < 1) {
return nullptr;
}

// FIXME
size = size;

// FIXME: need to consider 'size' var
for (uint32_t i = 0; i < HEAP_PAGES; i++) {
if (!kernelHeapMemMap[i]) {
kernelHeapMemMap[i] = true;
Expand Down
10 changes: 5 additions & 5 deletions src/mm/pgtable_stage2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace evisor {

namespace {

constexpr uint64_t kStage2PteTypeBlock = 1;
[[maybe_unused]] constexpr uint64_t kStage2PteTypeBlock = 1;
constexpr uint64_t kStage2PteTypePage = 3;
constexpr uint64_t kStage2PteTypePageTable = 3;

Expand All @@ -24,7 +24,7 @@ constexpr uint64_t kStage2PteAf = (1 << 10);
// Non-shaeable
constexpr uint64_t kStage2PteShNonShareable = (0 << 8);
// SH Inner Shareable
constexpr uint64_t kStage2PteShInnerShareable = (2 << 8);
[[maybe_unused]] constexpr uint64_t kStage2PteShInnerShareable = (2 << 8);
// SH Outer Shareable
constexpr uint64_t kStage2PteShOuterShareable = (3 << 8);

Expand All @@ -35,9 +35,9 @@ constexpr uint64_t kStage2PteShOuterShareable = (3 << 8);
// No access from EL1
constexpr uint64_t kStage2PteS2ApNone = (0 << 6);
// RO access from EL1
constexpr uint64_t kStage2PteS2ApRO = (1 << 6);
[[maybe_unused]] constexpr uint64_t kStage2PteS2ApRO = (1 << 6);
// WO access from EL1
constexpr uint64_t kStage2PteS2ApWO = (2 << 6);
[[maybe_unused]] constexpr uint64_t kStage2PteS2ApWO = (2 << 6);
// R/W Full access from EL1
constexpr uint64_t kStage2PteS2ApRW = (3 << 6);

Expand Down Expand Up @@ -159,7 +159,7 @@ void PgTableStage2::FlushTlbVMID() {
"tlbi vmalls12e1is\n"
"dsb ish\n"
"isb");
WRITE_CPU_REG(vttbr_el2, 0);
WRITE_CPU_REG(vttbr_el2, static_cast<uint64_t>(0));
}

} // namespace evisor
6 changes: 2 additions & 4 deletions src/mm/uncached/kmm_uncached_malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ namespace {
bool kernelUncachedMemMap[UNCACHED_PAGES] = {false};
} // namespace

void* kmm_uncached_malloc(size_t size) {
void* kmm_uncached_malloc([[maybe_unused]] size_t size) {
if (size < 1) {
return nullptr;
}

// FIXME
size = size;

// FIXME: need to consider 'size' var
for (uint32_t i = 0; i < UNCACHED_PAGES; i++) {
if (!kernelUncachedMemMap[i]) {
kernelUncachedMemMap[i] = true;
Expand Down
2 changes: 1 addition & 1 deletion src/mm/user_heap/umm_malloc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace {
// FIXME: use kUserSize
constexpr uint32_t kPagingPages =
static_cast<uint64_t>(1024) * 1024 * 1024 * 2 / PAGE_SIZE;
constexpr uint32_t kMemMapSize = kPagingPages / 8;
[[maybe_unused]] constexpr uint32_t kMemMapSize = kPagingPages / 8;

uint8_t userMemoryRegionMap_[kPagingPages] = {0};
uint32_t nextFreeSpaceIndex = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/platforms/bcm2711/system_timer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
namespace evisor {

namespace {
constexpr uint32_t kCsM0 = (1 << 0);
[[maybe_unused]] constexpr uint32_t kCsM0 = (1 << 0);
constexpr uint32_t kCsM1 = (1 << 1);
constexpr uint32_t kCsM2 = (1 << 2);
constexpr uint32_t kCsM3 = (1 << 3);
[[maybe_unused]] constexpr uint32_t kCsM2 = (1 << 2);
[[maybe_unused]] constexpr uint32_t kCsM3 = (1 << 3);
} // namespace

SystemTimer::SystemTimer() {
Expand Down

0 comments on commit 427d403

Please sign in to comment.