diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf --- a/release/tools/ec2.conf +++ b/release/tools/ec2.conf @@ -75,8 +75,9 @@ # (in fact the PL061 has no pullup/pulldown resistors). Graviton 1 # through Graviton 3 have non-functional PCI _EJ0 and need a value # written to the PCI power status register in order to eject a - # device. - echo 'debug.acpi.quirks="24"' >> ${DESTDIR}/boot/loader.conf + # device. EC2 instances with PCI (not PCIe) buses need a short + # delay before rescanning upon device detach. + echo 'debug.acpi.quirks="56"' >> ${DESTDIR}/boot/loader.conf # Load the kernel module for the Amazon "Elastic Network Adapter" echo 'if_ena_load="YES"' >> ${DESTDIR}/boot/loader.conf diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -432,6 +432,8 @@ acpi_name(h), AcpiFormatException(status)); return; } + if (acpi_quirks & ACPI_Q_DELAY_BEFORE_EJECT_RESCAN) + DELAY(10 * 1000); BUS_RESCAN(dev); bus_topo_unlock(); break; diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -232,6 +232,8 @@ * as "PullUp" and they should be treated as "NoPull" instead. * ACPI_Q_CLEAR_PME_ON_DETACH: Specifies that PCIM_PSTAT_(PME & ~PMEENABLE) * should be written to the power status register as part of ACPI Eject. + * ACPI_Q_DELAY_BEFORE_EJECT_RESCAN: Specifies that we need a short (10ms) + * delay after _EJ0 returns before rescanning the PCI bus. */ extern int acpi_quirks; #define ACPI_Q_OK 0 @@ -240,6 +242,7 @@ #define ACPI_Q_MADT_IRQ0 (1 << 2) #define ACPI_Q_AEI_NOPULL (1 << 3) #define ACPI_Q_CLEAR_PME_ON_DETACH (1 << 4) +#define ACPI_Q_DELAY_BEFORE_EJECT_RESCAN (1 << 5) #if defined(__amd64__) || defined(__i386__) /*