1f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin/** @file
2f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  Header containing the structure specific to the Silicon Image I3132 Sata PCI card
3f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*
4f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
5f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*
6f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  This program and the accompanying materials
7f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  are licensed and made available under the terms and conditions of the BSD License
8f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  which accompanies this distribution.  The full text of the license may be found at
9f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  http://opensource.org/licenses/bsd-license.php
10f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*
11f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin*
14f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin**/
15f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
16f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#ifndef __SATASII3132_H
17f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define __SATASII3132_H
18f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
19f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <PiDxe.h>
20f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
21f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <Protocol/AtaPassThru.h>
22f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <Protocol/PciIo.h>
23f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
24f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <Library/UefiLib.h>
25f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <Library/DebugLib.h>
26f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <Library/PcdLib.h>
27f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <Library/BaseMemoryLib.h>
28f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <Library/UefiBootServicesTableLib.h>
29f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
30f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#include <IndustryStandard/Pci.h>
31f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
32f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_SII3132_DEVICE_ID      0x3132
33f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_SII3132_VENDOR_ID      0x1095
34f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
35f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_SIGNATURE_PMP      0x96690101
36f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_SIGNATURE_ATAPI    0xEB140101
37f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_SIGNATURE_ATA      0x00000101
38f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
39f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin/*
40f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin * Silicon Image SiI3132 Registers
41f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin */
42f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_GLOBAL_CONTROL_REG              0x40
43f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_GLOBAL_FLASHADDR_REG            0x70
44f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
45f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_STATUS_REG                 0x1000
46f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CONTROLSET_REG             0x1000
47f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CONTROLCLEAR_REG           0x1004
48f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_INTSTATUS_REG              0x1008
49f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_ENABLEINT_REG              0x1010
50f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_INTCLEAR_REG               0x1014
51f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_32BITACTIVADDR_REG         0x101C
52f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CMDEXECFIFO_REG            0x1020
53f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CMDERROR_REG               0x1024
54f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_ERRCOUNTDECODE             0x1040
55f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_ERRCOUNTCRC                0x1044
56f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_ERRCOUNTHANDSHAKE          0x1048
57f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_SLOTSTATUS_REG             0x1800
58f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CMDACTIV_REG               0x1C00
59f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_SSTATUS_REG                0x1F04
60f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
61f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CONTROL_RESET              (1 << 0)
62f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_DEVICE_RESET               (1 << 1)
63f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CONTROL_INT                (1 << 2)
64f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_CONTROL_32BITACTIVATION    (1 << 10)
65f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
66f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_STATUS_PORTREADY           0x80000000
67f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
68f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_INT_CMDCOMPL               (1 << 0)
69f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_INT_CMDERR                 (1 << 1)
70f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SII3132_PORT_INT_PORTRDY                (1 << 2)
71f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
72f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_SII3132_MAXPORT    2
73f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
74f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_ATA            0x0
75f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_PROT_OVERRIDE  0x1
76f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_RESTRANSMIT    0x2
77f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_EXT_CMD        0x4
78f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_RCV            0x8
79f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_PKT_READ       0x10
80f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_PKT_WRITE      0x20
81f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_INT_MASK       0x40
82f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_CTRL_SRST           0x80
83f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
84f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_PROT_PACKET         0x01
85f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_PROT_LEGACY_QUEUE   0x02
86f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_PROT_NATIVE_QUEUE   0x04
87f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_PROT_READ           0x08
88f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_PROT_WRITE          0x10
89f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define PRB_PROT_TRANSPARENT    0x20
90f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
91f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SGE_XCF     (1 << 28)
92f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SGE_DRD     (1 << 29)
93f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SGE_LNK     (1 << 30)
94f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SGE_TRM     0x80000000
95f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
96f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martintypedef struct _SATA_SI3132_SGE {
97f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT32      DataAddressLow;
98f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT32      DataAddressHigh;
99f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT32      DataCount;
100f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT32      Attributes;
101f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin} SATA_SI3132_SGE;
102f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
103f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martintypedef struct _SATA_SI3132_FIS {
104f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT8               FisType;
105f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT8               Control;
106f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT8               Command;
107f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT8               Features;
108f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT8               Fis[5 * 4];
109f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin} SATA_SI3132_FIS;
110f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
111f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martintypedef struct _SATA_SI3132_PRB {
112f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT16              Control;
113f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT16              ProtocolOverride;
114f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT32              RecTransCount;
115f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    SATA_SI3132_FIS     Fis;
116f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    SATA_SI3132_SGE     Sge[2];
117f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin} SATA_SI3132_PRB;
118f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
119f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martintypedef struct _SATA_SI3132_DEVICE {
120f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    LIST_ENTRY                  Link; // This attribute must be the first entry of this structure (to avoid pointer computation)
121f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINTN                       Index;
122f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    struct _SATA_SI3132_PORT    *Port;  //Parent Port
123f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINT32                      BlockSize;
124f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin} SATA_SI3132_DEVICE;
125f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
126f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martintypedef struct _SATA_SI3132_PORT {
127f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINTN                           Index;
128f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINTN                           RegBase;
129f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    struct _SATA_SI3132_INSTANCE    *Instance;
130f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
131f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    //TODO: Support Port multiplier
132f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    LIST_ENTRY                      Devices;
133f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
134f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    SATA_SI3132_PRB*                HostPRB;
135f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    EFI_PHYSICAL_ADDRESS            PhysAddrHostPRB;
136f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    VOID*                           PciAllocMappingPRB;
137f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin} SATA_SI3132_PORT;
138f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
139f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martintypedef struct _SATA_SI3132_INSTANCE {
140f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    UINTN                       Signature;
141f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
142f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    SATA_SI3132_PORT            Ports[SATA_SII3132_MAXPORT];
143f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
144f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    EFI_ATA_PASS_THRU_PROTOCOL  AtaPassThruProtocol;
145f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
146f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin    EFI_PCI_IO_PROTOCOL         *PciIo;
147f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin} SATA_SI3132_INSTANCE;
148f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
149f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_SII3132_SIGNATURE              SIGNATURE_32('s', 'i', '3', '2')
150f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define INSTANCE_FROM_ATAPASSTHRU_THIS(a)   CR(a, SATA_SI3132_INSTANCE, AtaPassThruProtocol, SATA_SII3132_SIGNATURE)
151f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
152f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_GLOBAL_READ32(Offset, Value)  PciIo->Mem.Read (PciIo, EfiPciIoWidthUint32, 0, Offset, 1, Value)
153f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_GLOBAL_WRITE32(Offset, Value) { UINT32 Value32 = Value; PciIo->Mem.Write (PciIo, EfiPciIoWidthUint32, 0, Offset, 1, &Value32); }
154f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
155f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_PORT_READ32(Offset, Value)  PciIo->Mem.Read (PciIo, EfiPciIoWidthUint32, 1, Offset, 1, Value)
156f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_PORT_WRITE32(Offset, Value) { UINT32 Value32 = Value; PciIo->Mem.Write (PciIo, EfiPciIoWidthUint32, 1, Offset, 1, &Value32); }
157f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
158f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#define SATA_TRACE(txt)  DEBUG((EFI_D_VERBOSE, "ARM_SATA: " txt "\n"))
159f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
160f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martinextern EFI_COMPONENT_NAME_PROTOCOL  gSataSiI3132ComponentName;
161f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martinextern EFI_COMPONENT_NAME2_PROTOCOL gSataSiI3132ComponentName2;
162f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
163f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin/*
164f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin * Component Name Protocol Functions
165f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin */
166f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS
167f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFIAPI
168f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinSataSiI3132ComponentNameGetDriverName (
169f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
170f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  CHAR8                        *Language,
171f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  OUT CHAR16                       **DriverName
172f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
173f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
174f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS
175f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFIAPI
176f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinSataSiI3132ComponentNameGetControllerName (
177f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
178f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  EFI_HANDLE                                      ControllerHandle,
179f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
180f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  CHAR8                                           *Language,
181f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  OUT CHAR16                                          **ControllerName
182f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
183f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
184f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132HwResetPort (SATA_SI3132_PORT *Port);
185f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
186f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin/*
187f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin * Driver Binding Protocol Functions
188f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin */
189f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS
190f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFIAPI
191f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinSataSiI3132DriverBindingSupported (
192f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_DRIVER_BINDING_PROTOCOL *This,
193f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_HANDLE                  Controller,
194f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_DEVICE_PATH_PROTOCOL    *RemainingDevicePath
195f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
196f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
197f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS
198f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFIAPI
199f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinSataSiI3132DriverBindingStart (
200f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_DRIVER_BINDING_PROTOCOL *This,
201f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_HANDLE                  Controller,
202f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_DEVICE_PATH_PROTOCOL    *RemainingDevicePath
203f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
204f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
205f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS
206f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFIAPI
207f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinSataSiI3132DriverBindingStop (
208f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_DRIVER_BINDING_PROTOCOL *This,
209f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_HANDLE                  Controller,
210f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN UINTN                       NumberOfChildren,
211f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_HANDLE                  *ChildHandleBuffer
212f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
213f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
214f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132AtaPassThruCommand (
215f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     SATA_SI3132_INSTANCE             *pSataSiI3132Instance,
216f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     SATA_SI3132_PORT                 *pSataPort,
217f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     UINT16                           PortMultiplierPort,
218f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,
219f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     EFI_EVENT                        Event OPTIONAL
220f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
221f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
222f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin/**
223f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin * EFI ATA Pass Thru Protocol
224f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin */
225f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132AtaPassThru (
226f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     EFI_ATA_PASS_THRU_PROTOCOL       *This,
227f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     UINT16                           Port,
228f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     UINT16                           PortMultiplierPort,
229f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,
230f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     EFI_EVENT                        Event OPTIONAL
231f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
232f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
233f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132GetNextPort (
234f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_ATA_PASS_THRU_PROTOCOL *This,
235f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN OUT UINT16                 *Port
236f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
237f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
238f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132GetNextDevice (
239f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_ATA_PASS_THRU_PROTOCOL *This,
240f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN UINT16                     Port,
241f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN OUT UINT16                 *PortMultiplierPort
242f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
243f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
244f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132BuildDevicePath (
245f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     EFI_ATA_PASS_THRU_PROTOCOL *This,
246f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     UINT16                     Port,
247f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN     UINT16                     PortMultiplierPort,
248f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN OUT EFI_DEVICE_PATH_PROTOCOL   **DevicePath
249f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
250f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
251f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132GetDevice (
252f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  EFI_ATA_PASS_THRU_PROTOCOL *This,
253f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN  EFI_DEVICE_PATH_PROTOCOL   *DevicePath,
254f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  OUT UINT16                     *Port,
255f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  OUT UINT16                     *PortMultiplierPort
256f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
257f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
258f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132ResetPort (
259f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_ATA_PASS_THRU_PROTOCOL *This,
260f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN UINT16                     Port
261f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
262f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
263f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier MartinEFI_STATUS SiI3132ResetDevice (
264f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN EFI_ATA_PASS_THRU_PROTOCOL *This,
265f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN UINT16                     Port,
266f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  IN UINT16                     PortMultiplierPort
267f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin  );
268f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin
269f63424474e8b022c0b7675d282c9b4c255a95ff4Olivier Martin#endif
270