Define PMU_ADB_CMD and PMU_INT_ACK
authorgkoehler <gkoehler@openbsd.org>
Sun, 18 Sep 2022 21:36:41 +0000 (21:36 +0000)
committergkoehler <gkoehler@openbsd.org>
Sun, 18 Sep 2022 21:36:41 +0000 (21:36 +0000)
Taking these definitions from NetBSD's pm_direct.h; most PMU_*
commands have the same names in the BSDs and Linux.

ok miod@ kettenis@

sys/arch/macppc/dev/pm_direct.c
sys/arch/macppc/dev/pm_direct.h

index 3fe5b6c..a5bf4a1 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pm_direct.c,v 1.30 2019/09/03 17:51:52 deraadt Exp $  */
+/*     $OpenBSD: pm_direct.c,v 1.31 2022/09/18 21:36:41 gkoehler Exp $ */
 /*     $NetBSD: pm_direct.c,v 1.9 2000/06/08 22:10:46 tsubai Exp $     */
 
 /*
@@ -428,7 +428,7 @@ pm_intr(void)
 
        PM_VIA_CLR_INTR();                      /* clear VIA1 interrupt */
                                                /* ask PM what happened */
-       pmdata.command = 0x78;
+       pmdata.command = PMU_INT_ACK;
        pmdata.num_data = 0;
        pmdata.s_buf = &pmdata.data[2];
        pmdata.r_buf = &pmdata.data[2];
@@ -604,7 +604,7 @@ pm_adb_op(u_char *buffer, void *compRout, void *data, int command)
        }
 
        /* this command enables the interrupt by operating ADB devices */
-       pmdata.command = 0x20;
+       pmdata.command = PMU_ADB_CMD;
        pmdata.num_data = 4;
        pmdata.s_buf = pmdata.data;
        pmdata.r_buf = pmdata.data;
index 6b0c666..64f5a15 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pm_direct.h,v 1.13 2012/09/02 08:16:40 mpi Exp $      */
+/*     $OpenBSD: pm_direct.h,v 1.14 2022/09/18 21:36:41 gkoehler Exp $ */
 /*     $NetBSD: pm_direct.h,v 1.7 2005/01/07 04:59:58 briggs Exp $     */
 
 /*
@@ -94,6 +94,8 @@ void pmu_fileserver_mode(int);
 
 #define PMU_SMART_BATTERY_STATE        0x6f    /* Read battery state */
 
+#define PMU_ADB_CMD            0x20    /* Send ADB packet */
+#define PMU_INT_ACK            0x78    /* Read interrupt bits */
 #define PMU_I2C                        0x9a    /* I2C */
 
 /* Bits in PMU interrupt and interrupt mask bytes */