Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-17 Thread Bret Johnson
> Why would ACPI somehow have to be less powerful than the rest of the
> computer firmware?

ACPI is not actually firmware -- ACPI doesn't actually DO anything like 
firmware does.  Firmware is sort of like "permanent software" (executable code 
stored usually in non-volatile RAM or ROM), while ACPI does not contain any 
executable code (at least nothing that can be executed directly).

> I have not finished reading the ACPI specification, but my
> understanding is, it is essentially a series of tables (and
> bytecodes) that tell an OS (e.g. MS-DOS, Windows) about the
> peripherals and features a machine has, and some information on how
> to control them.

Sort of.  ACPI contains tables of the hardware contents of the computer similar 
to SMBIOS (and from what I understand that part of ACPI is intended to make 
SMBIOS completely obsolete).  It's also intended to make APM obsolete, but does 
not do anything that APM does.  For example, APM has built-in functions you can 
call directly to do things like shut down the computer or get the current 
battery information for a laptop, but ACPI does not (at least not directly) 
have any kind of similar functionality.

Just like SMBIOS, ACPI is "hard-coded" and does not change in real-time (or 
even at boot time) to adjust itself to the current state of the computer.  The 
ACPI data is "compiled" when the computer is first manufactured, so if you have 
changed anything on the computer (e.g., replaced the original Intel CPU with an 
AMD CPU or changed the CPU to something with a different number of cores or 
over/underclocked the CPU or ...) it will never be reflected in the ACPI 
tables.  So, ACPI should never contain data on anything that is "replaceable" 
or "upgradable", or at least you should never trust anything ACPI tells you 
about anything that is not "permanent".

As far as "bytecodes", that's also a "sort of".  As I alluded to above, ACPI 
does not contain any directly executable code or even any functions that return 
useful data like APM does.  You could not, for example, just pull a section out 
of ACPI, insert it into memory, and then have the CPU execute the data stored 
in memory as if it contained properly compiled/assembled code.

The "bytecode" contained in ACPI is stored in a special format called ACPI 
Machine Language (AML).  AML is weird -- the best way I can describe it is 
Encrypted PseudoCode.  What you must first do is Disassemble the AML code.  It 
really is a Machine Language analogous to what is stored in the computer's 
memory for "normal" executable code, but if you Disassemble AML into something 
human-readable what you see is PseudoCode rather than the ASM code that you 
would see from a "normal" Disassembly.  From what I understand, the reason it 
is PseudoCode instead of "real" code is to be CPU-independent.  That is, the 
same computer could have an Intel-compatible or ARM or RISC CPU or even 
something else and the ACPI part would never need to change.

To actually do something with ACPI, you must then take the Disassembled 
PseudoCode, somehow create "real" code from it, and compile/assemble that 
"real" code into something executable that the CPU can actually use.  In an 
actual implementation, of course, you wouldn't necessarily need to go through a 
human-readable format in the middle, but you somehow need to convert from ACPI 
Machine Language to "real" Machine Language.

ACPI really is a weird, convoluted, multi-tiered, confusing, nightmare to work 
with.  In addition, computer manufacturers don't create AML "code" directly, 
but use a higher-level language program (something similar to ASM or C or PERL) 
to "compile" the ACPI tables and AML "code".  Just like almost nobody creates 
programs any more using "real" machine language, almost nobody creates ACPI 
tables directly in AML.  And just like regular programs, sometimes ACPI tables 
have bugs and errors, so you can't necessarily trust everything they tell you.

ACPI is also not "modular".  It's really designed so that you need to 
Disassemble, Convert, and Compile the whole ACPI even if all you are trying to 
do is one simple thing.  Trying to extract one simple item from it can be 
unbelievably cumbersome.  I've done a little bit of it myself, and I know Eric 
has as well.  I know others here have at least some experience with ACPI too.

