MdePkg: Add SIO related protocol/PPI definitions.
[mirror_edk2.git] / Include / Ppi / IsaHc.h
1 /** @file
2 This PPI opens or closes an I/O aperture in a ISA HOST controller.
3
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 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 @par Revision Reference:
14 This PPI is from PI Version 1.2.1.
15
16 **/
17
18 #ifndef __ISA_HC_PPI_H__
19 #define __ISA_HC_PPI_H__
20
21 #define EFI_ISA_HC_PPI_GUID \
22 { \
23 0x8d48bd70, 0xc8a3, 0x4c06, {0x90, 0x1b, 0x74, 0x79, 0x46, 0xaa, 0xc3, 0x58} \
24 }
25
26 typedef struct _EFI_ISA_HC_PPI EFI_ISA_HC_PPI;
27 typedef struct _EFI_ISA_HC_PPI *PEFI_ISA_HC_PPI;
28
29 /**
30 Open I/O aperture.
31
32 This function opens an I/O aperture in a ISA Host Controller for the I/O
33 addresses specified by IoAddress to IoAddress + IoLength - 1. It is possible
34 that more than one caller may be assigned to the same aperture.
35 It may be possible that a single hardware aperture may be used for more than
36 one device. This function tracks the number of times that each aperture is
37 referenced, and doesa not close the hardware aperture (via CloseIoAperture())
38 until there are no more references to it.
39
40 @param This A pointer to this instance of the EFI_ISA_HC_PPI.
41 @param IoAddress An unsigned integer that specifies the first byte of
42 the I/O space required.
43 @param IoLength An unsigned integer that specifies the number of
44 bytes of the I/O space required.
45 @param IoApertureHandle A pointer to the returned I/O aperture handle.
46 This value can be used on subsequent calls to CloseIoAperture().
47
48 @retval EFI_SUCCESS The I/O aperture was opened successfully.
49 @retval EFI_UNSUPPORTED The ISA Host Controller is a subtractive-decode controller.
50 @retval EFI_OUT_OF_RESOURCES There is no available I/O aperture.
51 **/
52 typedef
53 EFI_STATUS
54 (EFIAPI *EFI_PEI_ISA_HC_OPEN_IO) (
55 IN CONST EFI_ISA_HC_PPI *This,
56 IN UINT16 IoAddress,
57 IN UINT16 IoLength,
58 OUT UINT64 *IoApertureHandle
59 );
60
61 /**
62 Close I/O aperture.
63
64 This function closes a previously opened I/O aperture handle. If there are no
65 more I/O aperture handles that refer to the hardware I/O aperture resource,
66 then the hardware I/O aperture is closed.
67 It may be possible that a single hardware aperture may be used for more than
68 one device. This function tracks the number of times that each aperture is
69 referenced, and does not close the hardware aperture (via CloseIoAperture())
70 until there are no more references to it.
71
72 @param This A pointer to this instance of the EFI_ISA_HC_PPI.
73 @param IoApertureHandle The I/O aperture handle previously returned from a
74 call to OpenIoAperture().
75
76 @retval EFI_SUCCESS The I/O aperture was closed successfully.
77 **/
78 typedef
79 EFI_STATUS
80 (EFIAPI *EFI_PEI_ISA_HC_CLOSE_IO) (
81 IN CONST EFI_ISA_HC_PPI *This,
82 IN UINT64 IoApertureHandle
83 );
84
85 ///
86 /// This PPI provides functions for opening or closing an I/O aperture.
87 ///
88 struct _EFI_ISA_HC_PPI {
89 ///
90 /// An unsigned integer that specifies the version of the PPI structure.
91 ///
92 UINT32 Version;
93 ///
94 /// The address of the ISA/LPC Bridge device.
95 /// For PCI, this is the segment, bus, device and function of the a ISA/LPC
96 /// Bridge device.
97 ///
98 /// If bits 24-31 are 0, then the definition is:
99 /// Bits 0:2 - Function
100 /// Bits 3-7 - Device
101 /// Bits 8:15 - Bus
102 /// Bits 16-23 - Segment
103 /// Bits 24-31 - Bus Type
104 /// If bits 24-31 are 0xff, then the definition is platform-specific.
105 ///
106 UINT32 Address;
107 ///
108 /// Opens an aperture on a positive-decode ISA Host Controller.
109 ///
110 EFI_PEI_ISA_HC_OPEN_IO OpenIoAperture;
111 ///
112 /// Closes an aperture on a positive-decode ISA Host Controller.
113 ///
114 EFI_PEI_ISA_HC_CLOSE_IO CloseIoAperture;
115 };
116
117 extern EFI_GUID gEfiIsaHcPpiGuid;
118
119 #endif