1 /******************************************************************************
2 *
3 * Copyright(c) 2015 - 2016 Realtek Corporation. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17 *
18 *
19 ******************************************************************************/
20 #include <drv_types.h>
21 
22 #include "HalEfuseMask8822B_PCIE.h"
23 
24 /******************************************************************************
25 *                           MPCIE.TXT
26 ******************************************************************************/
27 
28 u1Byte Array_MP_8822B_MPCIE[] = {
29 	0xFF,
30 	0xF7,
31 	0xEF,
32 	0xDE,
33 	0xFC,
34 	0xFB,
35 	0x10,
36 	0x00,
37 	0x00,
38 	0x00,
39 	0x00,
40 	0x0F,
41 	0xF7,
42 	0xFF,
43 	0xFF,
44 	0xFF,
45 	0x00,
46 	0x00,
47 	0x00,
48 	0x00,
49 	0x00,
50 	0x00,
51 	0x00,
52 	0x00,
53 	0x00,
54 	0x00,
55 	0x00,
56 	0x00,
57 	0x00,
58 	0x00,
59 	0x00,
60 	0x00,
61 	0x00,
62 	0x00,
63 	0x00,
64 	0x00,
65 	0x00,
66 	0x00,
67 	0x00,
68 	0x00,
69 	0x00,
70 	0x00,
71 	0x00,
72 	0x00,
73 	0x00,
74 	0x00,
75 	0x00,
76 	0x00,
77 
78 
79 };
80 
81 u2Byte
EFUSE_GetArrayLen_MP_8822B_MPCIE(VOID)82 EFUSE_GetArrayLen_MP_8822B_MPCIE(VOID)
83 {
84 	return sizeof(Array_MP_8822B_MPCIE) / sizeof(u1Byte);
85 }
86 
87 VOID
EFUSE_GetMaskArray_MP_8822B_MPCIE(pu1Byte Array)88 EFUSE_GetMaskArray_MP_8822B_MPCIE(pu1Byte Array)
89 {
90 	u2Byte len = EFUSE_GetArrayLen_MP_8822B_MPCIE(), i = 0;
91 
92 	for (i = 0; i < len; ++i)
93 		Array[i] = Array_MP_8822B_MPCIE[i];
94 }
95 
96 BOOLEAN
EFUSE_IsAddressMasked_MP_8822B_MPCIE(u2Byte Offset)97 EFUSE_IsAddressMasked_MP_8822B_MPCIE(u2Byte  Offset)
98 {
99 	int r = Offset / 16;
100 	int c = (Offset % 16) / 2;
101 	int result = 0;
102 
103 	if (c < 4) /*Upper double word*/
104 		result = (Array_MP_8822B_MPCIE[r] & (0x10 << c));
105 	else
106 		result = (Array_MP_8822B_MPCIE[r] & (0x01 << (c - 4)));
107 
108 	return (result > 0) ? 0 : 1;
109 }
110