NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-amd64/57119: Add trivial amdsmn(4) / amdccpi(4) pmf code to allow for sleeping



>Number:         57119
>Category:       port-amd64
>Synopsis:       Add trivial amdsmn(4) / amdccpi(4) pmf code to allow for sleeping
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 18 15:30:00 +0000 2022
>Originator:     Reinoud Zandijk
>Release:        NetBSD 9.99.107
>Organization:
	
>Environment:
	
	
System: NetBSD gorilla.13thmonkey.org 9.99.107 NetBSD 9.99.107 (GENERIC) #0: Wed Dec 14 13:12:41 CET 2022 reinoud%gorilla.13thmonkey.org@localhost:/tmp/obj-bisect/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
The machine won't attempt to sleep since the amdccp(4) and amdsmn(4) drivers
have no power management support code.
	
>How-To-Repeat:
	
Try to sleep the amd64 machine and it will complain about the two devices not
having power management.
>Fix:
Apply the following patch:
Index: sys/arch/x86/pci/amdsmn.c
===================================================================
RCS file: /cvsroot/src/sys/arch/x86/pci/amdsmn.c,v
retrieving revision 1.14
diff -u -p -r1.14 amdsmn.c
--- sys/arch/x86/pci/amdsmn.c	1 Oct 2022 15:50:05 -0000	1.14
+++ sys/arch/x86/pci/amdsmn.c	18 Dec 2022 15:19:13 -0000
@@ -159,6 +159,10 @@ amdsmn_attach(device_t parent, device_t 
 
 	// aprint_normal(": AMD Family 17h System Management Network\n");
 	aprint_normal(": AMD System Management Network\n");
+
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	amdsmn_rescan(self, NULL, NULL);
 }
 
@@ -178,6 +182,8 @@ amdsmn_detach(device_t self, int flags)
 {
 	struct amdsmn_softc *sc = device_private(self);
 
+	pmf_device_deregister(self);
+
 	mutex_destroy(&sc->smn_lock);
 	aprint_normal_dev(self,"detach!\n");
 
Index: sys/dev/acpi/amdccp_acpi.c
===================================================================
RCS file: /cvsroot/src/sys/dev/acpi/amdccp_acpi.c,v
retrieving revision 1.5
diff -u -p -r1.5 amdccp_acpi.c
--- sys/dev/acpi/amdccp_acpi.c	29 Jan 2021 15:49:55 -0000	1.5
+++ sys/dev/acpi/amdccp_acpi.c	18 Dec 2022 15:19:14 -0000
@@ -104,6 +104,9 @@ amdccp_acpi_attach(device_t parent, devi
 
 	amdccp_common_attach(sc);
 
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 done:
 	acpi_resource_cleanup(&res);
 }
Index: sys/dev/fdt/amdccp_fdt.c
===================================================================
RCS file: /cvsroot/src/sys/dev/fdt/amdccp_fdt.c,v
retrieving revision 1.6
diff -u -p -r1.6 amdccp_fdt.c
--- sys/dev/fdt/amdccp_fdt.c	27 Jan 2021 03:10:21 -0000	1.6
+++ sys/dev/fdt/amdccp_fdt.c	18 Dec 2022 15:19:14 -0000
@@ -89,4 +89,7 @@ amdccp_fdt_attach(device_t parent, devic
 	aprint_normal(": AMD CCP\n");
 
 	amdccp_common_attach(sc);
+
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 }
Index: sys/dev/pci/amdccp_pci.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/amdccp_pci.c,v
retrieving revision 1.3
diff -u -p -r1.3 amdccp_pci.c
--- sys/dev/pci/amdccp_pci.c	26 Oct 2022 13:35:25 -0000	1.3
+++ sys/dev/pci/amdccp_pci.c	18 Dec 2022 15:19:14 -0000
@@ -122,4 +122,7 @@ amdccp_pci_attach(device_t parent, devic
 	}
 
 	amdccp_common_attach(sc);
+
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 }

	

>Unformatted:
 	
 	



Home | Main Index | Thread Index | Old Index