Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157291708
D56878.id177760.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D56878.id177760.diff
View Options
diff --git a/sys/dev/acpica/acpi_spmc.c b/sys/dev/acpica/acpi_spmc.c
--- a/sys/dev/acpica/acpi_spmc.c
+++ b/sys/dev/acpica/acpi_spmc.c
@@ -223,7 +223,6 @@
struct acpi_spmc_softc {
device_t dev;
ACPI_HANDLE handle;
- int dsms;
uint64_t supported_functions[nitems(dsms)];
struct eventhandler_entry *eh_suspend;
@@ -257,7 +256,7 @@
static bool
has_dsm(const struct acpi_spmc_softc *const sc, const int dsm_index)
{
- return ((sc->dsms & IDX_TO_BIT(dsm_index)) != 0);
+ return (supports_function(sc, dsm_index, DSM_ENUM_FUNCTIONS));
}
typedef const char *pbf_get_name_t(const int, const void *const);
@@ -371,6 +370,7 @@
{
struct acpi_spmc_softc *const sc = device_get_softc(dev);
const ACPI_HANDLE handle = acpi_get_handle(dev);
+ int supported_dsms;
char buf[32];
int error;
@@ -382,6 +382,7 @@
sc->dev = dev;
sc->handle = handle;
+ supported_dsms = 0;
for (int i = 0; i < nitems(dsms); ++i) {
KASSERT(dsms[i] != NULL, ("%s: Sparse dsms[]!", __func__));
KASSERT(dsms[i]->index == i,
@@ -389,14 +390,17 @@
dsms[i]->name));
acpi_spmc_probe_dsm(sc, dsms[i]);
+ if (has_dsm(sc, i))
+ supported_dsms |= IDX_TO_BIT(i);
}
- if (sc->dsms == 0) {
+ if (supported_dsms == 0) {
device_printf(dev, "No DSM supported!");
return (ENXIO);
}
- print_bit_field(buf, sizeof(buf), sc->dsms, "DSM", pbf_dsm_name, NULL);
+ print_bit_field(buf, sizeof(buf), supported_dsms, "DSM",
+ pbf_dsm_name, NULL);
device_printf(dev, "DSMs supported: %s\n", buf);
/* Print supported functions of usable DSMs. */
@@ -436,7 +440,12 @@
acpi_spmc_dsm_print_functions(const struct acpi_spmc_softc *const sc,
const struct dsm_desc *const dsm)
{
- const uint64_t supported_functions =
+ /*
+ * Remove the enumeration function bit, which we do not care about when
+ * printing which functions are supported and which we do not want to
+ * report as unknown.
+ */
+ const uint64_t supported_functions = ~IDX_TO_BIT(DSM_ENUM_FUNCTIONS) &
sc->supported_functions[dsm->index];
const uint64_t missing = dsm->expected_functions & ~supported_functions;
const uint64_t unknown = supported_functions &
@@ -475,10 +484,9 @@
/*
* DSM is supported if bit 0 is set.
*/
- if ((supported_functions & 1) == 0)
+ if ((supported_functions & IDX_TO_BIT(DSM_ENUM_FUNCTIONS)) == 0)
return;
- sc->supported_functions[dsm->index] = supported_functions & ~1;
- sc->dsms |= IDX_TO_BIT(dsm->index);
+ sc->supported_functions[dsm->index] = supported_functions;
}
static void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 21, 2:00 AM (8 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33015659
Default Alt Text
D56878.id177760.diff (2 KB)
Attached To
Mode
D56878: acpi_spmc(4): Factor out testing for present DSMs/functions
Attached
Detach File
Event Timeline
Log In to Comment