Let's use the current discussion as an example -- twiddling the BIOS so that 
the computer will automatically boot as soon as it gets power.  The BIOS on my 
particular computer doesn't have that option, but it does have "boot on LAN" 
and "boot on certain days of the month or certain times of day" options.  There 
is enough circuitry in the computer that I think adding a "boot as soon as you 
get power" option wouldn't be too difficult to add (maybe it would, but I don't 
think so).  Anyway, let's say it were possible and if you upgraded the BIOS 
that would be a new option in there.  Let's also say that the current ACPI 
included 

Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-14 Thread TK Chia

Hello Bret,


My overall point was that you can't turn on the PSU (to boot the computer) with 
ACPI because ACPI only starts working after the computer (main part of the 
motherboard) already has power and has booted an OS.  You can't turn the PSU on 
with software (like ACPI) that requires the PSU to already be completely turned 
on, but you can turn the PSU off.  While there is some overlap between what the 
BIOS does and what ACPI does, they are two completely separate things.


Why would ACPI somehow have to be less powerful than the rest of the
computer firmware?

I have not finished reading the ACPI specification, but my understanding
is, it is essentially a series of tables (and bytecodes) that tell an OS
(e.g. MS-DOS, Windows) about the peripherals and features a machine has,
and some information on how to control them.

Nothing prevents the ACPI tables from exposing to the OS whatever
functionality the firmware might have, if the ACPI tables so choose.

Thank you!

--
https://gitlab.com/tkchia :: https://github.com/tkchia


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-14 Thread Bret Johnson
> Modern motherboards use this "Standby" power to run small always-on
> power management circuitry (I believe this is integrated directly
> into the chipset these days) which monitors all sources of a "power
> on" signal, be it the power button on the case, or a LAN controller,
> or a built-in watchdog timer, or what-have you. When such a signal
> is received, this power management circuitry pulls pin #16 low to
> power up all the other voltage lines of the PSU, which fully turns
> on the computer.

That is essentially the same thing I was trying to say, though my wording might 
have been confusing.  My point was that it takes a special HARDWARE signal to 
the power supply before it will start sending power to the main part of 
motherboard (for the CPU, RAM, etc.).  On older computers, this was just the 
big red toggle switch.  On newer computers, it is a "soft" switch.

On the newer ("ATX") power supplies there is is a small amount of power that 
the PSU produces when the PSU is first plugged in which can be used to power 
some small subset of circuitry (either on the motherboard or somewhere in the 
computer chassis) that gets power whenever the PSU is plugged into the wall.  
At a minimum, this will be tied to the "soft" power switch, but it may also go 
to Ethernet NICs, clocks/timers/calendars, etc.  But those devices must send a 
HARDWARE signal back to the PSU to tell it to start sending power to the "main" 
part of the motherboard (the CPU, RAM, etc.).  Exactly what those devices are 
and exactly what they do varies from computer to computer, and the settings 
that control what they do are in the BIOS, not in ACPI.  I use BIOS here in the 
"generic" sense, covering standard BIOS, EFI/UEFI, etc. -- basically whatever 
the computer needs to do before the "real" power is turned on.

The computer will automatically start booting as soon as the main part of the 
motherboard gets power, and the PSU won't send power to the main part of the 
motherboard until it gets a special hardware signal (the ground lead you 
mentioned) that tells it to do that.  The PSU doesn't care where the signal 
comes from.

My overall point was that you can't turn on the PSU (to boot the computer) with 
ACPI because ACPI only starts working after the computer (main part of the 
motherboard) already has power and has booted an OS.  You can't turn the PSU on 
with software (like ACPI) that requires the PSU to already be completely turned 
on, but you can turn the PSU off.  While there is some overlap between what the 
BIOS does and what ACPI does, they are two completely separate things.

> So yes, the motherboard does fire up some circuitry as soon as it
> gets power, but it doesn't boot per se.

Supplying a little bit of power to some peripheral circuitry, that may later 
enable the computer to start booting by sending a signal that completely turns 
on the power supply, is not booting up at all in my book.

> No, Bret, *you* are missing the point.

> This is not about the _motherboard_ getting power.

Yes, it is.  The computer will not boot until that happens, and that won't 
happen until the PSU gets an external signal from SOMEWHERE that tells it send 
power to the main part of the motherboard.  What "triggers" the boot process is 
application of power to the main part of the motherboard.  A modern PSU will 
not do it automatically, but either the soft power switch or some hardware that 
the BIOS controls can send the signal.

