1 /*++
2 
3   Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
4 
5 
6   This program and the accompanying materials are licensed and made available under
7 
8   the terms and conditions of the BSD License that accompanies this distribution.
9 
10   The full text of the license may be found at
11 
12   http://opensource.org/licenses/bsd-license.php.
13 
14 
15 
16   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
17 
18   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 
20 
21 
22 
23 Module Name:
24 
25     LpcDriver.h
26 
27 Abstract:
28 
29     EFI Lpc Driver for a Generic PC Platform
30 
31 
32 
33 --*/
34 
35 #ifndef _LPC_DRIVER_H
36 #define _LPC_DRIVER_H
37 
38  #include "LpcSio.h"
39  #include "LpcIsaAcpi.h"
40 
41 #include "Protocol/IsaAcpi.h"
42 #include "Protocol/PciIo.h"
43 #include "Protocol/DriverBinding.h"
44 #include "Library/UefiBootServicesTableLib.h"
45 #include "IsaAcpiDxe/PcatIsaAcpi.h"
46 #include "IndustryStandard/Pci22.h"
47 #include "Protocol/LpcWpce791Policy.h"
48 
49 #include <Library/DebugLib.h>
50 
51 #define ICH_LPC_BRIDGE_BUS_DEV_FUNC 0x1F0000
52 
53 //
54 // LPC device private data structure
55 //
56 //#define LPC_DEV_SIGNATURE 'W87X'
57 #define LPC_DEV_SIGNATURE SIGNATURE_32('X', '7', '8', 'W') //'W87X'
58 #define EFI_WPCE791_PS2_KEYBOARD_ENABLE       0x01
59 #define EFI_WPCE791_PS2_KEYBOARD_DISABLE      0x00
60 
61 #define EFI_WPCE791_PS2_MOUSE_ENABLE       0x01
62 #define EFI_WPCE791_PS2_MOUSE_DISABLE      0x00
63 
64 
65 
66 typedef struct {
67   UINTN                 Signature;
68   EFI_HANDLE            Handle;
69   EFI_ISA_ACPI_PROTOCOL IsaAcpi;
70   EFI_PCI_IO_PROTOCOL   *PciIo;
71 
72 } LPC_DEV;
73 
74 #define LPC_ISA_ACPI_FROM_THIS(a) BASE_CR (a, LPC_DEV, IsaAcpi)
75 
76 //
77 // Driver entry point
78 //
79 EFI_STATUS
80 EFIAPI
81 LpcDriverEntryPoint (
82   IN EFI_HANDLE           ImageHandle,
83   IN EFI_SYSTEM_TABLE     *SystemTable
84   );
85 
86 //
87 // Prototypes for Driver model protocol interface
88 //
89 EFI_STATUS
90 EFIAPI
91 LpcDriverSupported (
92   IN EFI_DRIVER_BINDING_PROTOCOL    *This,
93   IN EFI_HANDLE                     Controller,
94   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath
95   );
96 
97 EFI_STATUS
98 EFIAPI
99 LpcDriverStart (
100   IN EFI_DRIVER_BINDING_PROTOCOL    *This,
101   IN EFI_HANDLE                     Controller,
102   IN EFI_DEVICE_PATH_PROTOCOL       *RemainingDevicePath
103   );
104 
105 EFI_STATUS
106 EFIAPI
107 LpcDriverStop (
108   IN  EFI_DRIVER_BINDING_PROTOCOL    *This,
109   IN  EFI_HANDLE                     Controller,
110   IN  UINTN                          NumberOfChildren,
111   IN  EFI_HANDLE                     *ChildHandleBuffer
112   );
113 
114 VOID
115 LpcIoRead8 (
116   IN  UINT16  Port,
117   OUT UINT8   *Data
118   );
119 
120 VOID
121 LpcIoWrite8 (
122   IN  UINT16  Port,
123   IN  UINT8   Data
124   );
125 
126 #endif
127