Page MenuHomeFreeBSD

D45358.diff
No OneTemporary

D45358.diff

diff --git a/sys/compat/linuxkpi/common/include/linux/pm.h b/sys/compat/linuxkpi/common/include/linux/pm.h
--- a/sys/compat/linuxkpi/common/include/linux/pm.h
+++ b/sys/compat/linuxkpi/common/include/linux/pm.h
@@ -1,7 +1,7 @@
/*-
* SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2020 The FreeBSD Foundation
+ * Copyright (c) 2020-2024 The FreeBSD Foundation
*
* This software was developed by Björn Zeeb under sponsorship from
* the FreeBSD Foundation.
@@ -58,25 +58,26 @@
IS_ENABLED(CONFIG_PM_SLEEP) ? (_p) : NULL
#ifdef CONFIG_PM_SLEEP
+#define __SET_PM_OPS(_suspendfunc, _resumefunc) \
+ .suspend = _suspendfunc, \
+ .resume = _resumefunc, \
+ .freeze = _suspendfunc, \
+ .thaw = _resumefunc, \
+ .poweroff = _suspendfunc, \
+ .restore = _resumefunc, \
+
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
const struct dev_pm_ops _name = { \
- .suspend = _suspendfunc, \
- .resume = _resumefunc, \
- .freeze = _suspendfunc, \
- .thaw = _resumefunc, \
- .poweroff = _suspendfunc, \
- .restore = _resumefunc, \
+ __SET_PM_OPS(_suspendfunc, _resumefunc) \
}
#define DEFINE_SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
const struct dev_pm_ops _name = { \
- .suspend = _suspendfunc, \
- .resume = _resumefunc, \
- .freeze = _suspendfunc, \
- .thaw = _resumefunc, \
- .poweroff = _suspendfunc, \
- .restore = _resumefunc, \
+ __SET_PM_OPS(_suspendfunc, _resumefunc) \
}
+
+#define SET_SYSTEM_SLEEP_PM_OPS(_suspendfunc, _resumefunc) \
+ __SET_PM_OPS(_suspendfunc, _resumefunc)
#else
#define SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc) \
const struct dev_pm_ops _name = { \
@@ -86,6 +87,9 @@
}
#endif
+bool linuxkpi_device_can_wakeup(struct device *);
+#define device_can_wakeup(_dev) linuxkpi_device_can_wakeup(_dev)
+
static inline void
pm_wakeup_event(struct device *dev __unused, unsigned int x __unused)
{
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -2597,6 +2597,24 @@
return (io_mapping_init_wc(mapping, base, size));
}
+/* We likely want a linuxkpi_device.c at some point. */
+bool
+device_can_wakeup(struct device *dev)
+{
+
+ if (dev == NULL)
+ return (false);
+ /*
+ * XXX-BZ iwlwifi queries it as part of enabling WoWLAN.
+ * Normally this would be based on a bool in dev->power.XXX.
+ * Check such as PCI PCIM_PCAP_*PME. We have no way to enable this yet.
+ * We may get away by directly calling into bsddev for as long as
+ * we can assume PCI only avoiding changing struct device breaking KBI.
+ */
+ pr_debug("%s:%d: not enabled; see comment.\n", __func__, __LINE__);
+ return (false);
+}
+
#if defined(__i386__) || defined(__amd64__)
bool linux_cpu_has_clflush;
struct cpuinfo_x86 boot_cpu_data;

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 9, 4:24 AM (6 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15729457
Default Alt Text
D45358.diff (2 KB)

Event Timeline