unifdef INSECURE

2016-11-07 Thread Ilya Kaliman
===
RCS file: /cvs/src/sys/stand/boot/cmd.c,v
retrieving revision 1.63
diff -u -p -r1.63 cmd.c
--- cmd.c   20 Jul 2014 19:33:54 -  1.63
+++ cmd.c   7 Nov 2016 22:47:40 -
@@ -95,9 +95,7 @@ getcmd(void)
 int
 read_conf(void)
 {
-#ifndef INSECURE
struct stat sb;
-#endif
int fd, rc = 0;

 #ifdef CHECK_SKIP_CONF
@@ -116,14 +114,12 @@ read_conf(void)
return -1;
}

-#ifndef INSECURE
(void) fstat(fd, &sb);
if (sb.st_uid || (sb.st_mode & 2)) {
printf("non-secure %s, will not proceed\n", cmd.path);
close(fd);
return -1;
}
-#endif

do {
char *p = cmd_buf;



Re: acpiec on acer aspire S7 with CURRENT

2016-10-21 Thread Ilya Kaliman
Works for me. Ok.

acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiec0 at acpi0
acpiec0: Not running on HW-Reduced ACPI type 8
acpiec0: invalid resource #3 type 134
acpicpu0 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33),
C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33),
C1(1000@1 mwait.1), PSS

Thanks,
Ilya

On Fri, Oct 21, 2016 at 12:37 AM, Paul Irofti  wrote:
> On Tue, Oct 18, 2016 at 09:01:59PM -0700, Ilya Kaliman wrote:
>> Thanks! Now everything seems to work. Minor tweak - maybe need extra
>> newline after "acpiec0 at acpi0"
>
> New diff that fixes the printfs, removes dead code (suggested by
> guenther@) and takes care of some small style(9) nits. OK?
>
>
> Index: acpidev.h
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v
> retrieving revision 1.38
> diff -u -p -u -p -r1.38 acpidev.h
> --- acpidev.h   12 Aug 2015 05:59:54 -  1.38
> +++ acpidev.h   21 Oct 2016 07:35:22 -
> @@ -323,10 +323,12 @@ struct acpiec_softc {
> int sc_ecbusy;
>
> /* command/status register */
> +   bus_size_t  sc_ec_sc;
> bus_space_tag_t sc_cmd_bt;
> bus_space_handle_t  sc_cmd_bh;
>
> /* data register */
> +   bus_size_t  sc_ec_data;
> bus_space_tag_t sc_data_bt;
> bus_space_handle_t  sc_data_bh;
>
> Index: acpiec.c
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.54
> diff -u -p -u -p -r1.54 acpiec.c
> --- acpiec.c23 Aug 2016 18:26:21 -  1.54
> +++ acpiec.c21 Oct 2016 07:35:22 -
> @@ -48,7 +48,7 @@ void  acpiec_write(struct acpiec_softc *
>
>  intacpiec_getcrs(struct acpiec_softc *,
> struct acpi_attach_args *);
> -intacpiec_getregister(const u_int8_t *, int, int *, bus_size_t 
> *);
> +intacpiec_parse_resources(union acpi_resource *, void *);
>
>  void   acpiec_wait(struct acpiec_softc *, u_int8_t, u_int8_t);
>  void   acpiec_sci_event(struct acpiec_softc *);
> @@ -285,15 +285,16 @@ acpiec_attach(struct device *parent, str
> return;
> }
>
> +   printf("\n");
> if (acpiec_getcrs(sc, aa)) {
> -   printf(": Failed to read resource settings\n");
> +   printf("%s: Failed to read resource settings\n", DEVNAME(sc));
> return;
> }
>
> sc->sc_acpi->sc_ec = sc;
>
> if (acpiec_reg(sc)) {
> -   printf(": Failed to register address space\n");
> +   printf("%s: Failed to register address space\n", DEVNAME(sc));
> return;
> }
>
> @@ -305,15 +306,13 @@ acpiec_attach(struct device *parent, str
> acpi_set_gpehandler(sc->sc_acpi, sc->sc_gpe, acpiec_gpehandler,
> sc, 1);
>  #endif
> -
> +
> if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_GLK", 0, NULL, &res))
> sc->sc_glk = 0;
> else if (res.type != AML_OBJTYPE_INTEGER)
> sc->sc_glk = 0;
> else
> sc->sc_glk = res.v_integer ? 1 : 0;
> -
> -   printf("\n");
>  }
>
>  void
> @@ -366,68 +365,75 @@ acpiec_gpehandler(struct acpi_softc *acp
> return (0);
>  }
>
> -/* parse the resource buffer to get a 'register' value */
>  int
> -acpiec_getregister(const u_int8_t *buf, int size, int *type, bus_size_t 
> *addr)
> +acpiec_parse_resources(union acpi_resource *crs, void *arg)
>  {
> -   int len, hlen;
> +   struct acpiec_softc *sc = arg;
> +   int type = AML_CRSTYPE(crs);
>
> -#define RES_TYPE_MASK 0x80
> -#define RES_LENGTH_MASK 0x07
> -#define RES_TYPE_IOPORT0x47
> -#define RES_TYPE_ENDTAG0x79
> +   static int argno = 0;
>
> -   if (size <= 0)
> -   return (0);
> -
> -   if (*buf & RES_TYPE_MASK) {
> -   /* large resource */
> -   if (size < 3)
> -   return (1);
> -   len = (int)buf[1] + 256 * (int)buf[2];
> -   hlen = 3;
> -   } else {
> -   /* small resource */
> -   len = buf[0] & RES_LENGTH_MASK;
> -   hlen = 1;
> +   switch (argno) {
> +   case 0:
> +   if (type != SR_IOPORT) {
> +

Re: acpiec on acer aspire S7 with CURRENT

2016-10-18 Thread Ilya Kaliman
Thanks! Now everything seems to work. Minor tweak - maybe need extra
newline after "acpiec0 at acpi0"

acpiprt9 at acpi0: bus -1 (RP08)
acpiprt10 at acpi0: bus -1 (PEG0)
acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiec0 at acpi0acpiec0: Not running on HW-Reduced ACPI type 8
acpiec0: invalid resource #3 type 134

acpicpu0 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), C1(1000@1
 mwait.1), PSS
acpicpu1 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), C1(1000@1
 mwait.1), PSS

On Tue, Oct 18, 2016 at 11:31 AM, Paul Irofti  wrote:
> On Tue, Oct 18, 2016 at 10:22:06AM -0700, Ilya Kaliman wrote:
>> Hi!
>>
>> The patch seems to work partially - acpiec now gets initialized. The
>> suspend-on-lid-close does not work anymore, though (it works with my
>> initial patch).
>
> Right, that's because I had an off-by-one in the switch case. I wonder
> how my laptop managed to function with that bug...
>
> Please try again with this diff.
>
>
> Index: acpidev.h
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v
> retrieving revision 1.38
> diff -u -p -u -p -r1.38 acpidev.h
> --- acpidev.h   12 Aug 2015 05:59:54 -  1.38
> +++ acpidev.h   18 Oct 2016 18:30:24 -
> @@ -323,10 +323,12 @@ struct acpiec_softc {
> int sc_ecbusy;
>
> /* command/status register */
> +   bus_size_t  sc_ec_sc;
> bus_space_tag_t sc_cmd_bt;
> bus_space_handle_t  sc_cmd_bh;
>
> /* data register */
> +   bus_size_t  sc_ec_data;
> bus_space_tag_t sc_data_bt;
> bus_space_handle_t  sc_data_bh;
>
> Index: acpiec.c
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.54
> diff -u -p -u -p -r1.54 acpiec.c
> --- acpiec.c23 Aug 2016 18:26:21 -  1.54
> +++ acpiec.c18 Oct 2016 18:30:25 -
> @@ -407,13 +407,53 @@ acpiec_getregister(const u_int8_t *buf,
>  }
>
>  int
> +acpiec_parse_resources(union acpi_resource *crs, void *arg)
> +{
> +   struct acpiec_softc *sc = arg;
> +   int type = AML_CRSTYPE(crs);
> +
> +   static int argno = 0;
> +
> +   switch (argno) {
> +   case 0:
> +   if (type != SR_IOPORT) {
> +   printf("%s: Unexpected resource #%d type %d\n",
> +   DEVNAME(sc), argno, type);
> +   break;
> +   }
> +   sc->sc_data_bt = sc->sc_acpi->sc_iot;
> +   sc->sc_ec_data = crs->sr_ioport._max;
> +   break;
> +   case 1:
> +   if (type != SR_IOPORT) {
> +   printf("%s: Unexpected resource #%d type %d\n",
> +   DEVNAME(sc), argno, type);
> +   break;
> +   }
> +   sc->sc_cmd_bt = sc->sc_acpi->sc_iot;
> +   sc->sc_ec_sc = crs->sr_ioport._max;
> +   break;
> +   case 2:
> +   if (!sc->sc_acpi->sc_hw_reduced) {
> +   printf("%s: Not running on HW-Reduced ACPI type %d\n",
> +   DEVNAME(sc), type);
> +   break;
> +   }
> +   /* XXX: handle SCI GPIO  */
> +   break;
> +   default:
> +   printf("%s: invalid resource #%d type %d\n",
> +   DEVNAME(sc), argno, type);
> +   }
> +
> +   argno++;
> +   return 0;
> +}
> +
> +int
>  acpiec_getcrs(struct acpiec_softc *sc, struct acpi_attach_args *aa)
>  {
> struct aml_valueres;
> -   bus_size_t  ec_sc, ec_data;
> -   int dtype, ctype;
> -   char*buf;
> -   int size, ret;
> int64_t gpe;
> struct acpi_ecdt*ecdt = aa->aaa_table;
> extern struct aml_node  aml_root;
> @@ -423,11 +463,17 @@ acpiec_getcrs(struct acpiec_softc *sc, s
> /* Get GPE, Data and Control segments */
> sc->sc_gpe = ecdt->gpe_bit;
>
> -   ctype = ecdt->ec_control.address_space_id;
> -   ec_sc = ecdt->ec_control.address;
> -
> -   dtype = ecdt->ec_data.address_space_id;
> -   ec_data = ecdt->ec_data.address;
> +   if (ecdt->ec_control.address_space_id == GAS_SYSTEM_IOSPACE)
> + 

Re: acpiec on acer aspire S7 with CURRENT

2016-10-18 Thread Ilya Kaliman
Hi!

The patch seems to work partially - acpiec now gets initialized. The
suspend-on-lid-close does not work anymore, though (it works with my
initial patch).

acpiprt10 at acpi0: bus -1 (PEG0)
acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiec0 at acpi0acpiec0: invalid resource #0 type 8
acpiec0: Not running on HW-Reduced ACPI type 134

acpicpu0 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), C1(1000@1
 mwait.1), PSS
acpicpu1 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), C1(1000@1
 mwait.1), PSS
acpicpu2 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), C1(1000@1
 mwait.1), PSS
acpicpu3 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33), C1(1000@1
 mwait.1), PSS
acpitz0 at acpi0: critical temperature is 99 degC
acpitz1 at acpi0: critical temperature is 98 degC
acpials0 at acpi0: ALSD
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 model "AP13F3N" serial  2358 type LION oem "4f594e4153"
acpibtn0 at acpi0: PWRB
"10250759" at acpi0 not configured
"SYN1B78" at acpi0 not configured
"PNP0C14" at acpi0 not configured
dwiic0 at acpi0: I2C1 addr 0xfe105000/0x1000 irq 7
iic0 at dwiic0
"BCM2E4E" at acpi0 not configured
acpibtn1 at acpi0: LID0
acpibtn2 at acpi0: SLPB
"PNP0C14" at acpi0 not configured
"INT340E" at acpi0 not configured
"INT33A0" at acpi0 not configured

On Tue, Oct 18, 2016 at 3:25 AM, Paul Irofti  wrote:
>> Perhaps acpiec should use aml_parse_resource() instead of the hand-crafted
>> parsing it does right now?  That would solve the second problem, at
>> least.
>
> Like this?
>
> To the OP can you please test this diff on your system and let me know
> if it fixes things?
>
> I will move on to adding support for hardware reduced machines once this
> diff is in and I see an actual ACPI dump that has GPIO AML code.
>
>
> Index: acpidev.h
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpidev.h,v
> retrieving revision 1.38
> diff -u -p -u -p -r1.38 acpidev.h
> --- acpidev.h   12 Aug 2015 05:59:54 -  1.38
> +++ acpidev.h   18 Oct 2016 10:22:41 -
> @@ -323,10 +323,12 @@ struct acpiec_softc {
> int sc_ecbusy;
>
> /* command/status register */
> +   bus_size_t  sc_ec_sc;
> bus_space_tag_t sc_cmd_bt;
> bus_space_handle_t  sc_cmd_bh;
>
> /* data register */
> +   bus_size_t  sc_ec_data;
> bus_space_tag_t sc_data_bt;
> bus_space_handle_t  sc_data_bh;
>
> Index: acpiec.c
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.54
> diff -u -p -u -p -r1.54 acpiec.c
> --- acpiec.c23 Aug 2016 18:26:21 -  1.54
> +++ acpiec.c18 Oct 2016 10:22:41 -
> @@ -407,13 +407,53 @@ acpiec_getregister(const u_int8_t *buf,
>  }
>
>  int
> +acpiec_parse_resources(union acpi_resource *crs, void *arg)
> +{
> +   struct acpiec_softc *sc = arg;
> +   int type = AML_CRSTYPE(crs);
> +
> +   static int argno = 0;
> +
> +   switch (argno) {
> +   case 1:
> +   if (type != SR_IOPORT) {
> +   printf("%s: Unexpected resource #%d type %d\n",
> +   DEVNAME(sc), argno, type);
> +   break;
> +   }
> +   sc->sc_data_bt = sc->sc_acpi->sc_iot;
> +   sc->sc_ec_data = crs->sr_ioport._max;
> +   break;
> +   case 2:
> +   if (type != SR_IOPORT) {
> +   printf("%s: Unexpected resource #%d type %d\n",
> +   DEVNAME(sc), argno, type);
> +   break;
> +   }
> +   sc->sc_cmd_bt = sc->sc_acpi->sc_iot;
> +   sc->sc_ec_sc = crs->sr_ioport._max;
> +   break;
> +   case 3:
> +   if (!sc->sc_acpi->sc_hw_reduced) {
> +   printf("%s: Not running on HW-Reduced ACPI type %d\n",
> +   DEVNAME(sc), type);
> +   break;
> +   }
> +   /* XXX: handle SCI GPIO  */
> +   break;
> +   default:
> +   printf("%s: invalid resource #%d type %d\n",
> +   DEVNAME(sc), argno, type);
> +   }
> +
> +   argno++;
> +   return 0;
> +}
> +
> +int
>  acpiec_getcrs(struct acpiec_softc *sc, struct acpi_attach_args *aa)
>  {
> struct aml_valueres;
> -   bus_size_t  ec_sc, ec_data;
> -   int dtype, ctype;
> -   char*buf;
> -   int size, ret;
> int64_t gpe;
> struct acpi_ecdt*ecdt = aa->aaa_table;
> extern struct aml_node  aml_root;
> @@ -423,11 +463,17 @@ acpiec_getcrs(struct acpiec_softc *sc, s
> /* Get GPE, Data and Control 

Re: acpiec on acer aspire S7 with CURRENT

2016-10-14 Thread Ilya Kaliman
dmesg:
OpenBSD 6.0 (GENERIC.MP) #1: Thu Sep  8 16:32:34 PDT 2016
i...@puffy.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error 80
real mem = 8468033536 (8075MB)
avail mem = 8206921728 (7826MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.7 @ 0xe6a80 (27 entries)
bios0: vendor Insyde Corp. version "V2.12" date 05/20/2014
bios0: Acer Aspire S7-392
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP TCPA UEFI FPDT MSDM ASF! HPET APIC MCFG SSDT
BOOT ASPT DBGP SSDT SSDT SSDT SSDT SSDT DMAR
acpi0: wakeup devices P0P1(S4) GLAN(S4) EHC1(S3) EHC2(S3) XHC_(S3)
HDEF(S4) TPD4(S4) PXSX(S4) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4)
RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) [...]
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 14318179 Hz
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 1596.68 MHz
cpu0: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu0: 256KB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 99MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 1596.31 MHz
cpu1: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu1: 256KB 64b/line 8-way L2 cache
cpu1: smt 1, core 0, package 0
cpu2 at mainbus0: apid 2 (application processor)
cpu2: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 1596.31 MHz
cpu2: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu2: 256KB 64b/line 8-way L2 cache
cpu2: smt 0, core 1, package 0
cpu3 at mainbus0: apid 3 (application processor)
cpu3: Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 1596.31 MHz
cpu3: 
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,EST,TM2,SSSE3,FMA3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,LONG,LAHF,ABM,PERF,ITSC,FSGSBASE,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,SENSOR,ARAT
cpu3: 256KB 64b/line 8-way L2 cache
cpu3: smt 1, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec0, version 20, 40 pins
acpimcfg0 at acpi0 addr 0xe000, bus 0-255
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus -1 (P0P1)
acpiprt2 at acpi0: bus -1 (RP01)
acpiprt3 at acpi0: bus -1 (RP02)
acpiprt4 at acpi0: bus 1 (RP03)
acpiprt5 at acpi0: bus -1 (RP04)
acpiprt6 at acpi0: bus -1 (RP05)
acpiprt7 at acpi0: bus -1 (RP06)
acpiprt8 at acpi0: bus -1 (RP07)
acpiprt9 at acpi0: bus -1 (RP08)
acpiprt10 at acpi0: bus -1 (PEG0)
acpiprt11 at acpi0: bus -1 (PEG1)
acpiprt12 at acpi0: bus -1 (PEG2)
acpiec0 at acpi0: Failed to read resource settings
acpicpu0 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33),
C1(1000@1 mwait.1), PSS
acpicpu1 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33),
C1(1000@1 mwait.1), PSS
acpicpu2 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33),
C1(1000@1 mwait.1), PSS
acpicpu3 at acpi0: C3(200@506 mwait.1@0x60), C2(200@148 mwait.1@0x33),
C1(1000@1 mwait.1), PSS
acpitz0 at acpi0: critical temperature is 99 degC
acpitz1 at acpi0: critical temperature is 98 degC
"ACPI0008" at acpi0 not configured
acpiac0 at acpi0: AC unit online
acpibat0 at acpi0: BAT0 model "AP13F3N" serial  2358 type LION oem "4f594e4153"
acpibtn0 at acpi0: PWRB
"10250759" at acpi0 not configured
"SYN1B78" at acpi0 not configured
"PNP0C14" at acpi0 not configured
dwiic0 at acpi0: I2C1 addr 0xfe105000/0x1000 irq 7
iic0 at dwiic0
"BCM2E4E" at acpi0 not configured
acpibtn1 at acpi0: LID0
acpi0: WARNING EC not initialized
acpi0: WARNING EC not initialized
acpibtn2 at acpi0: SLPB
"PNP0C14" at acpi0 not configured
"INT340E" at acpi0 not configured
"INT33A0" at acpi0 not configured
"PNP0C31" at acpi0 not configured
acpivideo0 at acpi0: GFX0
acpivout0 at acpivideo0: DD1F
cpu0: Enhanced SpeedStep 1596 MHz: speeds: 2401, 2400, 2300, 2200,
2000, 1900, 1700, 

Re: acpiec on acer aspire S7 with CURRENT

2016-10-13 Thread Ilya Kaliman
Hi!

Thanks for looking into this. I've tried the patch and the "found GPIO
port" printf is not triggered because sc->sc_acpi->sc_hw_reduced is 0
for me.

Which acpi table should I attach?

Thanks,
Ilya


RSD PTR: Checksum=188, OEMID=ACRSYS, RsdtAddress=0x9aafe124


RSDT: Length=112, Revision=1, Checksum=171,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=, Creator Revision=0x113


Entries={ 0x9aaf7000, 0x9aafd000, 0x9aafc000, 0x9aafa000,
0x9aaf9000, 0x9aaf8000, 0x9aaf6000, 0x9aaf5000, 0x9aaf4000,
0x9aae2000, 0x9aae, 0x9aade000, 0x9aadd000, 0x9aada000,
0x9aad9000, 0x9aad5000, 0x9aad4000, 0x9aad3000, 0x9aae3000 }


DSDT=0x9aae4000
INT_MODEL=APIC
SCI_INT=9
SMI_CMD=0xb2, ACPI_ENABLE=0xa0, ACPI_DISABLE=0xa1, S4BIOS_REQ=0x0
PM1a_EVT_BLK=0x1800-0x1803
PM1a_CNT_BLK=0x1804-0x1805
PM2_CNT_BLK=0x1850-0x1850
PM2_TMR_BLK=0x1808-0x180b
PM2_GPE0_BLK=0x1880-0x189f
P_LVL2_LAT=101ms, P_LVL3_LAT=57ms
FLUSH_SIZE=1024, FLUSH_STRIDE=16
DUTY_OFFSET=1, DUTY_WIDTH=3
DAY_ALRM=13, MON_ALRM=0, CENTURY=0
Flags={WBINVD,PROC_C1,SLP_BUTTON,RTC_S4}


DSDT: Length=61736, Revision=1, Checksum=95,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x0,
Creator ID=1025, Creator Revision=0x4


TCPA: Length=50, Revision=2, Checksum=139,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x0,
Creator ID=1025, Creator Revision=0x4


UEFI: Length=566, Revision=1, Checksum=189,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


FPDT: Length=68, Revision=1, Checksum=181,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


MSDM: Length=85, Revision=3, Checksum=230,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


ASF!: Length=165, Revision=32, Checksum=231,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


HPET: Length=56, Revision=1, Checksum=170,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


APIC: Length=140, Revision=3, Checksum=12,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


MCFG: Length=60, Revision=1, Checksum=210,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


SSDT: Length=2101, Revision=1, Checksum=93,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1000,
Creator ID=1025, Creator Revision=0x4


BOOT: Length=40, Revision=1, Checksum=106,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


ASPT: Length=52, Revision=7, Checksum=152,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


DBGP: Length=52, Revision=1, Checksum=172,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4


SSDT: Length=1337, Revision=1, Checksum=105,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x3000,
Creator ID=1025, Creator Revision=0x4


SSDT: Length=2776, Revision=1, Checksum=140,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x3000,
Creator ID=1025, Creator Revision=0x4


SSDT: Length=12958, Revision=1, Checksum=91,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x3000,
Creator ID=1025, Creator Revision=0x4


SSDT: Length=824, Revision=1, Checksum=146,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1000,
Creator ID=1025, Creator Revision=0x4


SSDT: Length=1593, Revision=1, Checksum=58,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1000,
Creator ID=1025, Creator Revision=0x4


DMAR: Length=136, Revision=1, Checksum=227,
OEMID=ACRSYS, OEM Table ID=ACRPRDCT, OEM Revision=0x1,
Creator ID=1025, Creator Revision=0x4






On Thu, Oct 13, 2016 at 1:19 AM, Paul Irofti  wrote:
>> The diff you sent simply ignores the issue which obviously can not be
>> used in the tree.
>
> The following diff starts working in the right direction, but there is
> probably more to do in order to support machines like yours.
>
> It would be interesting to see if that printf gets triggered though, so
> please test and let me know. Also, send that acpidump.
>
>
> Index: acpiec.c
> ===
> RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
> retrieving revision 1.54
> diff -u -p -u -p -r1.54 acpiec.c
> --- acpiec.c23 Aug 2016 18:26:21 -  1.54
> +++ acpiec.c13 Oct 2016 08:16:52 -
> @@ -410,8 +410,8 @@ int
>  acpiec_getcrs(st

acpiec on acer aspire S7 with CURRENT

2016-10-10 Thread Ilya Kaliman
Hi tech,

while trying the latest snapshot I've noticed that the following
warning is printed to a console several times a second (this does not
happen in 6.0):

acpi0: WARNING EC not initialized

The investigation shows that the acpiec initialization fails in
acpiec.c line 484:

if (size != 2 || *buf != RES_TYPE_ENDTAG)

On my system at this point the size value is 22 and the *buf is 0x47
(RES_TYPE_IOPORT).

I am not sure what the proper fix is, but removing the whole _CRS
ENDTAG check solves the problem (see attached patch).

Thanks,
Ilya

===
RCS file: /cvs/src/sys/dev/acpi/acpiec.c,v
retrieving revision 1.54
diff -u -p -r1.54 acpiec.c
--- acpiec.c23 Aug 2016 18:26:21 -  1.54
+++ acpiec.c10 Oct 2016 21:55:59 -
@@ -477,15 +477,6 @@ acpiec_getcrs(struct acpiec_softc *sc, s
aml_freevalue(&res);
return (1);
}
-
-   buf += ret;
-   size -= ret;
-
-   if (size != 2 || *buf != RES_TYPE_ENDTAG) {
-   dnprintf(10, "%s: no _CRS end tag\n", DEVNAME(sc));
-   aml_freevalue(&res);
-   return (1);
-   }
aml_freevalue(&res);



Further cleanup of unused macros

2015-10-27 Thread Ilya Kaliman
Index: bin/ksh/emacs.c
===
RCS file: /cvs/src/bin/ksh/emacs.c,v
retrieving revision 1.60
diff -u -p -r1.60 emacs.c
--- bin/ksh/emacs.c 19 Oct 2015 14:42:16 -  1.60
+++ bin/ksh/emacs.c 27 Oct 2015 16:02:38 -
@@ -42,8 +42,7 @@ structx_ftab {
 };
 
 #define XF_ARG 1   /* command takes number prefix */
-#defineXF_NOBIND   2   /* not allowed to bind to function */
-#defineXF_PREFIX   4   /* function sets prefix */
+#define XF_NOBIND  2   /* not allowed to bind to function */
 
 /* Separator for completion */
 #defineis_cfs(c)   (c == ' ' || c == '\t' || c == '"' || c == '\'')
Index: sbin/fsck_ext2fs/setup.c
===
RCS file: /cvs/src/sbin/fsck_ext2fs/setup.c,v
retrieving revision 1.29
diff -u -p -r1.29 setup.c
--- sbin/fsck_ext2fs/setup.c15 Oct 2015 15:11:10 -  1.29
+++ sbin/fsck_ext2fs/setup.c27 Oct 2015 16:03:01 -
@@ -54,8 +54,6 @@
 #include "extern.h"
 #include "fsutil.h"
 
-#define POWEROF2(num)  (((num) & ((num) - 1)) == 0)
-
 void badsb(int, char *);
 int calcsb(char *, int, struct m_ext2fs *, struct disklabel *);
 static struct disklabel *getdisklabel(char *, int);
Index: sbin/restore/interactive.c
===
RCS file: /cvs/src/sbin/restore/interactive.c,v
retrieving revision 1.30
diff -u -p -r1.30 interactive.c
--- sbin/restore/interactive.c  20 Jan 2015 18:22:21 -  1.30
+++ sbin/restore/interactive.c  27 Oct 2015 16:03:01 -
@@ -50,8 +50,6 @@
 #include "restore.h"
 #include "extern.h"
 
-#define round(a, b) (((a) + (b) - 1) / (b) * (b))
-
 /*
  * Things to handle interruptions.
  */
Index: sbin/route/show.c
===
RCS file: /cvs/src/sbin/route/show.c,v
retrieving revision 1.102
diff -u -p -r1.102 show.c
--- sbin/route/show.c   23 Oct 2015 15:03:25 -  1.102
+++ sbin/route/show.c   27 Oct 2015 16:03:01 -
@@ -60,7 +60,6 @@ char  *label_print(struct sockaddr *);
 
 #define ROUNDUP(a) \
((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long))
-#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
 
 /*
  * Definitions for showing gateway flags.
Index: usr.bin/compress/main.c
===
RCS file: /cvs/src/usr.bin/compress/main.c,v
retrieving revision 1.90
diff -u -p -r1.90 main.c
--- usr.bin/compress/main.c 17 Oct 2015 21:34:07 -  1.90
+++ usr.bin/compress/main.c 27 Oct 2015 16:03:06 -
@@ -48,8 +48,6 @@
 #include 
 #include "compress.h"
 
-#define min(a,b) ((a) < (b)? (a) : (b))
-
 int cat, decomp, pipin, force, verbose, testmode, list, recurse, storename;
 extern char *__progname;
 
Index: usr.bin/vi/vi/vs_refresh.c
===
RCS file: /cvs/src/usr.bin/vi/vi/vs_refresh.c,v
retrieving revision 1.19
diff -u -p -r1.19 vs_refresh.c
--- usr.bin/vi/vi/vs_refresh.c  12 Nov 2014 04:28:41 -  1.19
+++ usr.bin/vi/vi/vs_refresh.c  27 Oct 2015 16:03:07 -
@@ -875,7 +875,6 @@ vs_modeline(SCR *sp)
 * line as possible, but guaranteeing at least two spaces between the
 * ruler and the modified flag.
 */
-#defineMODESIZE9
endpoint = cols;
if (O_ISSET(sp, O_SHOWMODE)) {
if (F_ISSET(sp->ep, F_MODIFIED))



unused macros in ksh

2015-10-22 Thread Ilya Kaliman
===
RCS file: /cvs/src/bin/ksh/shf.c,v
retrieving revision 1.25
diff -u -p -r1.25 shf.c
--- shf.c   19 Oct 2015 14:42:16 -  1.25
+++ shf.c   23 Oct 2015 00:27:40 -
@@ -707,10 +707,6 @@ shf_smprintf(const char *fmt, ...)
return shf_sclose(&shf); /* null terminates */
 }

-#define BUF_SIZE   128
-#define ABIGNUM32000   /* big number that will fit in
a short */
-#define LOG2_103.321928094887362347870319429   /* log
base 2 of 10 */
-
 #defineFL_HASH 0x001   /* `#' seen */
 #define FL_PLUS0x002   /* `+' seen */
 #define FL_RIGHT   0x004   /* `-' seen */
@@ -722,7 +718,6 @@ shf_smprintf(const char *fmt, ...)
 #define FL_DOT 0x100   /* '.' seen */
 #define FL_UPPER   0x200   /* format character was uppercase */
 #define FL_NUMBER  0x400   /* a number was formated %[douxefg] */
-

 int
 shf_vfprintf(struct shf *shf, const char *fmt, va_list args)



mkdir pledge condition

2015-10-22 Thread Ilya Kaliman
& has lower precedence than ==, so this seems to be not what was
intended (the condition is always false):

===
RCS file: /cvs/src/bin/mkdir/mkdir.c,v
retrieving revision 1.28
diff -u -p -r1.28 mkdir.c
--- mkdir.c 10 Oct 2015 20:18:30 -  1.28
+++ mkdir.c 23 Oct 2015 00:03:31 -
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
argc -= optind;
argv += optind;

-   if (mode & (S_ISUID | S_ISGID | S_ISTXT) == 0) {
+   if ((mode & (S_ISUID | S_ISGID | S_ISTXT)) == 0) {
if (pledge("stdio rpath cpath fattr", NULL) == -1)
err(1, "pledge");
}



A couple of style(9) tweaks

2015-10-20 Thread Ilya Kaliman
===
RCS file: /cvs/src/bin/ed/main.c,v
retrieving revision 1.53
diff -u -p -r1.53 main.c
--- bin/ed/main.c   9 Oct 2015 21:24:05 -   1.53
+++ bin/ed/main.c   20 Oct 2015 22:49:53 -
@@ -174,7 +174,7 @@ top:
signal(SIGHUP, signal_hup);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, signal_int);
-   if (status = sigsetjmp(env, 1)) {
+   if ((status = sigsetjmp(env, 1))) {
fputs("\n?\n", stderr);
seterrmsg("interrupt");
} else {
Index: usr.bin/rcs/co.c
===

===
RCS file: /cvs/src/usr.bin/rcs/co.c,v
retrieving revision 1.121
diff -u -p -r1.121 co.c
--- usr.bin/rcs/co.c13 Jun 2015 20:15:21 -  1.121
+++ usr.bin/rcs/co.c20 Oct 2015 22:52:04 -
@@ -515,7 +515,7 @@ checkout_err_nobranch(RCSFILE *file, con
file->rf_path,
date ? " a date before " : "",
date ? date : "",
-   author ? " and author " + (date ? 0:4 ) : "",
+   author ? " and author " + (date ? 0:4) : "",
author ? author : "",
state  ? " and state " + (date || author ? 0:4) : "",
state  ? state : "");
Index: usr.bin/who/who.c
===

===
RCS file: /cvs/src/usr.bin/who/who.c,v
retrieving revision 1.26
diff -u -p -r1.26 who.c
--- usr.bin/who/who.c   12 Oct 2015 19:56:47 -  1.26
+++ usr.bin/who/who.c   20 Oct 2015 22:52:04 -
@@ -77,7 +77,7 @@ main(int argc, char *argv[])
if (pledge("stdio rpath getpw", NULL) == -1)
err(1, "pledge");

-   if (mytty = ttyname(0)) {
+   if ((mytty = ttyname(0))) {
/* strip any directory component */
if ((t = strrchr(mytty, '/')))
mytty = t + 1;



nfsd Makefile

2015-10-01 Thread Ilya Kaliman
===
RCS file: /cvs/src/sbin/nfsd/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile11 Jun 2002 15:45:44 -  1.7
+++ Makefile1 Oct 2015 23:48:35 -
@@ -3,6 +3,4 @@
 PROG=  nfsd
 MAN=   nfsd.8

-.include   # For KERBEROS
-
 .include 



Cleanup options(4) after INET removal

2015-10-01 Thread Ilya Kaliman
===
RCS file: /cvs/src/share/man/man4/options.4,v
retrieving revision 1.239
diff -u -p -r1.239 options.4
--- options.4   21 Jan 2015 02:23:14 -  1.239
+++ options.4   1 Oct 2015 18:03:35 -
@@ -444,24 +444,13 @@ See
 and
 .Xr sysctl 3
 for details.
-.It Cd option INET
-Includes support for the TCP/IP protocol stack.
-This option is currently required.
-See
-.Xr inet 4
-for details.
 .It Cd option INET6
 Includes support for the IPv6 protocol stack.
 See
 .Xr inet6 4
 for details.
-Unlike
-.Em INET ,
 .Em INET6
 enables multicast routing code as well.
-This option requires
-.Em INET
-at this moment, but it should not.
 .It Cd option IPSEC
 This option enables IP security protocol support.
 See
@@ -473,8 +462,6 @@ While not IP specific, this option is us
 .Em IPSEC .
 .It Cd option MROUTING
 Includes support for IP multicast routers.
-.Em INET
-should be set along with this.
 Multicast routing is controlled by the
 .Xr mrouted 8
 daemon.
@@ -716,7 +703,3 @@ The
 .Nm
 man page first appeared in
 .Ox 2.3 .
-.Sh BUGS
-The
-.Em INET
-option should not be required.