summaryrefslogtreecommitdiff
path: root/ReferenceCode/Chipset/SystemAgent/MemoryInit/Pei/Source/AddrDecode/MrcHswMcAddrDecode.h
blob: 76eaf3d57933de8b8ae608536ea0c186989b774a (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
/**
This file contains an 'Intel Peripheral Driver' and uniquely
identified as "Intel Reference Module" and is
licensed for Intel CPUs and chipsets under the terms of your
license agreement with Intel or your vendor.  This file may
be modified by the user, subject to additional terms of the
license agreement.

Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved.
This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.

@file:
  MrcHswMcAddrDecode.h

@brief:
  File to support address decoding and encoding

**/
#ifndef _HSWULT_MC_ADDR_DECODE_H_
#define _HSWULT_MC_ADDR_DECODE_H_


#include "MrcOemAddrDecode.h"
#include "MrcOemMemory.h"

/**
@brief
  Address decode function
  Converts system address to DRAM address

  @param[in]      sys_addr - the 39-bit system address to convert
  @param[in, out] p_is_tcm - is the transaction to sys_addr "traffic class for the manageability engine"
  @param[in]      TOLUD - memory register
  @param[in]      REMAP_BASE - memory register
  @param[in]      REMAP_LIMIT - memory register
  @param[in]      CHANNEL_HASH - memory register
  @param[in]      MAD_ZR - memory register
  @param[in]      MAD_CHNL - memory register
  @param[in]      MAD_DIMM_ch0 - memory register
  @param[in]      MAD_DIMM_ch1 - memory register
  @param[in]      MAD_DIMM_ch2 - memory register
  @param[out]     p_chan - channel sys_addr decodes to
  @param[out]     p_dimm - DIMM sys_addr decodes to
  @param[out]     p_rank - rank sys_addr decodes to
  @param[out]     p_bank - bank sys_addr decodes to
  @param[out]     p_row - row sys_addr decodes to
  @param[out]     p_col - column sys_addr decodes to.

  @retval True if successful.

**/
BOOL
MrcHswDecode (
  IN     U64  sys_addr,
  IN OUT BOOL *p_is_tcm,
  IN     U32  TOLUD,
  IN     U64  REMAP_BASE,
  IN     U64  REMAP_LIMIT,
  IN     U32  CHANNEL_HASH,
  IN     U32  MAD_ZR,
  IN     U32  MAD_CHNL,
  IN     U32  MAD_DIMM_ch0,
  IN     U32  MAD_DIMM_ch1,
  IN     U32  MAD_DIMM_ch2,
  OUT    U16  *p_chan,
  OUT    U16  *p_dimm,
  OUT    U16  *p_rank,
  OUT    U16  *p_bank,
  OUT    U16  *p_row,
  OUT    U16  *p_col
  );

/**
@brief
  Address encode function (reverse address decode)
  DRAM address to system address conversion

  @param[in]     p_chan - channel sys_addr to encode
  @param[in]     p_dimm - DIMM sys_addr to encode
  @param[in]     p_rank - rank sys_addr to encode
  @param[in]     p_bank - bank sys_addr to encode
  @param[in]     p_row - row sys_addr to encode
  @param[in]     p_col - column sys_addr to encode. Note: The architecture is limited to
                         half-cache-line granularity for burst order. Therefore the last
                         two bits of the column are ignored.
  @param[in]      TOLUD - memory register
  @param[in]      REMAP_BASE - memory register
  @param[in]      REMAP_LIMIT - memory register
  @param[in]      CHANNEL_HASH - memory register
  @param[in]      MAD_ZR - memory register
  @param[in]      MAD_CHNL - memory register
  @param[in]      MAD_DIMM_ch0 - memory register
  @param[in]      MAD_DIMM_ch1 - memory register
  @param[in]      MAD_DIMM_ch2 - memory register
  @param[out]     sys_addr - the 39-bit system address convert to
  @param[in, out] p_is_tcm - is the transaction to sys_addr "traffic class for the manageability engine"

  @retval True if successful.

**/
BOOL
MrcHswEncode (
  IN  U16     chan,
  IN  U16     dimm,
  IN  U16     rank,
  IN  U16     bank,
  IN  U16     row,
  IN  U16     col,
  IN  U32     TOLUD,
  IN  U64     REMAP_BASE,
  IN  U64     REMAP_LIMIT,
  IN  U32     CHANNEL_HASH,
  IN  U32     MAD_ZR,
  IN  U32     MAD_CHNL,
  IN  U32     MAD_DIMM_ch0,
  IN  U32     MAD_DIMM_ch1,
  IN  U32     MAD_DIMM_ch2,
  OUT U64     *p_sys_addr,
  IN OUT BOOL *p_is_tcm
  );


#endif // _HSWULT_MC_ADDR_DECODE_H_