> This is a standard firmware setting on many PCs, both with BIOS and
> UEFI firmware. It is usually called “Restore on AC/Power Loss” or
> “AC Power Recovery”.

If it was "standard", then every computer would have it.  None of mine do, but 
it's good to know that it exists on some computers.  And again, it's a BIOS 
thing (BIOS in the "generic" sense) rather than an ACPI thing.

I think some of the confusion may have arisen when I was somewhat "loose" with 
my interchanging the terms computer, power supply, and motherboard.


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-14 Thread Liam Proven
On Thu, 13 Jan 2022 at 23:14, Bret Johnson  wrote:
>
> You all are missing the point.  As soon as the motherboard gets power, it 
> starts booting.  That is how it has always worked.

No, Bret, *you* are missing the point.

This is not about the _motherboard_ getting power. It is about the
_computer_ getting power: when mains electricity to the PSU is
interrupted and then later it comes back again. As in a power cut.

This is a standard firmware setting on many PCs, both with BIOS and
UEFI firmware. It is usually called “Restore on AC/Power Loss” or “AC
Power Recovery”.

Here is a description:

https://www.technewsworld.com/story/how-to-set-up-your-computer-to-auto-restart-after-a-power-outage-86034.html

Here is another:

https://www.wintips.org/setup-computer-to-auto-power-on-after-power-outage/

It mainly applies to desktop computers.

What it does is very simple. If the computer was on and running and
then mains power was lost, then if this firmware setting is on, then
when the power is restored, the PC will start immediately without the
power button being pressed.

If the setting is off, the PC will not turn on and someone needs to
press the button.

The setting does not usually apply to laptops because if their battery
is working, when external power is removed, nothing happens; the
computer just runs off battery.

What Ladislav Lacina was asking is if it is possible to alter this
firmware setting _in software_ by a program running on the PC.

As far as I know, no, this is not possible. It would generally be a
horrible security hole if it were possible.

From DOS, though, possibly yes. There were generic setup programs;
here is an example:
http://www.dosdays.co.uk/topics/bios.php

However, this was not a standard generic setting, so I doubt it would
be doable without a program specifically tailored to that motherboard.


-- 
Liam Proven ~ Profile: https://about.me/liamproven
Email: lpro...@cix.co.uk ~ gMail/gTalk/FB: lpro...@gmail.com
Twitter/LinkedIn: lproven ~ Skype: liamproven
UK: (+44) 7939-087884 ~ Czech [+ WhatsApp/Telegram/Signal]: (+420) 702-829-053


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-13 Thread Mercury Thirteen via Freedos-devel
Well, I may as well throw my two cents in here. :)

On computers using a standard ATX power supply, pin #9 on the connector 
provides power to the motherboard at all times as long as the PSU itself has AC 
wall power power coming in.

Modern motherboards use this "Standby" power to run small always-on power 
management circuitry (I believe this is integrated directly into the chipset 
these days) which monitors all sources of a "power on" signal, be it the power 
button on the case, or a LAN controller, or a built-in watchdog timer, or 
what-have you. When such a signal is received, this power management circuitry 
pulls pin #16 low to power up all the other voltage lines of the PSU, which 
fully turns on the computer.

Optionally, some BIOSes allow the user to choose whether or not to instantly 
power up when this pin begins outputting voltage (e.g. when wall power is 
restored).

So yes, the motherboard does fire up some circuitry as soon as it gets power, 
but it doesn't boot per se.

Sent with [ProtonMail](https://protonmail.com/) Secure Email.

‐‐‐ Original Message ‐‐‐

On Thursday, January 13th, 2022 at 5:12 PM, Bret Johnson bretj...@juno.com 
wrote:

> there is absolutely nothing complicated to have a
>
> "on power return, boot computer"
>
> option. it used to be the default.

You all are missing the point. As soon as the motherboard gets power, it starts 
booting. That is how it has always worked.

The problem is how to get the appropriate power to the motherboard in the first 
place. If you lose power to the motherboard, either because the power supply 
lost its external (wall) source or because something in the power supply went 
bad, the computer will boot when power is supplied to the motherboard again. 
The problem is, the BIOS and the ACPI are on the motherboard and need power in 
order to function, and they can't tell the power supply to turn on if the power 
supply is not already supplying power to them. It's a circular regress (or a 
"Catch 22").

