VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiSmbusLibSmbus2Ppi/PeiSmbusLib.c@ 107675

最後變更 在這個檔案從107675是 99404,由 vboxsync 提交於 2 年 前

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.8 KB
 
1/** @file
2Implementation of SmBusLib class library for PEI phase.
3
4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5SPDX-License-Identifier: BSD-2-Clause-Patent
6
7**/
8
9#include "InternalSmbusLib.h"
10
11/**
12 Gets Smbus PPIs.
13
14 This internal function retrieves Smbus PPI from PPI database.
15
16 @param VOID
17
18 @return The pointer to Smbus PPI.
19
20**/
21EFI_PEI_SMBUS2_PPI *
22InternalGetSmbusPpi (
23 VOID
24 )
25{
26 EFI_STATUS Status;
27 EFI_PEI_SMBUS2_PPI *SmbusPpi;
28
29 Status = PeiServicesLocatePpi (&gEfiPeiSmbus2PpiGuid, 0, NULL, (VOID **)&SmbusPpi);
30 ASSERT_EFI_ERROR (Status);
31 ASSERT (SmbusPpi != NULL);
32
33 return SmbusPpi;
34}
35
36/**
37 Executes an SMBus operation to an SMBus controller.
38
39 This function provides a standard way to execute Smbus script
40 as defined in the SmBus Specification. The data can either be of
41 the Length byte, word, or a block of data.
42
43 @param SmbusOperation Signifies which particular SMBus hardware protocol instance
44 that it will use to execute the SMBus transactions.
45 @param SmBusAddress The address that encodes the SMBUS Slave Address,
46 SMBUS Command, SMBUS Data Length, and PEC.
47 @param Length Signifies the number of bytes that this operation will
48 do. The maximum number of bytes can be revision specific
49 and operation specific.
50 @param Buffer Contains the value of data to execute to the SMBus slave
51 device. Not all operations require this argument. The
52 length of this buffer is identified by Length.
53 @param Status Return status for the executed command.
54 This is an optional parameter and may be NULL.
55
56 @return The actual number of bytes that are executed for this operation.
57
58**/
59UINTN
60InternalSmBusExec (
61 IN EFI_SMBUS_OPERATION SmbusOperation,
62 IN UINTN SmBusAddress,
63 IN UINTN Length,
64 IN OUT VOID *Buffer,
65 OUT RETURN_STATUS *Status OPTIONAL
66 )
67{
68 EFI_PEI_SMBUS2_PPI *SmbusPpi;
69 RETURN_STATUS ReturnStatus;
70 EFI_SMBUS_DEVICE_ADDRESS SmbusDeviceAddress;
71
72 SmbusPpi = InternalGetSmbusPpi ();
73 SmbusDeviceAddress.SmbusDeviceAddress = SMBUS_LIB_SLAVE_ADDRESS (SmBusAddress);
74
75 ReturnStatus = SmbusPpi->Execute (
76 SmbusPpi,
77 SmbusDeviceAddress,
78 SMBUS_LIB_COMMAND (SmBusAddress),
79 SmbusOperation,
80 SMBUS_LIB_PEC (SmBusAddress),
81 &Length,
82 Buffer
83 );
84 if (Status != NULL) {
85 *Status = ReturnStatus;
86 }
87
88 return Length;
89}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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