public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Marvin H?user <Marvin.Haeuser@outlook.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: S3 wake restore operations, regarding S3IoLib and S3PciLib
Date: Tue, 16 Jan 2018 00:01:51 +0000	[thread overview]
Message-ID: <AM4PR06MB1491EC4C5AC62EB5102B016680EA0@AM4PR06MB1491.eurprd06.prod.outlook.com> (raw)

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.


             reply	other threads:[~2018-01-15 23:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16  0:01 Marvin H?user [this message]
2018-01-30 17:26 ` S3 wake restore operations, regarding S3IoLib and S3PciLib Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM4PR06MB1491EC4C5AC62EB5102B016680EA0@AM4PR06MB1491.eurprd06.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox