Subject: [kazumasa.kawai@dme.toshiba.co.jp: External Interface for Hibernation Utility]
To: None <port-i386@netbsd.org>
From: Soren S. Jorvang <soren@wasabisystems.com>
List: port-i386
Date: 01/26/2001 09:20:18
--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii

FYI.

He okay'ed posting this.

----- Forwarded message from Kazumasa Kawai <kazumasa.kawai@dme.toshiba.co.jp> -----

Date: Thu, 25 Jan 2001 16:45:23 +0900
From: Kazumasa Kawai <kazumasa.kawai@dme.toshiba.co.jp>
To: "Soren S. Jorvang" <soren@wheel.dk>,
        Jonathan Buzzard <jonathan@buzzard.org.uk>
Cc: linux-support@toshiba-dme.co.jp
Subject: External Interface for Hibernation Utility

Dear Soren and Jonathan,

  I now have a document which explains about hibernation, specifically.
  I hope this helps.  Please feel free to contact me if there is any
questions or comments regarding this matter.

Best regards,

----------------------------------------------------------------------
Dear

Thank you for your request.
Attached please find the information you have requested.
Please read the notice below before using the file.

It would be greatly appreciated if you will send your achievement 
resulted by using the document.  We will be happy to provide you 
with our resource such as web, ftp and mailing list when introducing
your achievement.
Please let us know if you have any questions.

Toshiba Digital Media Engineering Corporation
Sales & Marketing  Linux Support Desk
linux-support@toshiba-dme.co.jp
-----------------------------------------------------------------------


    PLEASE READ THIS INTELLECTUAL PROPERTY DISCLAIMER CAREFULLY BEFORE 
USING THE TOSHIBA TECHNICAL INFORMATION AS ATTACHED.
    BY USING THE TOSHIBA TECHNICAL INFORMATION, YOU ARE AGREEING TO BE 
BOUND BY ALL OF THE TERMS OF THIS INTELLECTUAL PROPERTY DISCLAIMER.
    IF YOU DO NOT AGREE TO THE TERMS OF THIS INTELLECTUAL PROPERTY 
DISCLAIMER, PROMPTLY RETURN THE ATTACHED TOSHIBA TECHNICAL INFORMATION.

                 Copyright (C) 1999, Toshiba Corp. All rights reserved.


                    INTELLECTUAL PROPERTY DISCLAIMER

    NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, OF ANY 
INTELLECTUAL PROPERTY RIGHTS OF TOSHIBA IS GRANTED OR INTENDED HEREBY.  
NOTWITHSTANDING FORGOING, TOSHIBA WILL NOT MAKE ANY CLAIM BASED ON THE 
INTELLECTUAL PROPERTY RIGHTS AGAINST SOFTWARE FOR LINUX DEVELOPED USING 
TOSHIBA TECHNICAL INFORMATION, PROVIDED THAT SUCH SOFTWARE IS USED FOR 
OR DISTRIBUTED WITH LINUX FOR EXECUTION ON TOSHIABA COMPUTER PRODUCTS.

    TOSHIBA DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT 
OF PROPRIETARY RIGHTS RELATING TO IMPLEMENTATION OF TOSHIBA TECHNICAL 
INFORMATION.  TOSHIBA DOES NOT WARRANT OR REPRESENT THAT SUCH 
IMPLEMENTATION(S) WILL NOT INFRINGE SUCH RIGHTS.

    TOSHIBA TECHNICAL INFORMATION IS PROVIDED "AS IS" WITH NO WARRNTIES 
WHATSOEVER INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR ANY 
PARTICULAR PURPOSE.

----- End forwarded message -----


-- 
Soren

--tKW2IUtsqtDRztdT
Content-Type: text/plain
Content-Description: toshiber-e.txt
Content-Disposition: attachment; filename="toshiber-e.01986b.txt"
Content-Transfer-Encoding: quoted-printable



     * External Interface for Hibernation Utility


   1. The structure of hibernation file


The order in creating Hibernation File.

- Create a file named [TOSHIBER.DAT] in the root directory of boot
drive (drive C). Then create file attributes as follows: [system file +
hidden file + read-only file + archive]

- Hibernation File must be made within consecutive area.

- Header area should be 1024 byte

- Data area must be enough  for "BIOS information size" + "virtual
memory size" + "VRAM size"

-  "bios information size", "virtual memory size" and
"VRAM size" are tracked in BIOS interface.

+---------------------------+-----------------------------------------+
|           Size            |                 Purpose                 |
+---------------------------+-----------------------------------------+
| File Header Size (fig1.2) |(a) File Header (ID and etc)             |
+---------------------------+-----------------------------------------+
| Differs by type           |(b) Data area                            |
+---------------------------+-----------------------------------------+
                                                         (fig1.1)

  (a) Format of File Header is as follows: (fig1.2)

+--------+------------- +---------------------------------------------+
| Offset |    Size      |                   Purpose                   |
+--------+--------------+---------------------------------------------+
| 00h    |  12 byte     | String   "TOSHIBER.DAT"            (*1)     |
+--------+--------------+---------------------------------------------+
| 0Ch    |  20 byte     | Reserve                            (*2)     |
+--------+--------------+---------------------------------------------+
| 20h    |  2 word      | Staring  Address of the File  (LBA type)    |
+--------+--------------+---------------------------------------------+
| 24h    |  2 word      | Header Size of the file (unit:byte)         |
+--------+--------------+---------------------------------------------+
| 28h    |  2 word      | Starting address of data area (LBA type)    |
+--------+--------------+---------------------------------------------+
| eCh    |  2 word      | Data Area Size  (unit:byte)                 |
+--------+--------------+---------------------------------------------+
| 30h    |  (*2)        | Reserve                            (*3)     |
|        |              |(work area for file creating utility use)    |
+--------+--------------+---------------------------------------------+

(*1) The first 32 byte is file ID.  The reserved area of ID is used by
file creating utility.=20

(*2) Size of reserved area =3D File Header Size - 48 byte

(*3) Reserved section is the area for file creating utility to use.




   2. How to activate Hibernation

The Hibernation Utility checks the Hibernation File and reports it to
BIOS.  It runs by the following order:

- During startup time, search the Hibernation File, [TOSHIBER.DAT].

- If the Hibernation File is not found,=20
  if file error is found (file ID check),=20
  or if the data area is too small, error message will be displayed.

- If [TOSHIBER.DAT] is normal, it retrieves the physical starting
  address of the file from the header information and reports it to BIOS.


- If it is (non ACPI), set the BIOS setting to "Hibernation
  authorization mode".
 =20
  (1) Change the setting to PnP_OS_ACTIVE

  (2) Set the Hibernation File Address

  (3) Set the Hibernation Mode

     (1) Change the setting to PnP_OS_ACTIVE
         Refer to "Plug and Play BIOS Specification, Version 1.0A
         (May 5, 1994) 4.6.2 Function 4 - Send Message"
         http://www.microsoft.com/hwdev/respec/pnpspecs.htm

     (2) Set the Hibernation File Address
         Set the File Header Physical Address (from the header
         information of Hibernation File) in TOSHIBA Hardware
         Configuration Interface (2.1)

     (3) Set the Hibernation Mode
         In TOSHIBA Hardware Configuration Interface (2.2)



Boot TOSHIBA Hardware Configuration Interface (2.1&2.2) by the following
calling interface.

  1) INT15h Interface
        boot with INT 15h


 *Sample Code (1) INT 15h Interface*
+----------------------------------------+
|                                        |
|             MOV  AX,44FFh              |
|             MOV  BX,xxxxh              |
|             MOV  CX,xxxxh              |
|             INT  15h                   |
|             JC   ERROR                 |
|                                        |
|        ;OK                             |
|                                        |
|            ----code-----               |
|                                        |
|                                        |
|       ERROR:                           |
|                                        |
|             ----code----               |
+----------------------------------------+


   2) Protect Mode Interface
       Set AH=3DFFH, AL=3DCoh and boot with OUT B2H, AL

    Sample Code of the assembler is as follows:
 *Sample Code (2) Protect Mode Interface*
