summaryrefslogtreecommitdiff
path: root/Core/Protocol/TianoDecompress.h
blob: de5cb54ff6c88475ef701aa82f84483a27d77772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*++

Copyright (c) 2004, Intel Corporation                                                         
All rights reserved. This program and the accompanying materials                          
are licensed and made available under the terms and conditions of the BSD License         
which accompanies this distribution.  The full text of the license may be found at        
http://opensource.org/licenses/bsd-license.php                                            
                                                                                          
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             

Module Name:

  TianoDecompress.h
    
Abstract:

  The Tiano Decompress Protocol Interface

--*/

#ifndef _TIANO_DECOMPRESS_H_
#define _TIANO_DECOMPRESS_H_
#include <EFI.h>

#define EFI_TIANO_DECOMPRESS_PROTOCOL_GUID  \
  { 0xe84cf29c, 0x191f, 0x4eae, 0x96, 0xe1, 0xf4, 0x6a, 0xec, 0xea, 0xea, 0x0b }

EFI_FORWARD_DECLARATION (EFI_TIANO_DECOMPRESS_PROTOCOL);

typedef
EFI_STATUS
(EFIAPI *EFI_TIANO_DECOMPRESS_GET_INFO) (
  IN EFI_TIANO_DECOMPRESS_PROTOCOL  *This,
  IN   VOID                                   *Source,
  IN   UINT32                                 SourceSize,
  OUT  UINT32                                 *DestinationSize,
  OUT  UINT32                                 *ScratchSize
  );
/*++

Routine Description:

  The GetInfo() function retrieves the size of the uncompressed buffer 
  and the temporary scratch buffer required to decompress the buffer 
  specified by Source and SourceSize.  If the size of the uncompressed
  buffer or the size of the scratch buffer cannot be determined from 
  the compressed data specified by Source and SourceData, then 
  EFI_INVALID_PARAMETER is returned.  Otherwise, the size of the uncompressed
  buffer is returned in DestinationSize, the size of the scratch buffer is 
  returned in ScratchSize, and EFI_SUCCESS is returned.
  
  The GetInfo() function does not have scratch buffer available to perform 
  a thorough checking of the validity of the source data. It just retrieves
  the 'Original Size' field from the beginning bytes of the source data and
  output it as DestinationSize.  And ScratchSize is specific to the decompression
  implementation.

Arguments:

  This            - The protocol instance pointer
  Source          - The source buffer containing the compressed data.
  SourceSize      - The size, in bytes, of source buffer.
  DestinationSize - A pointer to the size, in bytes, of the uncompressed buffer
                    that will be generated when the compressed buffer specified 
                    by Source and SourceSize is decompressed.
  ScratchSize     - A pointer to the size, in bytes, of the scratch buffer that 
                    is required to decompress the compressed buffer specified by
                    Source and SourceSize.

Returns:
  EFI_SUCCESS     - The size of the uncompressed data was returned in DestinationSize
                    and the size of the scratch buffer was returned in ScratchSize.
  EFI_INVALID_PARAMETER - The size of the uncompressed data or the size of the scratch
                  buffer cannot be determined from the compressed data specified by 
                  Source and SourceData.

--*/


typedef
EFI_STATUS
(EFIAPI *EFI_TIANO_DECOMPRESS_DECOMPRESS) (
  IN EFI_TIANO_DECOMPRESS_PROTOCOL  *This,
  IN     VOID*                                  Source,
  IN     UINT32                                 SourceSize,
  IN OUT VOID*                                  Destination,
  IN     UINT32                                 DestinationSize,
  IN OUT VOID*                                  Scratch,
  IN     UINT32                                 ScratchSize
  );
/*++

Routine Description:

  The Decompress() function extracts decompressed data to its original form.
  
  This protocol is designed so that the decompression algorithm can be 
  implemented without using any memory services.  As a result, the 
  Decompress() function is not allowed to call AllocatePool() or 
  AllocatePages() in its implementation.  It is the caller's responsibility 
  to allocate and free the Destination and Scratch buffers.
  
  If the compressed source data specified by Source and SourceSize is 
  sucessfully decompressed into Destination, then EFI_SUCCESS is returned.  
  If the compressed source data specified by Source and SourceSize is not in 
  a valid compressed data format, then EFI_INVALID_PARAMETER is returned.

Arguments:

  This            - The protocol instance pointer
  Source          - The source buffer containing the compressed data.
  SourceSize      - The size of source data.
  Destination     - On output, the destination buffer that contains 
                    the uncompressed data.
  DestinationSize - The size of destination buffer. The size of destination
                    buffer needed is obtained from GetInfo().
  Scratch         - A temporary scratch buffer that is used to perform the 
                    decompression.
  ScratchSize     - The size of scratch buffer. The size of scratch buffer needed
                    is obtained from GetInfo().

Returns:

  EFI_SUCCESS     - Decompression completed successfully, and the uncompressed 
                    buffer is returned in Destination.
  EFI_INVALID_PARAMETER 
                  - The source buffer specified by Source and SourceSize is 
                    corrupted (not in a valid compressed format).

--*/

typedef struct _EFI_TIANO_DECOMPRESS_PROTOCOL {
  EFI_TIANO_DECOMPRESS_GET_INFO    GetInfo;
  EFI_TIANO_DECOMPRESS_DECOMPRESS  Decompress;
} EFI_TIANO_DECOMPRESS_PROTOCOL;

GUID_VARIABLE_DECLARATION(gEfiTianoDecompressProtocolGuid, EFI_TIANO_DECOMPRESS_PROTOCOL_GUID);
#endif