There is no setting to tell the computer start booting when it first gets power 
-- it does that automatically and you can't disable that "feature". The problem 
is how to get the power to the motherboard in the first place, and you can't do 
that with software that doesn't do anything unless it already has power being 
supplied to it and the computer has already started booting.

Freedos-devel mailing list

Freedos-devel@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/freedos-devel___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-13 Thread Bret Johnson
> there is absolutely nothing complicated to have a
>
> "on power return, boot computer"
>
> option. it used to be the default.

You all are missing the point.  As soon as the motherboard gets power, it 
starts booting.  That is how it has always worked.

The problem is how to get the appropriate power to the motherboard in the first 
place.  If you lose power to the motherboard, either because the power supply 
lost its external (wall) source or because something in the power supply went 
bad, the computer will boot when power is supplied to the motherboard again.  
The problem is, the BIOS and the ACPI are on the motherboard and need power in 
order to function, and they can't tell the power supply to turn on if the power 
supply is not already supplying power to them.  It's a circular regress (or a 
"Catch 22").

There is no setting to tell the computer start booting when it first gets power 
-- it does that automatically and you can't disable that "feature".  The 
problem is how to get the power to the motherboard in the first place, and you 
can't do that with software that doesn't do anything unless it already has 
power being supplied to it and the computer has already started booting.


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-13 Thread Parodper

O 13/01/22 ás 19:52, tom ehlert escribiu:

There are all sorts of complications that can be added to the
scenario (like Uninterruptible Power Sources or "blade computers"
where you plug a "card with a computer on it" into an industrial
chassis of some sort), but for a "regular" computer the power supply
won't provide the power that the computer needs to start booting
without the two EXTERNAL, PHYSICAL inputs.


there is absolutely nothing complicated to have a

"on power return, boot computer"

option. it used to be the default.


Wait, that is an option? And here I was thinking my computer had a loose 
connection because it booted up when switching on the PSU.



___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-13 Thread tom ehlert
Bret you are right most of the times, but:


>> Is there a way via the ACPI\s API to tell ACPI to automatically power
>> on after power loss AND when the BIOS SETUP does not include such
>> setting?

> The short answer is no, that is not possible.

this option has been available for the last ~30 years. I have no idea
if that is related to ACPI, but was available forever as BIOS option.



> The point is, it takes two inputs to start a computer booting -- an
> external power source and a "power switch" of some sort.  Even on a
> computer that supports "Wake-On-LAN" (which can be booted through an
> Ethernet connection) there are still two inputs - an external power
> source and a "switch" (provided through the Ethernet port) to tell
> the computer to turn on.  But the "switch" always something physical
> that comes from outside the computer, not something inside and not
> something in software (like the BIOS or ACPI).

in any case, the BIOS is waiting for an event to happen to power the
computer up.

possibly on WAKEON-LAN event.

but at least the computer is semi-active.


and there is exactly nothing preventing the computer from "on power
up,  boot the machine in normal way".

it's just sloppy BIOS programmers.


> There are all sorts of complications that can be added to the
> scenario (like Uninterruptible Power Sources or "blade computers"
> where you plug a "card with a computer on it" into an industrial
> chassis of some sort), but for a "regular" computer the power supply
> won't provide the power that the computer needs to start booting
> without the two EXTERNAL, PHYSICAL inputs.

there is absolutely nothing complicated to have a

"on power return, boot computer"

option. it used to be the default.

Tom



___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-13 Thread Bret Johnson
> Is there a way via the ACPI\s API to tell ACPI to automatically power
> on after power loss AND when the BIOS SETUP does not include such
> setting?

The short answer is no, that is not possible.

The long answer is that what you're talking about really has nothing to do with 
ACPI and rather has to do with how power supplies work.

