VirtualBox

Changeset 105045 in vbox for trunk/src/VBox/Devices/PC


Ignore:
Timestamp:
Jun 27, 2024 9:01:20 AM (10 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163663
Message:

Devices/ACPI/vbox-tpm.dsl: Implement the Physical Presence Interface (PPI) as required by Windows, bugref:10701

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/vbox-tpm.dsl

    r98103 r105045  
    55
    66/*
    7  * Copyright (C) 2021-2023 Oracle and/or its affiliates.
     7 * Copyright (C) 2021-2024 Oracle and/or its affiliates.
    88 *
    99 * This file is part of VirtualBox base platform packages, as
     
    2828DefinitionBlock ("SSDT.aml", "SSDT", 1, "VBOX  ", "VBOXTPMT", 2)
    2929{
     30    External(DBG, MethodObj, ,)
     31
    3032    Scope (\_SB)
    3133    {
     
    8991               Return (RES)
    9092            }
     93
     94            Method (TPFS, 1, Serialized)
     95            {
     96                If (LGreaterEqual(Arg0, 0x100))
     97                {
     98                    Return (Zero)
     99                }
     100
     101                OperationRegion (TPP1, SystemMemory, Add(0xFED45000, Arg0), One)
     102                Field (TPP1, ByteAcc, NoLock, Preserve)
     103                {
     104                    TPPF,   8
     105                }
     106
     107                Return (TPPF)
     108            }
     109
     110            /**
     111             *  Device-Specific Method
     112             */
     113            Method (_DSM, 4, Serialized)
     114            {
     115                /**
     116                 * The TPM Physical Presence Interface MMIO region.
     117                 */
     118                OperationRegion (TPMP, SystemMemory, 0xFED45100, 0x5A)
     119                Field (TPMP, AnyAcc, NoLock, Preserve)
     120                {
     121                    PPIN,   8,
     122                    PPIP,   32,
     123                    PPRP,   32,
     124                    PPRQ,   32,
     125                    PPRM,   32,
     126                    LPPR,   32
     127                }
     128
     129                Name (TPB2, Package (0x02)
     130                {
     131                    Zero,
     132                    Zero
     133                })
     134
     135                Name (TPB3, Package (0x03)
     136                {
     137                    Zero,
     138                    Zero,
     139                    Zero
     140                })
     141
     142                /**
     143                 * Physical Presence Interface Specification PPI.
     144                 */
     145                If (LEqual (Arg0, ToUUID("3dddfaa6-361b-4eb4-a424-8d10089d1653")))
     146                {
     147                    /**
     148                     * Standard _DSM query function.
     149                     */
     150                    If (LEqual (Arg2, Zero))
     151                    {
     152                        DBG("_DSM: Query\n")
     153                        Return (Buffer (0x02) { 0xFF, 0x01 })
     154                    }
     155
     156                    /**
     157                     * Query supported PPI revision.
     158                     *
     159                     * Result:
     160                     *    1.3 (string).
     161                     */
     162                    If (LEqual (Arg2, One))
     163                    {
     164                        DBG("_DSM: PPI Revision\n")
     165                        Return ("1.3")
     166                    }
     167
     168                    /**
     169                     * Submit TPM Operation Request to pre-OS environment.
     170                     *
     171                     * Input:
     172                     *     Package[0] - Operation value of the request
     173                     * Result:
     174                     *     - 0: Success
     175                     *     - 1: Operation value of the request not supported.
     176                     *     - 2: General failure
     177                     */
     178                    If (LEqual (Arg2, 0x02))
     179                    {
     180                        DBG("_DSM: Submit TPM Operation Request\n")
     181
     182                        Store(DerefOf(Index(Arg3, Zero)), Local0)
     183                        Store(TPFS(Local0), Local1)
     184                        If (LEqual(And(Local1, 0x07), Zero))
     185                        {
     186                            Return (One)
     187                        }
     188
     189                        Store(Local0, PPRQ)
     190                        Store(Zero, PPRM)
     191                        Return (Zero)
     192                    }
     193
     194                    /**
     195                     * Get Pending TPM Operation Requested by the OS.
     196                     *
     197                     * Result:
     198                     *     Package[0] - Function Return Code:
     199                     *         - 0: Success
     200                     *         - 1: General Failure
     201                     *     Package[1] - Pending operation requested by the OS:
     202                     *         -  0: None
     203                     *         - >0: Operation value of the pending request
     204                     *     Package[2] - Optional argument to pending operation requested by the OS:
     205                     *         -  0: None
     206                     *         - >0: Argument value of the pending request
     207                     */
     208                    If (LEqual (Arg2, 0x03))
     209                    {
     210                        DBG("_DSM: Get Pending TPM Operation Request\n")
     211
     212                        if (LEqual(Arg1, One))
     213                        {
     214                            Store(PPRQ, Index(TPB2, One))
     215                            Return (TPB2)
     216                        }
     217
     218                        if (LEqual(Arg1, 0x02))
     219                        {
     220                            Store(PPRQ, Index(TPB3, One))
     221                            Store(PPRM, Index(TPB3, 0x02))
     222                            Return (TPB3)
     223                        }
     224
     225                        Return (TPB3)
     226                    }
     227
     228                    /**
     229                     * Get Platform-Specific Action to Transition to Pre-OS Environment.
     230                     *
     231                     * Result:
     232                     *     - 0: None
     233                     *     - 1: Shutdown
     234                     *     - 2: Reboot
     235                     *     - 3: OS vendor specific
     236                     */
     237                    If (LEqual (Arg2, 0x04))
     238                    {
     239                        DBG("_DSM: Get Platform-Specific Action to Transition to Pre-OS Environment\n")
     240
     241                        Return (0x02)
     242                    }
     243
     244                    /**
     245                     * Return TPM Operation Response to OS Environment.
     246                     */
     247                    If (LEqual (Arg2, 0x05))
     248                    {
     249                        DBG("_DSM: Return TPM Operation Response to OS Environment\n")
     250
     251                        Store (LPPR, Index (TPB3, One))
     252                        Store (PPRP, Index (TPB3, 0x02))
     253                        Return (TPB3)
     254                    }
     255
     256                    /**
     257                     * Submit preferred user language - deprecated
     258                     *
     259                     * Result:
     260                     *     - 3: Not implemented
     261                     */
     262                    If (LEqual (Arg2, 0x06))
     263                    {
     264                        DBG("_DSM: Submit preferred user language\n")
     265
     266                        Return (0x03)
     267                    }
     268
     269                    /**
     270                     * Submit TPM Operation Request to Pre-OS Environment 2
     271                     */
     272                    If (LEqual (Arg2, 0x07))
     273                    {
     274                        DBG("_DSM: Submit TPM Operation Request 2\n")
     275
     276                        Store(DerefOf(Index(Arg3, Zero)), Local0)   /* Local0 = *Arg3[0] (Arg3 is a Package) */
     277                        Store(TPFS(Local0), Local1)                 /* Local1 = TPFS(Local0) */
     278                        Store(And(Local1, 0x07), Local1)            /* Local1 &= 0x7 */
     279                        If (LEqual(Local1, Zero))
     280                        {
     281                            Return (One)                            /* Operation not implemented */
     282                        }
     283
     284                        If (LEqual(Local1, 0x02))
     285                        {
     286                            Return (0x03)                           /* Operation blocked by current firmware settings */
     287                        }
     288
     289                        If (LEqual(Arg1, One))
     290                        {
     291                            Store(Local0, PPRQ)
     292                            Store(Zero,   PPRM)
     293                        }
     294
     295                        If (LEqual(Arg1, 0x02))
     296                        {
     297                            Store(DerefOf(Index(Arg3, One)), Local2) /* Local2 = *Arg3[1] (Arg3 is a Package) */
     298
     299                            Store(Local0, PPRQ)
     300                            Store(Local2, PPRM)
     301                        }
     302
     303                        Return (Zero)
     304                    }
     305
     306                    /**
     307                     * Get User Confirmation Status for Operation.
     308                     *
     309                     * Input is the operation value maybe needing user confirmation
     310                     * Result:
     311                     *     - 0: Not implemented
     312                     *     - 1: Firmware only
     313                     *     - 2: Blocked for OS by firmware configuration.
     314                     *     - 3: Allowed and physically present user required
     315                     *     - 4: Allowed and physically present user not required.
     316                     */
     317                    If (LEqual (Arg2, 0x08))
     318                    {
     319                        DBG("_DSM: Get user confirmation status for operation\n")
     320
     321                        Store(DerefOf(Index(Arg3, Zero)), Local0)
     322                        Store(TPFS(Local0), Local1)
     323
     324                        Return (And(Local1, 0x7))
     325                    }
     326
     327                    DBG("TPM_DSM: Unknown function\n")
     328                    Return (Buffer (One) { 0x00 })
     329                }
     330
     331                /**
     332                 * TCG Platform Reset Attack Mitigation Specification interface.
     333                 */
     334                If (LEqual (Arg0, ToUUID("376054ed-cc13-4675-901c-4756d7f2d45d")))
     335                {
     336                    /**
     337                     * Standard _DSM query function.
     338                     */
     339                    If (LEqual (Arg2, Zero))
     340                    {
     341                        Return (Buffer (One) { 0x03 })
     342                    }
     343
     344                    /**
     345                     * Set Memory Overwrite Request (MOR) bit to specified value.
     346                     */
     347                    If (LEqual (Arg2, One))
     348                    {
     349                        /* Memory is always zeroed on reset. */
     350                        Return (Zero)
     351                    }
     352
     353                    Return (Buffer (One) { 0x00 })
     354                }
     355
     356                Return (Buffer (One) { 0x00 })
     357            }
    91358        }
    92359    }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette