]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/DxeSmbusLib/InternalSmbusLib.h
clean up the un-suitable ';' location when declaring the functions.
[mirror_edk2.git] / MdePkg / Library / DxeSmbusLib / InternalSmbusLib.h
1 /** @file
2 Internal header file for Smbus library.
3
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13
14 **/
15
16 #ifndef __INTERNAL_SMBUS_LIB_H_
17 #define __INTERNAL_SMBUS_LIB_H_
18
19
20 #include <PiDxe.h>
21
22 #include <Protocol/SmbusHc.h>
23
24 #include <Library/SmbusLib.h>
25 #include <Library/DebugLib.h>
26 #include <Library/UefiBootServicesTableLib.h>
27 #include <Library/BaseMemoryLib.h>
28
29 #include <IndustryStandard/SmBus.h>
30
31 #define SMBUS_LIB_SLAVE_ADDRESS(SmBusAddress) (((SmBusAddress) >> 1) & 0x7f)
32 #define SMBUS_LIB_COMMAND(SmBusAddress) (((SmBusAddress) >> 8) & 0xff)
33 #define SMBUS_LIB_LENGTH(SmBusAddress) (((SmBusAddress) >> 16) & 0x3f)
34 #define SMBUS_LIB_PEC(SmBusAddress) ((BOOLEAN) (((SmBusAddress) & SMBUS_LIB_PEC_BIT) != 0))
35 #define SMBUS_LIB_RESEARVED(SmBusAddress) ((SmBusAddress) & ~(((1 << 22) - 2) | SMBUS_LIB_PEC_BIT))
36
37 //
38 // Declaration for internal functions
39 //
40 /**
41 Executes an SMBus operation to an SMBus controller.
42
43 This function provides a standard way to execute Smbus script
44 as defined in the SmBus Specification. The data can either be of
45 the Length byte, word, or a block of data.
46
47 @param SmbusOperation Signifies which particular SMBus hardware protocol instance that it will use to
48 execute the SMBus transactions.
49 @param SmBusAddress Address that encodes the SMBUS Slave Address,
50 SMBUS Command, SMBUS Data Length, and PEC.
51 @param Length Signifies the number of bytes that this operation will do. The maximum number of
52 bytes can be revision specific and operation specific.
53 @param Buffer Contains the value of data to execute to the SMBus slave device. Not all operations
54 require this argument. The length of this buffer is identified by Length.
55 @param Status Return status for the executed command.
56 This is an optional parameter and may be NULL.
57
58 @return The actual number of bytes that are executed for this operation.
59
60 **/
61 UINTN
62 InternalSmBusExec (
63 IN EFI_SMBUS_OPERATION SmbusOperation,
64 IN UINTN SmBusAddress,
65 IN UINTN Length,
66 IN OUT VOID *Buffer,
67 OUT RETURN_STATUS *Status OPTIONAL
68 );
69
70 /**
71 The constructor function caches the pointer to Smbus protocol.
72
73 The constructor function locates Smbus protocol from protocol database.
74 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
75
76 @param ImageHandle The firmware allocated handle for the EFI image.
77 @param SystemTable A pointer to the EFI System Table.
78
79 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
80
81 **/
82 EFI_STATUS
83 EFIAPI
84 SmbusLibConstructor (
85 IN EFI_HANDLE ImageHandle,
86 IN EFI_SYSTEM_TABLE *SystemTable
87 );
88
89 #endif