+-----------------------------------------------------------------------+
| MOV   BX,002Eh      ; Setting hibernation file address  function code |
| MOV   ECX,xxxxxxxxh ;address                                          |
| MOV   AH,FFh                                                          |
| CALL  PROTECT_MODE_IF                                                 |
| JC    ERROR                                                           |
|                                                                       |
| ----- code ---                                                        |
|                                                                       |
| ERROR:                                                                |
|                                                                       |
| ---- code -----                                                       |
|                                                                       |
| PROTECT_MODE_IF:                                                      |
|                                                                       |
|      PUSHF                                                            |
|      CLI                                                              |
|      MOV     AL,0C0H                                                  |
|      OUT     0B2h,AL                                                  |
|                                                                       |
| @@REPEAT=1B$B!'=1B(B                                                     =
       |
|      CMP=1B$B!!=1B(BAH,90h                                               =
       |
|      JAE=1B$B!!=1B(B@@REPEAT                                             =
       |
|           TEST=1B$B!!=1B(BAH,AH                                          =
       |
|           JZ=1B$B!!=1B(B@@OK                                             =
       |
|         ;error                                                        |
|           POPF                                                        |
|           STC                                                         |
|           RET                                                         |
| @@OK=1B$B!'=1B(B                                                         =
       |
|         ;normal return                                                |
|          POPF                                                         |
|          CLC                                                          |
|          RET                                                          |
|                                                                       |
+-----------------------------------------------------------------------+


   2.1) Setting hibernation file address

         Function=1B$B!'=1B(BSets the address for hibernation data file.

I/ORegister specifications:

          (1)  Input registers

               Int15h Interface
                    AH =3D44h
                    AL =3DFFh
               ProtectMode Interface
                   AH=1B$B!a=1B(BFFh
                   AL=1B$B!a=1B(BC0h
               BX =3D002Eh =1B$B!D=1B(B hibernation file address
               ECX =3Daddress

          (2)  Output registers

               =1B$B!&=1B(BWhen the function ends normally
                   AH =3D00h
                   CF =3D0
               =1B$B!&=1B(BWhen an error is encountered
                   AH =3D80h =1B$B!D=1B(B Subfunction error, or function no=
t=20
                              supported by the system.
                   CF =3D1

          Function details=1B$B!'=1B(BThis function sets the file address=
=20
                            (LBA) for hibernation.

------------------------------------------------------------------------


   2.2)  Setting power-up mode

           Function: Sets the power-up mode (without changing the CMOS)
          =20
I/O register specifications=1B$B!'=1B(B

          (1)  Input registers
              =20
               Int15h Interface=20
                    AH =3D44h
                    AL =3DFFh
               ProtectMode Interface
                    AH=1B$B!a=1B(BFFh
                    AL=1B$B!a=1B(BC0h
               BX =3D0048h =1B$B!D=1B(B power-up mode
               CX =3D0000h =1B$B!D=1B(B Boot
                   0001h =1B$B!D=1B(B Resume
                   0002h =1B$B!D=1B(B Hibernation

           (2)  Output registers

                =1B$B!&=1B(BWhen the function ends normally
                    AH =3D00h
                    CF =3D0

                =1B$B!&=1B(BWhen an error is encountered
                    AH =3D80h =1B$B!D=1B(B Subfunction error, or function=
=20
                               not supported by the system.
                       =1B$B!a=1B(B83h =1B$B!D=1B(B Input data error
                    CF =3D1
                      =20
           Function details=1B$B!'=1B(B
              This function sets the power-up mode. The difference=20
              between this function and SCI function (0100h) is settings
              for the CMOS.
              This function doesn't change the CMOS value.
              =20

------------------------------------------------------------------------

--tKW2IUtsqtDRztdT--