Re: sys/arch/i386/i386/bios.c won't compile if NACPI==0 and NAPM>0

2017-07-15 Thread Nick Briggs

> On Jul 14, 2017, at 10:29 PM, Mike Larkin <mlar...@azathoth.net> wrote:
> 
> On Fri, Jul 14, 2017 at 03:39:25PM -0700, Nick Briggs wrote:
>> 
>>> Synopsis:  sys/arch/i386/i386/bios.c won't compile if NACPI ==0 and 
>>> NAPM>0
>>> Category:  system
>>> Environment:
>>   System  : OpenBSD 6.1
>>   Details : OpenBSD 6.1-stable (PIGEON) #5: Thu Jul 13 17:09:51 PDT 
>> 2017
>>briggs@pigeon:/usr/obj/sys/arch/i386/compile/PIGEON
>> 
>>   Architecture: OpenBSD.i386
>>   Machine : i386
>>> Description:
>> 
>> In  bios.c:171 "usingacpi" is declared with
>> 
>> #if NACPI > 0
>>int usingacpi = 0;
>> #endif
>> 
>> but at bios.c:390, we find
>> 
>> #if NAPM > 0
>>if (usingacpi == 0 && apm && ncpu < 2 && smbiosrev < 240) {
>> 
>>> How-To-Repeat:
>> 
>>   recompile kernel for i386 with apm but without acpi in the 
>> configuration.
>> 
>>> Fix:
>> 
>> One possibility:
>> 
>> Index: sys/arch/i386/i386/bios.c
>> ===
>> RCS file: /cvs/src/sys/arch/i386/i386/bios.c,v
>> retrieving revision 1.115
>> diff -u -p -r1.115 bios.c
>> --- sys/arch/i386/i386/bios.c   7 Mar 2016 05:32:46 -   1.115
>> +++ sys/arch/i386/i386/bios.c   14 Jul 2017 19:33:20 -
>> @@ -171,7 +171,7 @@ biosattach(struct device *parent, struct
>>volatile u_int8_t *va;
>>char scratch[64], *str;
>>int flags, smbiosrev = 0, ncpu = 0, isa_hole_exec = 0;
>> -#if NACPI > 0
>> +#if NACPI > 0 || NAPM > 0
>>int usingacpi = 0;
>> #endif
>> 
>> Alternatively, make the reference to usingacpi conditional on NACPI > 0.
>> 
>> 
> 
> what are you trying to do here?
> 
> We generally don't support bizarre custom kernel configurations.
> 
> -ml

It's an old piece of hardware I was building a minimal kernel for.   There is 
no ACPI support on it, only APM -- it's not exactly bizarre, just old.
I had gone through the config and removed any devices that weren't present, 
thus:
...
apm0at bios0 flags 0x   # flags 0x0101 to force protocol version 1.1
#acpi0  at bios?
...

This is the only place in the kernel that won't compile in this situation, and 
there's no requirement that I can find that says you must configure in ACPI 
support if you have APM.

Anyway -- it seems like a simple and harmless fix and captures the actual 
dependencies of the rest of the code.



Re: sys/arch/i386/i386/bios.c won't compile if NACPI==0 and NAPM>0

2017-07-14 Thread Mike Larkin
On Fri, Jul 14, 2017 at 03:39:25PM -0700, Nick Briggs wrote:
> 
> > Synopsis:  sys/arch/i386/i386/bios.c won't compile if NACPI ==0 and 
> > NAPM>0
> > Category:  system
> > Environment:
>System  : OpenBSD 6.1
>Details : OpenBSD 6.1-stable (PIGEON) #5: Thu Jul 13 17:09:51 PDT 
> 2017
> briggs@pigeon:/usr/obj/sys/arch/i386/compile/PIGEON
> 
>Architecture: OpenBSD.i386
>Machine : i386
> > Description:
> 
> In  bios.c:171 "usingacpi" is declared with
> 
> #if NACPI > 0
> int usingacpi = 0;
> #endif
> 
> but at bios.c:390, we find
> 
> #if NAPM > 0
> if (usingacpi == 0 && apm && ncpu < 2 && smbiosrev < 240) {
> 
> > How-To-Repeat:
> 
>recompile kernel for i386 with apm but without acpi in the 
> configuration.
> 
> > Fix:
> 
> One possibility:
> 
> Index: sys/arch/i386/i386/bios.c
> ===
> RCS file: /cvs/src/sys/arch/i386/i386/bios.c,v
> retrieving revision 1.115
> diff -u -p -r1.115 bios.c
> --- sys/arch/i386/i386/bios.c   7 Mar 2016 05:32:46 -   1.115
> +++ sys/arch/i386/i386/bios.c   14 Jul 2017 19:33:20 -
> @@ -171,7 +171,7 @@ biosattach(struct device *parent, struct
> volatile u_int8_t *va;
> char scratch[64], *str;
> int flags, smbiosrev = 0, ncpu = 0, isa_hole_exec = 0;
> -#if NACPI > 0
> +#if NACPI > 0 || NAPM > 0
> int usingacpi = 0;
>  #endif
>  
> Alternatively, make the reference to usingacpi conditional on NACPI > 0.
> 
> 

what are you trying to do here?

We generally don't support bizarre custom kernel configurations.

-ml



sys/arch/i386/i386/bios.c won't compile if NACPI==0 and NAPM>0

2017-07-14 Thread Nick Briggs

> Synopsis:      sys/arch/i386/i386/bios.c won't compile if NACPI ==0 and NAPM>0
> Category:  system
> Environment:
   System  : OpenBSD 6.1
   Details : OpenBSD 6.1-stable (PIGEON) #5: Thu Jul 13 17:09:51 PDT 
2017
briggs@pigeon:/usr/obj/sys/arch/i386/compile/PIGEON

   Architecture: OpenBSD.i386
   Machine : i386
> Description:

In  bios.c:171 "usingacpi" is declared with

#if NACPI > 0
int usingacpi = 0;
#endif

but at bios.c:390, we find

#if NAPM > 0
if (usingacpi == 0 && apm && ncpu < 2 && smbiosrev < 240) {

> How-To-Repeat:

   recompile kernel for i386 with apm but without acpi in the configuration.

> Fix:

One possibility:

Index: sys/arch/i386/i386/bios.c
===
RCS file: /cvs/src/sys/arch/i386/i386/bios.c,v
retrieving revision 1.115
diff -u -p -r1.115 bios.c
--- sys/arch/i386/i386/bios.c   7 Mar 2016 05:32:46 -   1.115
+++ sys/arch/i386/i386/bios.c   14 Jul 2017 19:33:20 -
@@ -171,7 +171,7 @@ biosattach(struct device *parent, struct
volatile u_int8_t *va;
char scratch[64], *str;
int flags, smbiosrev = 0, ncpu = 0, isa_hole_exec = 0;
-#if NACPI > 0
+#if NACPI > 0 || NAPM > 0
int usingacpi = 0;
 #endif
 
Alternatively, make the reference to usingacpi conditional on NACPI > 0.