summaryrefslogtreecommitdiff
path: root/Chipset/eM/Ahci/AInt13Csp.c
blob: 44365bacaa2e10ff7c93f9190d4afc140958cc91 (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
//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**         5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************

//****************************************************************************
// $Header: /Alaska/SOURCE/Modules/AHCI/INT13/CSP/AInt13Csp.c 3     2/10/11 10:52a Rameshr $
//
// $Revision: 3 $
//
// $Date: 2/10/11 10:52a $
//
//****************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/SOURCE/Modules/AHCI/INT13/CSP/AInt13Csp.c $
// 
// 3     2/10/11 10:52a Rameshr
// [TAG]  		EIP53704
// [Category]  	Improvement
// [Description]  	AMI headers update for Alaska Ahci Driver
// [Files]  		AHCIACC.ASM
// HACCESS.EQU
// AHCI.EQU
// AINT13.EQU
// AInt13Csp.c
// 
// 2     5/28/08 9:44a Rameshraju
// Updated the AMI Address.
// 
// 1     12/07/07 11:17a Olegi
//
//****************************************************************************

//<AMI_FHDR_START>
//----------------------------------------------------------------------------
//
//  Name:           AINT13CSP.C
//  Description:    AHCI INT13 Support Chipset Configuration File
//
//----------------------------------------------------------------------------
//<AMI_FHDR_END>

#define LBAR_REGISTER		    0x20
#define LBAR_ADDRESS_MASK	    0xFFFFFFE0
#define INDEX_OFFSET_FROM_LBAR  0x10
#define DATA_OFFSET_FROM_LBAR   0x14

#include "AmiDxeLib.h"
#include "Protocol\PciIo.h"

//<AMI_PHDR_START>
//----------------------------------------------------------------------------
// Name:        GetAccessInfo
//
// Description: This is chipset porting routine that returns index/data ports
//              to access memory-mapped registers.
//
// Input:       PciIo
//
// Output:      EFI_SUCCESS         - Access information is collected
//              EFI_ACCESS_DENIED   - No Access information avaliable
//
//-------------------------------------------------------------------------
//<AMI_PHDR_END>

EFI_STATUS
GetAccessInfo (
    IN EFI_PCI_IO_PROTOCOL *PciIo,
    OUT UINT16  *AccessIndexPort,
    OUT UINT16  *AccessDataPort
)
{
    EFI_STATUS Status;
    UINT32 lbar;

    Status = PciIo->Pci.Read(PciIo, EfiPciIoWidthUint32, LBAR_REGISTER, 1, &lbar);
    ASSERT_EFI_ERROR(Status);

    lbar &= LBAR_ADDRESS_MASK;  // Legacy Bus Master Base Address

    *AccessIndexPort = (UINT16)lbar + INDEX_OFFSET_FROM_LBAR;
    *AccessDataPort = (UINT16)lbar + DATA_OFFSET_FROM_LBAR;

    return EFI_SUCCESS;

}


//**********************************************************************
//**********************************************************************
//**                                                                  **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.         **
//**                                                                  **
//**                       All Rights Reserved.                       **
//**                                                                  **
//**         5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093        **
//**                                                                  **
//**                       Phone: (770)-246-8600                      **
//**                                                                  **
//**********************************************************************
//**********************************************************************