[libc-commits] [libc] [libc][uefi] Encode the error bit in EFI_STATUS error codes (PR #235071)
Prabhu Rajasekaran via libc-commits
libc-commits at lists.llvm.org
Sat Oct 24 15:31:52 PDT 2026
================
@@ -1,104 +1,87 @@
-//===----------------------------------------------------------------------===//
+//===-- Definition of UEFI error utilities --------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
-///
-/// \file
-/// UEFI implementation of error utils.
-///
-//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_UEFI_ERROR_H
#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_UEFI_ERROR_H
#include "hdr/errno_macros.h"
#include "include/llvm-libc-types/EFI_STATUS.h"
#include "src/__support/CPP/array.h"
-#include "src/__support/CPP/limits.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
-static constexpr int EFI_ERROR_MAX_BIT = cpp::numeric_limits<EFI_STATUS>::max();
-
-static constexpr int EFI_ENCODE_ERROR(int value) {
- return EFI_ERROR_MAX_BIT | (EFI_ERROR_MAX_BIT >> 2) | (value);
-}
-
-static constexpr int EFI_ENCODE_WARNING(int value) {
- return (EFI_ERROR_MAX_BIT >> 2) | (value);
-}
-
struct UefiStatusErrnoEntry {
EFI_STATUS status;
int errno_value;
};
-static constexpr cpp::array<UefiStatusErrnoEntry, 43> UEFI_STATUS_ERRNO_MAP = {{
+// The EFI_* macros already carry the error bit as defined by the UEFI
+// specification; warnings are plain values.
+static constexpr cpp::array<UefiStatusErrnoEntry, 42> UEFI_STATUS_ERRNO_MAP = {{
----------------
Prabhuk wrote:
Ack. Fixed this instance but I'll attempt the suggestion in a follow up pr.
https://github.com/llvm/llvm-project/pull/235071
More information about the libc-commits
mailing list