The original implementation only supports getting the address from legacy
BIOS (by searching for the SMBIOS_SIG pattern in a fixed address space).
Try to get the SMBIOS table from EFI through efirt (EFI Runtime Services)
firstly. Continue to search in the legacy BIOS if a NULL address is
returned from EFI.
By this way the ipmi function supports both legacy BIOS and UEFI systems.
Reviewed by: dab, vangyzen
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D30007
(cherry picked from commit
ee8b757a949a9575c7355ea01f0475e0c526b9e5)
#include <sys/module.h>
#include <sys/rman.h>
#include <sys/selinfo.h>
+#include <sys/efi.h>
#include <machine/pci_cfgreg.h>
#include <dev/pci/pcireg.h>
};
DRIVER_MODULE(ipmi_isa, isa, ipmi_isa_driver, ipmi_devclass, 0, 0);
+#ifdef ARCH_MAY_USE_EFI
+MODULE_DEPEND(ipmi_isa, efirt, 1, 1, 1);
+#endif
#include <sys/module.h>
#include <sys/rman.h>
#include <sys/selinfo.h>
+#include <sys/efi.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
};
DRIVER_MODULE(ipmi2_pci, pci, ipmi2_pci_driver, ipmi_devclass, 0, 0);
+#ifdef ARCH_MAY_USE_EFI
+MODULE_DEPEND(ipmi2_pci, efirt, 1, 1, 1);
+#endif
#include <sys/eventhandler.h>
#include <sys/kernel.h>
#include <sys/selinfo.h>
+#include <sys/efi.h>
#include <vm/vm.h>
#include <vm/pmap.h>
static void
ipmi_smbios_probe(struct ipmi_get_info *info)
{
+#ifdef ARCH_MAY_USE_EFI
+ struct uuid efi_smbios;
+ void *addr_efi;
+#endif
struct smbios_eps *header;
void *table;
u_int32_t addr;
+ addr = 0;
bzero(info, sizeof(struct ipmi_get_info));
- /* Find the SMBIOS table header. */
- addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN,
- SMBIOS_STEP, SMBIOS_OFF);
+#ifdef ARCH_MAY_USE_EFI
+ efi_smbios = (struct uuid)EFI_TABLE_SMBIOS;
+ if (!efi_get_table(&efi_smbios, &addr_efi))
+ addr = (vm_paddr_t)addr_efi;
+#endif
+
+ if (addr == 0)
+ /* Find the SMBIOS table header. */
+ addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN,
+ SMBIOS_STEP, SMBIOS_OFF);
if (addr == 0)
return;
#include <sys/module.h>
#include <sys/rman.h>
#include <sys/selinfo.h>
+#include <sys/efi.h>
#include <dev/smbus/smbconf.h>
#include <dev/smbus/smbus.h>
DRIVER_MODULE(ipmi_smbus, smbus, ipmi_smbus_driver, ipmi_devclass, 0, 0);
MODULE_DEPEND(ipmi_smbus, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
+#ifdef ARCH_MAY_USE_EFI
+MODULE_DEPEND(ipmi_smbus, efirt, 1, 1, 1);
+#endif