A power supply on a "regular" computer requires two inputs: an input power 
source (usually a plug that goes into a wall outlet) and a power switch of some 
sort.  On older computers, the switch was usually a big red toggle switch 
physically located on the power supply.  If the toggle switch was on when you 
plugged in the external power source, the outputs from the power supply would 
start working right away (supplying power to the motherboard and other computer 
components) and the computer would start booting.

On newer computers, the power supply doesn't have a big red toggle switch any 
more and things are "soft".  To turn on the power supply with a new computer, 
you must FIRST plug it into an external power source (usually a wall outlet) 
and THEN push a "soft" power button.  The power supply detects that you have 
pushed the button and starts sending output power to the motherboard and other 
components inside the computer chassis and the computer starts booting.

The point is, it takes two inputs to start a computer booting -- an external 
power source and a "power switch" of some sort.  Even on a computer that 
supports "Wake-On-LAN" (which can be booted through an Ethernet connection) 
there are still two inputs - an external power source and a "switch" (provided 
through the Ethernet port) to tell the computer to turn on.  But the "switch" 
always something physical that comes from outside the computer, not something 
inside and not something in software (like the BIOS or ACPI).

There are all sorts of complications that can be added to the scenario (like 
Uninterruptible Power Sources or "blade computers" where you plug a "card with 
a computer on it" into an industrial chassis of some sort), but for a "regular" 
computer the power supply won't provide the power that the computer needs to 
start booting without the two EXTERNAL, PHYSICAL inputs.


___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-13 Thread Jerome Shidel
Hi,

> On Jan 13, 2022, at 9:14 AM, Mercury Thirteen via Freedos-devel 
>  wrote:
> 
> This feature was nonstandard across various BIOS implementations, so it is 
> highly likely that if the BIOS does not support it via its built-in interface 
> (the "Press  to enter SETUP" prompt) it is probably entirely unavailable.
> 
> Just to be sure, I checked the CMOS Memory Map document 
>  in Jerome's excellent online 
> version of the Ralf Brown Interrupt List - the feature is not listed.
> 
> Sent with ProtonMail  Secure Email.

I didn’t see anything obvious when I looked either. Could be it was never 
documented prior to the last RBIL update. Or, like you said possibly never 
standardized. 

But after looking at Resume by Alarm 
 and Power Management 
, I was thinking maybe there 
is a trick. I wonder what would happen if you programmed it to “Resume” in the 
past. Would it refuse, clear it, wait for the clock to roll over or wake 
immediately. I suspect all of the above depending on the BIOS. Maybe if set 
everything to 0x, it would wake instantly. But, thats all just guesswork on 
my part. 

Jerome___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel


Re: [Freedos-devel] Fwd: ACPI auto power ON

2022-01-13 Thread Mercury Thirteen via Freedos-devel
This feature was nonstandard across various BIOS implementations, so it is 
highly likely that if the BIOS does not support it via its built-in interface 
(the "Press  to enter SETUP" prompt) it is probably entirely unavailable.

Just to be sure, I checked the [CMOS Memory Map 
document](https://fd.lod.bz/rbil/cmos/power/index.html) in Jerome's excellent 
online version of the Ralf Brown Interrupt List - the feature is not listed.

Sent with [ProtonMail](https://protonmail.com/) Secure Email.

‐‐‐ Original Message ‐‐‐
On Thursday, January 13th, 2022 at 4:47 AM, Ladislav Lacina  
wrote:

> Hello experts here!
> I am forwarding you a question abou ACPI interface. Although I am the author 
> of ACPITOOL I am not able to answer it.
> Thanks
> -- Původní e-mail --
> Od: retro devices 
> Komu: la...@seznam.cz
> Datum: 13. 1. 2022 0:36:10
> Předmět: ACPI auto power ON
>
>> Hi and thank you for your ACPITOOL. I decided to ask you because I cannot 
>> find the answer myself and you seem to be very experienced in ACPI 
>> programming under DOS.
>>
>> Is there a way via the ACPI\s API to tell ACPI to automatically power on 
>> after power loss AND when the BIOS SETUP does not include such setting?
>>
>> Kindest regards,
>> George___
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel