public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* S3 wake restore operations, regarding S3IoLib and S3PciLib
@ 2018-01-16  0:01 Marvin H?user
  2018-01-30 17:26 ` Leif Lindholm
  0 siblings, 1 reply; 2+ messages in thread
From: Marvin H?user @ 2018-01-16  0:01 UTC (permalink / raw)
  To: edk2-devel@lists.01.org

Dear developers,

First off, I'm writing this mail for educational purposes, so I would be very thankful if I got a reply, though you will not miss anything if you skip it.

I was browsing several initialization codes of Intel platforms (the ones included in the main edk2 repository, as well as MinPlatformPkg from edk2-platforms), as well as recent imports of library code into MdePkg (S3IoLib and S3PciLib).
While checking out latter, I noticed that all functions, including 'And' and 'Or' operations, do not store the actual operations, but just the value that results from applying them to the register at the current time in execution.
While I checked out former, I noticed that actions are mixed (some operations using SaveMemWrite, which saves the entire register's value, some operations using SaveMemReadWrite, which saves the operations (and/or) involved).

Now, I do not have a lot of knowledge and/or experience with low-level x86 initialization. I was checking out the PantherPoint PCH specification, trying to find a clue on when to use which operation precisely. Every register (be it a MMIO or PCI register) I was looking at (with a few exceptions, as I have just noticed), had a clear, defined value upon power-up. I'm also certain that there are no conditional executions possible by the BootScript table, which makes me think that storing the and/or operations and storing just the register values is basically achieving the same state in the end.

I hope for your experience regarding the following questions:

  1.  Is my quite poorly researched assumption that there is no actual difference between these two types of operation (for registers with a clearly defined default value) usually/always correct (for x86 platforms)?
     *   If they are, why are there different opcodes in the BootScript table? To support platforms for which that is not the case?
     *   If they are not, how could one be sure on what to use? Which specification or datasheet contains the necessary information? Is S3*Lib safe to use without explicate knowledge?
     *   If they are not, can there be a drawback to always storing the and/or operations to apply, such as applying the operations on a random register value (undefined default value)?

                                                               i.      If there is no drawback, why are the S3*Libs using the method of storing the final value rather than the operation?

  1.  Just after composing the questions, I noticed two registers that indeed do not have a defined power-up value. In that case, I wonder whether it is unsafe to run a complete write, as it overwrites whatever is there (it's unpredictable, I suppose), or whether it is unsafe to use the and/or operations, as there may be unwanted bits set due to the undefined value.

Thank you in advance for your time, if you have read till here!

Best regards,
Marvin.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: S3 wake restore operations, regarding S3IoLib and S3PciLib
  2018-01-16  0:01 S3 wake restore operations, regarding S3IoLib and S3PciLib Marvin H?user
@ 2018-01-30 17:26 ` Leif Lindholm
  0 siblings, 0 replies; 2+ messages in thread
From: Leif Lindholm @ 2018-01-30 17:26 UTC (permalink / raw)
  To: Marvin H?user; +Cc: edk2-devel@lists.01.org, Liming Gao, Michael D Kinney

Not my area of expertise.

Liming, Mike?

On Tue, Jan 16, 2018 at 12:01:51AM +0000, Marvin H?user wrote:
> Dear developers,
> 
> First off, I'm writing this mail for educational purposes, so I
> would be very thankful if I got a reply, though you will not miss
> anything if you skip it.
> 
> I was browsing several initialization codes of Intel platforms (the
> ones included in the main edk2 repository, as well as MinPlatformPkg
> from edk2-platforms), as well as recent imports of library code into
> MdePkg (S3IoLib and S3PciLib).
> While checking out latter, I noticed that all functions, including
> 'And' and 'Or' operations, do not store the actual operations, but
> just the value that results from applying them to the register at
> the current time in execution.
> While I checked out former, I noticed that actions are mixed (some
> operations using SaveMemWrite, which saves the entire register's
> value, some operations using SaveMemReadWrite, which saves the
> operations (and/or) involved).
> 
> Now, I do not have a lot of knowledge and/or experience with
> low-level x86 initialization. I was checking out the PantherPoint
> PCH specification, trying to find a clue on when to use which
> operation precisely. Every register (be it a MMIO or PCI register) I
> was looking at (with a few exceptions, as I have just noticed), had
> a clear, defined value upon power-up. I'm also certain that there
> are no conditional executions possible by the BootScript table,
> which makes me think that storing the and/or operations and storing
> just the register values is basically achieving the same state in
> the end.
> 
> I hope for your experience regarding the following questions:
> 
>   1.  Is my quite poorly researched assumption that there is no
>       actual difference between these two types of operation (for
>       registers with a clearly defined default value) usually/always
>       correct (for x86 platforms)?
>      *   If they are, why are there different opcodes in the
>          BootScript table? To support platforms for which that is
>          not the case?
>      *   If they are not, how could one be sure on what to use?
>          Which specification or datasheet contains the necessary
>          information? Is S3*Lib safe to use without explicate
>          knowledge?
>      *   If they are not, can there be a drawback to always storing
>          the and/or operations to apply, such as applying the
>          operations on a random register value (undefined default
>          value)?
> 
>                                                                i.      If there is no drawback, why are the S3*Libs using the method of storing the final value rather than the operation?
> 
>   1.  Just after composing the questions, I noticed two registers
>       that indeed do not have a defined power-up value. In that
>       case, I wonder whether it is unsafe to run a complete write,
>       as it overwrites whatever is there (it's unpredictable, I
>       suppose), or whether it is unsafe to use the and/or
>       operations, as there may be unwanted bits set due to the
>       undefined value.
> 
> Thank you in advance for your time, if you have read till here!
> 
> Best regards,
> Marvin.
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-30 17:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-16  0:01 S3 wake restore operations, regarding S3IoLib and S3PciLib Marvin H?user
2018-01-30 17:26 ` Leif Lindholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox