├── English.lproj
└── InfoPlist.strings
├── Info.plist
├── LICENSE
├── R1000Regs.h
├── README.md
├── RTL8100.cpp
├── RTL8168.cpp
├── RTL8169.cpp
├── RealtekR1000SL-old.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── Slice.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
├── slice.mode1v3
├── slice.pbxuser
└── xcuserdata
│ └── Slice.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints.xcbkptlist
│ └── xcschemes
│ ├── RealtekR1000SL.xcscheme
│ └── xcschememanagement.plist
├── RealtekR1000SL.cpp
├── RealtekR1000SL.h
├── RealtekR1000SL.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── Slice.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
├── slice.mode1v3
├── slice.pbxuser
└── xcuserdata
│ └── Slice.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints.xcbkptlist
│ └── xcschemes
│ ├── RealtekR1000SL.xcscheme
│ └── xcschememanagement.plist
├── impl_defs.h
├── mii.h
├── r8101-1.024.00
├── .DS_Store
├── Makefile
├── autorun.sh
├── readme
└── src
│ ├── Makefile
│ ├── Makefile_linux24x
│ ├── r8101.h
│ ├── r8101_n.c
│ ├── rtl_eeprom.c
│ ├── rtl_eeprom.h
│ ├── rtl_ethtool.h
│ ├── rtltool.c
│ └── rtltool.h
├── r8168-8.037.00
├── Makefile
├── README
├── autorun.sh
└── src
│ ├── Makefile
│ ├── Makefile_linux24x
│ ├── r8168.h
│ ├── r8168_asf.c
│ ├── r8168_asf.h
│ ├── r8168_n.c
│ ├── rtl_eeprom.c
│ ├── rtl_eeprom.h
│ ├── rtltool.c
│ └── rtltool.h
└── rtl_bsd_drv
├── Makefile
├── Readme.txt
├── if_re.c
└── if_rereg.h
/English.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleExecutable
8 | RealtekR1000SL
9 | CFBundleGetInfoString
10 | 3.1.2, Copyright Daemon 2006, Chuck Fry 2009, Slice 2013
11 | CFBundleIdentifier
12 | org.chucko.driver.RealtekR1000
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | Realtek RTL816X/811X Family Gigabit Ethernet Driver
17 | CFBundlePackageType
18 | KEXT
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 3.1.2
23 | CFBundleShortVersionString
24 | 3.1.2
25 | IOKitPersonalities
26 |
27 | Realtek RTL8111B/RTL8168 NIC
28 |
29 | CFBundleIdentifier
30 | org.chucko.driver.RealtekR1000
31 | IOClass
32 | com_chucko_RealtekR1000
33 | IOPCIClassMatch
34 | 0x02000000&0xffff0000
35 | IOPCIPrimaryMatch
36 | 0x816810ec 0x813610ec
37 | IOProbeScore
38 | 10000
39 | IOProviderClass
40 | IOPCIDevice
41 |
42 |
43 | OSBundleLibraries
44 |
45 | com.apple.iokit.IONetworkingFamily
46 | 1.4.3
47 | com.apple.iokit.IOPCIFamily
48 | 1.6
49 | com.apple.kpi.bsd
50 | 8.0.0b2
51 | com.apple.kpi.iokit
52 | 8.0.0b2
53 | com.apple.kpi.libkern
54 | 8.0.0b2
55 | com.apple.kpi.mach
56 | 8.0.0b2
57 |
58 | OSBundleRequired
59 | Network-Root
60 |
61 |
62 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 2-Clause License
2 |
3 | Copyright (c) 2019, Sergey
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RealtekLANv3
2 | LAN driver for macOS supporting Realtek chips 8111B,C,D,E,EP,F,G,GU,8411B
3 |
--------------------------------------------------------------------------------
/RTL8169.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * RTL8169.cpp - Hardware methods for RealTek RTL8169 family chips
3 | * RealtekR1000SL
4 | *
5 | * Created by Chuck Fry on 10/8/09.
6 | * Copyright 2009 Chuck Fry. All rights reserved.
7 | *
8 | * This software incorporates code from Realtek's open source Linux drivers
9 | * and the open source Mac OS X project RealtekR1000 by Dmitri Arekhta,
10 | * as modified by PSYSTAR Corporation.
11 | *
12 | * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
13 | * copyright PSYSTAR Corporation, 2008
14 | * 2006 (c) Dmitri Arekhta (DaemonES@gmail.com)
15 | *
16 | * This program is free software; you can redistribute it and/or
17 | * modify it under the terms of the GNU General Public License
18 | * as published by the Free Software Foundation; either version 2
19 | * of the License, or (at your option) any later version.
20 | *
21 | * This program is distributed in the hope that it will be useful,
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | * GNU General Public License for more details.
25 | *
26 | * You should have received a copy of the GNU General Public License
27 | * along with this program; if not, write to the Free Software
28 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 | */
30 |
31 | #include "RealtekR1000SL.h"
32 | #include "impl_defs.h"
33 |
34 | // FIXME - Implement
35 | void RealtekR1000::RTL8169HwStart()
36 | {
37 | }
38 |
39 |
40 | // FIXME - Implement
41 | void RealtekR1000::RTL8169HwPhyConfig()
42 | {
43 | }
44 |
45 |
46 | // FIXME - Implement
47 | void RealtekR1000::RTL8169NicReset()
48 | {
49 | }
50 |
51 |
52 | // TODO - implement
53 | void RealtekR1000::RTL8169SetMedium(ushort speedIn, uchar duplexIn, uchar autonegIn)
54 | {
55 | }
56 |
57 |
58 | // FIXME - Implement
59 | void RealtekR1000::RTL8169PowerDownPHY()
60 | {
61 | }
62 |
63 |
64 | // FIXME - Implement
65 | void RealtekR1000::RTL8169PowerUpPHY()
66 | {
67 | }
68 |
69 |
--------------------------------------------------------------------------------
/RealtekR1000SL-old.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/RealtekR1000SL-old.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SergeySlice/RealtekLANv3/379ce46ded5df358714dcace6fb07efd11c6ff3e/RealtekR1000SL-old.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/RealtekR1000SL-old.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/RealtekR1000SL-old.xcodeproj/slice.pbxuser:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | 089C1669FE841209C02AAC07 /* Project object */ = {
4 | activeBuildConfigurationName = Release;
5 | activeTarget = 32D94FC30562CBF700B6AF17 /* RealtekR1000SL */;
6 | addToTargets = (
7 | );
8 | codeSenseManager = 1281C1B516EDE1E600A58CCC /* Code sense */;
9 | perUserDictionary = {
10 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
11 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
12 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
13 | PBXFileTableDataSourceColumnWidthsKey = (
14 | 20,
15 | 649,
16 | 20,
17 | 48,
18 | 43,
19 | 43,
20 | 20,
21 | );
22 | PBXFileTableDataSourceColumnsKey = (
23 | PBXFileDataSource_FiletypeID,
24 | PBXFileDataSource_Filename_ColumnID,
25 | PBXFileDataSource_Built_ColumnID,
26 | PBXFileDataSource_ObjectSize_ColumnID,
27 | PBXFileDataSource_Errors_ColumnID,
28 | PBXFileDataSource_Warnings_ColumnID,
29 | PBXFileDataSource_Target_ColumnID,
30 | );
31 | };
32 | PBXPerProjectTemplateStateSaveDate = 414595899;
33 | PBXWorkspaceStateSaveDate = 414595899;
34 | };
35 | perUserProjectItems = {
36 | 121B77E1186066450032E4DD /* PBXTextBookmark */ = 121B77E1186066450032E4DD /* PBXTextBookmark */;
37 | 121B77F818606D380032E4DD /* PBXTextBookmark */ = 121B77F818606D380032E4DD /* PBXTextBookmark */;
38 | 121B781018606E5C0032E4DD /* PBXTextBookmark */ = 121B781018606E5C0032E4DD /* PBXTextBookmark */;
39 | 121B79BC18641DF00032E4DD /* PBXTextBookmark */ = 121B79BC18641DF00032E4DD /* PBXTextBookmark */;
40 | 121B79BE18641DF00032E4DD /* PBXTextBookmark */ = 121B79BE18641DF00032E4DD /* PBXTextBookmark */;
41 | 121B79BF18641DF00032E4DD /* PlistBookmark */ = 121B79BF18641DF00032E4DD /* PlistBookmark */;
42 | 12432F6218A3C3BF0099EF13 /* PBXTextBookmark */ = 12432F6218A3C3BF0099EF13 /* PBXTextBookmark */;
43 | 125CDCD916F058FA0087E6D0 /* PBXTextBookmark */ = 125CDCD916F058FA0087E6D0 /* PBXTextBookmark */;
44 | 125CDE6516F8A8240087E6D0 /* PBXTextBookmark */ = 125CDE6516F8A8240087E6D0 /* PBXTextBookmark */;
45 | 1267DD2118B63BCF00D833A4 /* PBXTextBookmark */ = 1267DD2118B63BCF00D833A4 /* PBXTextBookmark */;
46 | 1267DD2518B63BE200D833A4 /* PBXTextBookmark */ = 1267DD2518B63BE200D833A4 /* PBXTextBookmark */;
47 | 1267DD2618B63BE200D833A4 /* PBXTextBookmark */ = 1267DD2618B63BE200D833A4 /* PBXTextBookmark */;
48 | 12750CCA186834870045ED4E /* PBXTextBookmark */ = 12750CCA186834870045ED4E /* PBXTextBookmark */;
49 | 1281C94516EE186A00A58CCC /* PBXTextBookmark */ = 1281C94516EE186A00A58CCC /* PBXTextBookmark */;
50 | 1281C94616EE186A00A58CCC /* PBXTextBookmark */ = 1281C94616EE186A00A58CCC /* PBXTextBookmark */;
51 | 1281C94716EE186A00A58CCC /* PBXTextBookmark */ = 1281C94716EE186A00A58CCC /* PBXTextBookmark */;
52 | 1281C94916EE186A00A58CCC /* PBXTextBookmark */ = 1281C94916EE186A00A58CCC /* PBXTextBookmark */;
53 | 1281C94B16EE186A00A58CCC /* PBXTextBookmark */ = 1281C94B16EE186A00A58CCC /* PBXTextBookmark */;
54 | 1281C94D16EE186A00A58CCC /* PBXTextBookmark */ = 1281C94D16EE186A00A58CCC /* PBXTextBookmark */;
55 | 1281C94F16EE186A00A58CCC /* PBXTextBookmark */ = 1281C94F16EE186A00A58CCC /* PBXTextBookmark */;
56 | 1281C95116EE186A00A58CCC /* PBXTextBookmark */ = 1281C95116EE186A00A58CCC /* PBXTextBookmark */;
57 | 1281C95316EE186A00A58CCC /* PBXTextBookmark */ = 1281C95316EE186A00A58CCC /* PBXTextBookmark */;
58 | 1281C95816EE186A00A58CCC /* PBXTextBookmark */ = 1281C95816EE186A00A58CCC /* PBXTextBookmark */;
59 | 12C9C9E416FAF66600DC5408 /* PBXTextBookmark */ = 12C9C9E416FAF66600DC5408 /* PBXTextBookmark */;
60 | };
61 | sourceControlManager = 1281C1B416EDE1E600A58CCC /* Source Control */;
62 | userBuildSettings = {
63 | };
64 | };
65 | 089C167EFE841241C02AAC07 /* English */ = {
66 | uiCtxt = {
67 | sepNavIntBoundsRect = "{{0, 0}, {827, 568}}";
68 | sepNavSelRange = "{0, 0}";
69 | sepNavVisRange = "{0, 45}";
70 | };
71 | };
72 | 0F758A3E10790A83009EA5D9 /* R1000Regs.h */ = {
73 | uiCtxt = {
74 | sepNavIntBoundsRect = "{{0, 0}, {827, 10946}}";
75 | sepNavSelRange = "{7083, 0}";
76 | sepNavVisRange = "{6588, 747}";
77 | };
78 | };
79 | 0F758A4510790AC5009EA5D9 /* mii.h */ = {
80 | uiCtxt = {
81 | sepNavIntBoundsRect = "{{0, 0}, {878, 884}}";
82 | sepNavSelRange = "{2266, 0}";
83 | sepNavVisRange = "{1324, 1178}";
84 | };
85 | };
86 | 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */ = {
87 | uiCtxt = {
88 | sepNavIntBoundsRect = "{{0, 0}, {758, 157716}}";
89 | sepNavSelRange = "{2566, 0}";
90 | sepNavVisRange = "{3920, 1008}";
91 | sepNavWindowFrame = "{{61, 69}, {868, 762}}";
92 | };
93 | };
94 | 0FCB3C6F107F061300032BEC /* RTL8169.cpp */ = {
95 | uiCtxt = {
96 | sepNavIntBoundsRect = "{{0, 0}, {827, 897}}";
97 | sepNavSelRange = "{0, 0}";
98 | sepNavVisRange = "{1314, 438}";
99 | };
100 | };
101 | 0FCB3C71107F062F00032BEC /* RTL8100.cpp */ = {
102 | uiCtxt = {
103 | sepNavFolds = "{\n c = (\n {\n r = \"{16905, 318}\";\n s = 0;\n },\n {\n r = \"{17267, 357}\";\n s = 0;\n },\n {\n r = \"{17670, 42865}\";\n s = 0;\n },\n {\n r = \"{60580, 15421}\";\n s = 0;\n },\n {\n r = \"{76045, 12341}\";\n s = 0;\n }\n );\n r = \"{0, 100206}\";\n s = 0;\n}";
104 | sepNavIntBoundsRect = "{{0, 0}, {795, 13117}}";
105 | sepNavSelRange = "{15943, 0}";
106 | sepNavVisRange = "{15606, 706}";
107 | sepNavWindowFrame = "{{20, 114}, {868, 762}}";
108 | };
109 | };
110 | 0FCB3C7F107F0A1600032BEC /* impl_defs.h */ = {
111 | uiCtxt = {
112 | sepNavIntBoundsRect = "{{0, 0}, {758, 767}}";
113 | sepNavSelRange = "{2272, 7}";
114 | sepNavVisRange = "{924, 1423}";
115 | };
116 | };
117 | 121B77E1186066450032E4DD /* PBXTextBookmark */ = {
118 | isa = PBXTextBookmark;
119 | fRef = 12EEA3DD185DAEAE003A92F8 /* r8168.h */;
120 | name = "r8168.h: 1260";
121 | rLen = 0;
122 | rLoc = 36508;
123 | rType = 0;
124 | vrLen = 924;
125 | vrLoc = 35793;
126 | };
127 | 121B77F818606D380032E4DD /* PBXTextBookmark */ = {
128 | isa = PBXTextBookmark;
129 | fRef = 0FCB3C71107F062F00032BEC /* RTL8100.cpp */;
130 | name = "RTL8100.cpp: 556";
131 | rLen = 0;
132 | rLoc = 15943;
133 | rType = 0;
134 | vrLen = 1733;
135 | vrLoc = 0;
136 | };
137 | 121B781018606E5C0032E4DD /* PBXTextBookmark */ = {
138 | isa = PBXTextBookmark;
139 | fRef = 12EEA3D0185DAE9C003A92F8 /* r8101_n.c */;
140 | name = "r8101_n.c: 2321";
141 | rLen = 12;
142 | rLoc = 64310;
143 | rType = 0;
144 | vrLen = 1299;
145 | vrLoc = 62957;
146 | };
147 | 121B79BC18641DF00032E4DD /* PBXTextBookmark */ = {
148 | isa = PBXTextBookmark;
149 | fRef = 1A224C3EFF42367911CA2CB7 /* RealtekR1000SL.h */;
150 | name = "RealtekR1000SL.h: 438";
151 | rLen = 0;
152 | rLoc = 12995;
153 | rType = 0;
154 | vrLen = 980;
155 | vrLoc = 12720;
156 | };
157 | 121B79BE18641DF00032E4DD /* PBXTextBookmark */ = {
158 | isa = PBXTextBookmark;
159 | fRef = 0F758A3E10790A83009EA5D9 /* R1000Regs.h */;
160 | name = "R1000Regs.h: 247";
161 | rLen = 0;
162 | rLoc = 7083;
163 | rType = 0;
164 | vrLen = 747;
165 | vrLoc = 6588;
166 | };
167 | 121B79BF18641DF00032E4DD /* PlistBookmark */ = {
168 | isa = PlistBookmark;
169 | fRef = 32D94FCF0562CBF700B6AF17 /* Info.plist */;
170 | fallbackIsa = PBXBookmark;
171 | isK = 0;
172 | kPath = (
173 | CFBundleVersion,
174 | );
175 | name = /Users/slice/Projects/RealtekR1000SL_src_17.12.2013/Info.plist;
176 | rLen = 0;
177 | rLoc = 9223372036854775808;
178 | };
179 | 12432F6218A3C3BF0099EF13 /* PBXTextBookmark */ = {
180 | isa = PBXTextBookmark;
181 | fRef = 12EEA3EF185DAEBE003A92F8 /* r8168_n.c */;
182 | name = "r8168_n.c: 3408";
183 | rLen = 11;
184 | rLoc = 95421;
185 | rType = 0;
186 | vrLen = 1330;
187 | vrLoc = 97970;
188 | };
189 | 1252BE0416E9CAB8002467B3 /* r8168.h */ = {
190 | uiCtxt = {
191 | sepNavIntBoundsRect = "{{0, 0}, {758, 16861}}";
192 | sepNavSelRange = "{36512, 13}";
193 | sepNavVisRange = "{36345, 748}";
194 | };
195 | };
196 | 1252BE0716E9CAB8002467B3 /* r8168_n.c */ = {
197 | uiCtxt = {
198 | sepNavIntBoundsRect = "{{0, 0}, {758, 227409}}";
199 | sepNavSelRange = "{30849, 16}";
200 | sepNavVisRange = "{33024, 851}";
201 | sepNavWindowFrame = "{{16, 55}, {868, 762}}";
202 | };
203 | };
204 | 125CDCCF16F058830087E6D0 /* r8101.h */ = {
205 | uiCtxt = {
206 | sepNavIntBoundsRect = "{{0, 0}, {758, 10673}}";
207 | sepNavSelRange = "{1373, 8}";
208 | sepNavVisRange = "{632, 1159}";
209 | };
210 | };
211 | 125CDCD016F058830087E6D0 /* r8101_n.c */ = {
212 | uiCtxt = {
213 | sepNavFolds = "{\n c = (\n {\n r = \"{47507, 293}\";\n s = 0;\n },\n {\n r = \"{47836, 293}\";\n s = 0;\n },\n {\n r = \"{48166, 264}\";\n s = 0;\n },\n {\n r = \"{48466, 368}\";\n s = 0;\n },\n {\n r = \"{48870, 44565}\";\n s = 0;\n },\n {\n r = \"{93524, 16232}\";\n s = 0;\n },\n {\n r = \"{109791, 12856}\";\n s = 0;\n },\n {\n r = \"{123011, 12959}\";\n s = 0;\n }\n );\n r = \"{0, 220005}\";\n s = 0;\n}";
214 | sepNavIntBoundsRect = "{{0, 0}, {758, 65624}}";
215 | sepNavSelRange = "{48112, 0}";
216 | sepNavVisRange = "{47930, 714}";
217 | sepNavWindowFrame = "{{61, 69}, {868, 762}}";
218 | };
219 | };
220 | 125CDCD916F058FA0087E6D0 /* PBXTextBookmark */ = {
221 | isa = PBXTextBookmark;
222 | fRef = 125CDCCF16F058830087E6D0 /* r8101.h */;
223 | name = "r8101.h: 1";
224 | rLen = 0;
225 | rLoc = 0;
226 | rType = 0;
227 | vrLen = 628;
228 | vrLoc = 19679;
229 | };
230 | 125CDE6516F8A8240087E6D0 /* PBXTextBookmark */ = {
231 | isa = PBXTextBookmark;
232 | fRef = 125CDCD016F058830087E6D0 /* r8101_n.c */;
233 | name = "r8101_n.c: 7527";
234 | rLen = 8;
235 | rLoc = 199381;
236 | rType = 0;
237 | vrLen = 805;
238 | vrLoc = 198900;
239 | };
240 | 1267DD2118B63BCF00D833A4 /* PBXTextBookmark */ = {
241 | isa = PBXTextBookmark;
242 | fRef = 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */;
243 | rLen = 8;
244 | rLoc = 2550;
245 | rType = 0;
246 | };
247 | 1267DD2518B63BE200D833A4 /* PBXTextBookmark */ = {
248 | isa = PBXTextBookmark;
249 | fRef = 1A224C3FFF42367911CA2CB7 /* RealtekR1000SL.cpp */;
250 | name = "RealtekR1000SL.cpp: 333";
251 | rLen = 5;
252 | rLoc = 7913;
253 | rType = 0;
254 | vrLen = 955;
255 | vrLoc = 7375;
256 | };
257 | 1267DD2618B63BE200D833A4 /* PBXTextBookmark */ = {
258 | isa = PBXTextBookmark;
259 | fRef = 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */;
260 | name = "RTL8168.cpp: 89";
261 | rLen = 8;
262 | rLoc = 2550;
263 | rType = 0;
264 | vrLen = 1163;
265 | vrLoc = 1965;
266 | };
267 | 12750CCA186834870045ED4E /* PBXTextBookmark */ = {
268 | isa = PBXTextBookmark;
269 | fRef = 089C167EFE841241C02AAC07 /* English */;
270 | name = "InfoPlist.strings: 1";
271 | rLen = 0;
272 | rLoc = 0;
273 | rType = 0;
274 | vrLen = 45;
275 | vrLoc = 0;
276 | };
277 | 1281C1B416EDE1E600A58CCC /* Source Control */ = {
278 | isa = PBXSourceControlManager;
279 | fallbackIsa = XCSourceControlManager;
280 | isSCMEnabled = 0;
281 | scmConfiguration = {
282 | repositoryNamesForRoots = {
283 | "" = "";
284 | };
285 | };
286 | };
287 | 1281C1B516EDE1E600A58CCC /* Code sense */ = {
288 | isa = PBXCodeSenseManager;
289 | indexTemplatePath = "";
290 | };
291 | 1281C94516EE186A00A58CCC /* PBXTextBookmark */ = {
292 | isa = PBXTextBookmark;
293 | fRef = 1252BE0716E9CAB8002467B3 /* r8168_n.c */;
294 | name = "r8168_n.c: 1755";
295 | rLen = 7;
296 | rLoc = 45591;
297 | rType = 0;
298 | vrLen = 791;
299 | vrLoc = 45008;
300 | };
301 | 1281C94616EE186A00A58CCC /* PBXTextBookmark */ = {
302 | isa = PBXTextBookmark;
303 | fRef = 0FCB3C7F107F0A1600032BEC /* impl_defs.h */;
304 | name = "impl_defs.h: 1";
305 | rLen = 0;
306 | rLoc = 0;
307 | rType = 0;
308 | vrLen = 1552;
309 | vrLoc = 535;
310 | };
311 | 1281C94716EE186A00A58CCC /* PBXTextBookmark */ = {
312 | isa = PBXTextBookmark;
313 | fRef = 1281C94816EE186A00A58CCC /* ipc_types.h */;
314 | name = "ipc_types.h: 1";
315 | rLen = 0;
316 | rLoc = 0;
317 | rType = 0;
318 | vrLen = 1575;
319 | vrLoc = 0;
320 | };
321 | 1281C94816EE186A00A58CCC /* ipc_types.h */ = {
322 | isa = PBXFileReference;
323 | lastKnownFileType = sourcecode.c.h;
324 | name = ipc_types.h;
325 | path = /System/Library/Frameworks/Kernel.framework/Headers/ipc/ipc_types.h;
326 | sourceTree = "";
327 | };
328 | 1281C94916EE186A00A58CCC /* PBXTextBookmark */ = {
329 | isa = PBXTextBookmark;
330 | fRef = 1281C94A16EE186A00A58CCC /* ethernet.h */;
331 | name = "ethernet.h: 1";
332 | rLen = 0;
333 | rLoc = 0;
334 | rType = 0;
335 | vrLen = 1507;
336 | vrLoc = 0;
337 | };
338 | 1281C94A16EE186A00A58CCC /* ethernet.h */ = {
339 | isa = PBXFileReference;
340 | lastKnownFileType = sourcecode.c.h;
341 | name = ethernet.h;
342 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/ethernet.h;
343 | sourceTree = "";
344 | };
345 | 1281C94B16EE186A00A58CCC /* PBXTextBookmark */ = {
346 | isa = PBXTextBookmark;
347 | fRef = 1281C94C16EE186A00A58CCC /* if.h */;
348 | name = "if.h: 1";
349 | rLen = 0;
350 | rLoc = 0;
351 | rType = 0;
352 | vrLen = 1806;
353 | vrLoc = 0;
354 | };
355 | 1281C94C16EE186A00A58CCC /* if.h */ = {
356 | isa = PBXFileReference;
357 | lastKnownFileType = sourcecode.c.h;
358 | name = if.h;
359 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if.h;
360 | sourceTree = "";
361 | };
362 | 1281C94D16EE186A00A58CCC /* PBXTextBookmark */ = {
363 | isa = PBXTextBookmark;
364 | fRef = 1281C94E16EE186A00A58CCC /* if_arp.h */;
365 | name = "if_arp.h: 1";
366 | rLen = 0;
367 | rLoc = 0;
368 | rType = 0;
369 | vrLen = 1799;
370 | vrLoc = 0;
371 | };
372 | 1281C94E16EE186A00A58CCC /* if_arp.h */ = {
373 | isa = PBXFileReference;
374 | lastKnownFileType = sourcecode.c.h;
375 | name = if_arp.h;
376 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if_arp.h;
377 | sourceTree = "";
378 | };
379 | 1281C94F16EE186A00A58CCC /* PBXTextBookmark */ = {
380 | isa = PBXTextBookmark;
381 | fRef = 1281C95016EE186A00A58CCC /* if_media.h */;
382 | name = "if_media.h: 1";
383 | rLen = 0;
384 | rLoc = 0;
385 | rType = 0;
386 | vrLen = 1715;
387 | vrLoc = 0;
388 | };
389 | 1281C95016EE186A00A58CCC /* if_media.h */ = {
390 | isa = PBXFileReference;
391 | lastKnownFileType = sourcecode.c.h;
392 | name = if_media.h;
393 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if_media.h;
394 | sourceTree = "";
395 | };
396 | 1281C95116EE186A00A58CCC /* PBXTextBookmark */ = {
397 | isa = PBXTextBookmark;
398 | fRef = 1281C95216EE186A00A58CCC /* if_var.h */;
399 | name = "if_var.h: 1";
400 | rLen = 0;
401 | rLoc = 0;
402 | rType = 0;
403 | vrLen = 1806;
404 | vrLoc = 0;
405 | };
406 | 1281C95216EE186A00A58CCC /* if_var.h */ = {
407 | isa = PBXFileReference;
408 | lastKnownFileType = sourcecode.c.h;
409 | name = if_var.h;
410 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if_var.h;
411 | sourceTree = "";
412 | };
413 | 1281C95316EE186A00A58CCC /* PBXTextBookmark */ = {
414 | isa = PBXTextBookmark;
415 | fRef = 1281C95416EE186A00A58CCC /* init.h */;
416 | name = "init.h: 1";
417 | rLen = 0;
418 | rLoc = 0;
419 | rType = 0;
420 | vrLen = 1676;
421 | vrLoc = 0;
422 | };
423 | 1281C95416EE186A00A58CCC /* init.h */ = {
424 | isa = PBXFileReference;
425 | lastKnownFileType = sourcecode.c.h;
426 | name = init.h;
427 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/init.h;
428 | sourceTree = "";
429 | };
430 | 1281C95816EE186A00A58CCC /* PBXTextBookmark */ = {
431 | isa = PBXTextBookmark;
432 | fRef = 0F758A4510790AC5009EA5D9 /* mii.h */;
433 | name = "mii.h: 50";
434 | rLen = 0;
435 | rLoc = 2266;
436 | rType = 0;
437 | vrLen = 1178;
438 | vrLoc = 1324;
439 | };
440 | 12C9C9E416FAF66600DC5408 /* PBXTextBookmark */ = {
441 | isa = PBXTextBookmark;
442 | fRef = 0FCB3C6F107F061300032BEC /* RTL8169.cpp */;
443 | name = "RTL8169.cpp: 1";
444 | rLen = 0;
445 | rLoc = 0;
446 | rType = 0;
447 | vrLen = 438;
448 | vrLoc = 1314;
449 | };
450 | 12EEA3CF185DAE9C003A92F8 /* r8101.h */ = {
451 | uiCtxt = {
452 | sepNavIntBoundsRect = "{{0, 0}, {758, 15899}}";
453 | sepNavSelRange = "{31295, 11}";
454 | sepNavVisRange = "{31085, 689}";
455 | };
456 | };
457 | 12EEA3D0185DAE9C003A92F8 /* r8101_n.c */ = {
458 | uiCtxt = {
459 | sepNavFolds = "{\n c = (\n {\n r = \"{184680, 1499}\";\n s = 0;\n },\n {\n r = \"{186283, 999}\";\n s = 0;\n }\n );\n r = \"{0, 285689}\";\n s = 0;\n}";
460 | sepNavIntBoundsRect = "{{0, 0}, {827, 118924}}";
461 | sepNavSelRange = "{64310, 12}";
462 | sepNavVisRange = "{62957, 1299}";
463 | };
464 | };
465 | 12EEA3DD185DAEAE003A92F8 /* r8168.h */ = {
466 | uiCtxt = {
467 | sepNavIntBoundsRect = "{{0, 0}, {827, 17238}}";
468 | sepNavSelRange = "{36508, 0}";
469 | sepNavVisRange = "{35793, 924}";
470 | };
471 | };
472 | 12EEA3E0185DAEAE003A92F8 /* r8168_n.c */ = {
473 | uiCtxt = {
474 | sepNavIntBoundsRect = "{{0, 0}, {758, 225927}}";
475 | sepNavSelRange = "{67289, 9}";
476 | sepNavVisRange = "{66897, 1086}";
477 | };
478 | };
479 | 12EEA3EC185DAEBE003A92F8 /* r8168.h */ = {
480 | uiCtxt = {
481 | sepNavIntBoundsRect = "{{0, 0}, {758, 17511}}";
482 | sepNavSelRange = "{26185, 9}";
483 | sepNavVisRange = "{25661, 1062}";
484 | };
485 | };
486 | 12EEA3EF185DAEBE003A92F8 /* r8168_n.c */ = {
487 | uiCtxt = {
488 | sepNavIntBoundsRect = "{{0, 0}, {827, 254904}}";
489 | sepNavSelRange = "{95421, 11}";
490 | sepNavVisRange = "{97970, 1330}";
491 | };
492 | };
493 | 1A224C3EFF42367911CA2CB7 /* RealtekR1000SL.h */ = {
494 | uiCtxt = {
495 | sepNavIntBoundsRect = "{{0, 0}, {827, 8645}}";
496 | sepNavSelRange = "{12995, 0}";
497 | sepNavVisRange = "{12720, 980}";
498 | };
499 | };
500 | 1A224C3FFF42367911CA2CB7 /* RealtekR1000SL.cpp */ = {
501 | uiCtxt = {
502 | sepNavIntBoundsRect = "{{0, 0}, {827, 50713}}";
503 | sepNavSelRange = "{7913, 5}";
504 | sepNavVisRange = "{7375, 955}";
505 | sepNavWindowFrame = "{{15, 111}, {868, 762}}";
506 | };
507 | };
508 | 32D94FC30562CBF700B6AF17 /* RealtekR1000SL */ = {
509 | activeExec = 0;
510 | };
511 | }
512 |
--------------------------------------------------------------------------------
/RealtekR1000SL-old.xcodeproj/xcuserdata/Slice.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/RealtekR1000SL-old.xcodeproj/xcuserdata/Slice.xcuserdatad/xcschemes/RealtekR1000SL.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
42 |
43 |
44 |
45 |
51 |
52 |
54 |
55 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/RealtekR1000SL-old.xcodeproj/xcuserdata/Slice.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | RealtekR1000SL.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 32D94FC30562CBF700B6AF17
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/RealtekR1000SL.h:
--------------------------------------------------------------------------------
1 | /*
2 | * RealtekR1000SL.h - Class definition for Realtek Ethernet driver
3 | * RealtekR1000SL
4 | *
5 | * Copyright 2009 Chuck Fry. All rights reserved.
6 | *
7 | * This software incorporates code from Realtek's open source Linux drivers
8 | * and the open source Mac OS X project RealtekR1000 by Dmitri Arekhta,
9 | * as modified by PSYSTAR Corporation.
10 | *
11 | * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
12 | * copyright PSYSTAR Corporation, 2008
13 | * 2006 (c) Dmitri Arekhta (DaemonES@gmail.com)
14 | *
15 | * This program is free software; you can redistribute it and/or
16 | * modify it under the terms of the GNU General Public License
17 | * as published by the Free Software Foundation; either version 2
18 | * of the License, or (at your option) any later version.
19 | *
20 | * This program is distributed in the hope that it will be useful,
21 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | * GNU General Public License for more details.
24 | *
25 | * You should have received a copy of the GNU General Public License
26 | * along with this program; if not, write to the Free Software
27 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28 | */
29 |
30 | #ifndef _REALTEKR1000_H_
31 | #define _REALTEKR1000_H_
32 |
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 |
43 | extern "C"
44 | {
45 | #include
46 | #include
47 | }
48 |
49 | #include "R1000Regs.h"
50 | #include "mii.h"
51 |
52 | #define RealtekR1000 com_chucko_RealtekR1000
53 |
54 | //
55 | // Memory allocation method
56 | //
57 | // Choose ONE of these
58 | //
59 |
60 | //#define R1000_ORIGINAL_BUFFER_ALLOCATION
61 | #define R1000_NEW_BUFFER_ALLOCATION_1
62 |
63 | //
64 | // Debug logging
65 | //
66 |
67 | #ifdef DEBUG
68 | #define DLog(format, ...) IOLog("%s: "format, bsdName, ##__VA_ARGS__)
69 | #else
70 | #define DLog(...)
71 | #endif
72 |
73 | //
74 | // Configuration macros
75 | //
76 |
77 | //#define R1000_CHECKSUM_OFFLOAD
78 |
79 | #define BSD_NAME_LEN 16
80 |
81 | enum
82 | {
83 | MEDIUM_INDEX_10HD = 0,
84 | MEDIUM_INDEX_10FD = 1,
85 | MEDIUM_INDEX_100HD = 2,
86 | MEDIUM_INDEX_100FD = 3,
87 | MEDIUM_INDEX_1000HD = 4,
88 | MEDIUM_INDEX_1000FD = 5,
89 | MEDIUM_INDEX_AUTO = 6,
90 | MEDIUM_INDEX_COUNT = 7
91 | };
92 |
93 | // Power states
94 |
95 | enum
96 | {
97 | kR1000PowerStateOff = 0,
98 | kR1000PowerStateOn,
99 | kR1000PowerStateCount
100 | };
101 |
102 |
103 | class RealtekR1000 : public IOEthernetController
104 | {
105 | OSDeclareDefaultStructors(RealtekR1000)
106 |
107 | public:
108 |
109 | //
110 | // IONetworkController API
111 | //
112 |
113 | virtual bool init(OSDictionary *properties);
114 | virtual void free();
115 | virtual bool start(IOService *provider);
116 | virtual void stop(IOService *provider);
117 |
118 | virtual IOReturn enable(IONetworkInterface *netif);
119 | virtual IOReturn disable(IONetworkInterface *netif);
120 | virtual bool setLinkStatus( UInt32 status,
121 | const IONetworkMedium *activeMedium = 0,
122 | UInt64 speed = 0,
123 | OSData *data = 0 );
124 |
125 | virtual UInt32 outputPacket(mbuf_t m, void *param);
126 | virtual void getPacketBufferConstraints(IOPacketBufferConstraints *constraints) const;
127 | virtual IOOutputQueue *createOutputQueue();
128 | virtual const OSString *newVendorString() const;
129 | virtual const OSString *newModelString() const;
130 | virtual IOReturn selectMedium(const IONetworkMedium *medium);
131 | virtual bool configureInterface(IONetworkInterface *netif);
132 | virtual bool createWorkLoop();
133 | virtual IOWorkLoop *getWorkLoop() const;
134 | virtual IOReturn getHardwareAddress(IOEthernetAddress *addr);
135 |
136 | // Broadcast, multicast, promiscuous modes
137 | virtual IOReturn setPromiscuousMode(bool enabled);
138 | virtual IOReturn setMulticastMode(bool enabled);
139 | virtual IOReturn setMulticastList(IOEthernetAddress *addrs, UInt32 count);
140 |
141 | // Kernel debug methods
142 | virtual void sendPacket(void *pkt, UInt32 pkt_len);
143 | virtual void receivePacket(void * pkt, UInt32 *pkt_len, UInt32 timeout);
144 |
145 | // Power management
146 | virtual IOReturn registerWithPolicyMaker(IOService *policyMaker);
147 | virtual IOReturn setPowerState(unsigned long powerStateOrdinal, IOService *policyMaker);
148 |
149 | //
150 | // H/W checksum support
151 | virtual IOReturn getChecksumSupport(UInt32 *checksumMask,
152 | UInt32 checksumFamily,
153 | bool isOutput);
154 |
155 |
156 | private:
157 | //
158 | // Private methods used in IONetworkInterface API
159 | //
160 |
161 | void R1000Interrupt(OSObject * client, IOInterruptEventSource * src, int count);
162 | void R1000TxTimeout(OSObject *owner, IOTimerEventSource * timer);
163 |
164 | //
165 | // IOKit interface objects
166 | //
167 |
168 | IOPCIDevice *pciDev;
169 | IOWorkLoop *workLoop;
170 | IOInterruptEventSource *intSource;
171 | IOTimerEventSource *timerSource;
172 | IONetworkStats *netStats;
173 | IOEthernetStats *etherStats;
174 | IOOutputQueue *transmitQueue;
175 | IOEthernetInterface *etherif;
176 | OSDictionary *mediumDict;
177 | const IONetworkMedium *mediumTable[MEDIUM_INDEX_COUNT]; // *** only used in increaseActivationLevel() ??
178 |
179 | //
180 | // BSD name for this device
181 | //
182 | char bsdName[BSD_NAME_LEN];
183 |
184 | //
185 | // OS flag data for configureInterface() method
186 | //
187 | UInt32 canOffload; // chip h/w capabilities
188 |
189 | bool board_inited;
190 | bool buffers_inited;
191 | bool enabled;
192 | bool linked;
193 |
194 | UInt32 activationLevel;
195 | bool enabledForBSD;
196 | bool enabledForKDP;
197 |
198 | unsigned long powerState;
199 | bool rx_fifo_overflow;
200 |
201 | // HW Configuration info
202 |
203 | int mcfg; // Which chip
204 | u32 rx_config_base; // Base value of RxConfig register for this chip
205 | u32 rx_config_mask; // Mask for RxConfig register
206 | u16 max_jumbo_frame_sz; // Max jumbo frame size for this chip ; 0 == not supported
207 | u16 efuse; // EFUSE capability (some 8168 variants only)
208 |
209 | ulong expire_time;
210 |
211 | ulong n_rx_desc; /* Number of receive buffers for this chip. */
212 | ulong cur_rx; /* Index into the Rx descriptor buffer of next Rx pkt. Max value is n_rx_desc - 1. */
213 |
214 | // cur_tx and dirty_tx are indices into the Tx descriptor ring buffer.
215 | // (cur_tx % n_tx_desc) is the index of the next free Tx descriptor.
216 | // (dirty_tx % n_tx_desc) is the index of the Tx descriptor currently being transmitted (if any).
217 | // dirty_tx lags cur_tx when transmission is in progress.
218 | // Both increase monotonically - no consequences if they wrap around,
219 | // as long as n_tx_desc is a power of 2.
220 | ulong n_tx_desc; /* Number of transmit buffers for this chip. */
221 | ulong cur_tx; /* Index into the Tx descriptor buffer of next Tx pkt. */
222 | ulong dirty_tx;
223 |
224 | //
225 | // Transmit buffers
226 | //
227 |
228 | // packets as passed in by caller
229 | struct __mbuf *Tx_skbuff[NUM_TX_DESC];
230 | #ifdef R1000_ORIGINAL_BUFFER_ALLOCATION
231 | // virtual memory addresses of buffer pool
232 | uchar *Tx_dbuff[NUM_TX_DESC];
233 | // OS descriptors
234 | IOBufferMemoryDescriptor *Tx_skbuff_Md[NUM_TX_DESC];
235 | // Physical addresses for hardware to use
236 | IOPhysicalAddress Tx_skbuff_Dma[NUM_TX_DESC];
237 | #endif // R1000_ORIGINAL_BUFFER_ALLOCATION
238 |
239 | #ifdef R1000_NEW_BUFFER_ALLOCATION_1
240 | // OS descriptor
241 | IOBufferMemoryDescriptor *Tx_skbuff_pool_Md;
242 | // Virtual memory map
243 | IOMemoryMap *Tx_skbuff_pool_Map;
244 | // Physical base address
245 | IOPhysicalAddress Tx_skbuff_pool_phys_addr;
246 | // Virtual base address
247 | IOVirtualAddress Tx_skbuff_pool_virt_addr;
248 | #endif // R1000_NEW_BUFFER_ALLOCATION_1
249 |
250 | //
251 | // Receive buffers
252 | //
253 |
254 | #ifdef R1000_ORIGINAL_BUFFER_ALLOCATION
255 | // virtual memory addresses of buffer pool
256 | uchar *Rx_dbuff[NUM_RX_DESC];
257 | // OS descriptors
258 | IOBufferMemoryDescriptor *Rx_skbuff_Md[NUM_RX_DESC];
259 | // Physical addresses for hardware to use
260 | IOPhysicalAddress Rx_skbuff_Dma[NUM_RX_DESC];
261 | #endif // R1000_ORIGINAL_BUFFER_ALLOCATION
262 |
263 | #ifdef R1000_NEW_BUFFER_ALLOCATION_1
264 | // OS descriptor
265 | IOBufferMemoryDescriptor *Rx_skbuff_pool_Md;
266 | // Virtual memory map
267 | IOMemoryMap *Rx_skbuff_pool_Map;
268 | // Physical base address
269 | IOPhysicalAddress Rx_skbuff_pool_phys_addr;
270 | // Virtual base address
271 | IOVirtualAddress Rx_skbuff_pool_virt_addr;
272 | #endif // R1000_NEW_BUFFER_ALLOCATION_1
273 |
274 | void *txdesc_space;
275 | struct TxDesc *TxDescArray; /* Index of 256-alignment Tx Descriptor buffer */
276 | IOBufferMemoryDescriptor *tx_descMd;
277 | IOPhysicalAddress txdesc_phy_dma_addr;
278 | int sizeof_txdesc_space;
279 |
280 | void *rxdesc_space;
281 | struct RxDesc *RxDescArray; /* Index of 256-alignment Rx Descriptor buffer */
282 | IOBufferMemoryDescriptor *rx_descMd;
283 | IOPhysicalAddress rxdesc_phy_dma_addr;
284 | int sizeof_rxdesc_space;
285 |
286 | // Maximum packet sizes
287 | // These will always be smaller than 2^16.
288 | ulong curr_mtu_size;
289 | ulong tx_pkt_len;
290 | ulong rx_pkt_len;
291 | ulong hw_rx_pkt_len;
292 |
293 | // Medium settings
294 | u16 speed;
295 | u8 duplex;
296 | u8 autoneg;
297 | u16 aspm;
298 |
299 | //
300 | // Cached copies of registers
301 | //
302 | u16 cp_cmd;
303 | u16 intr_mask;
304 |
305 | u32 msg_enable;
306 | u32 tx_tcp_csum_cmd;
307 | u32 tx_udp_csum_cmd;
308 | u32 tx_ip_csum_cmd;
309 |
310 | u8 org_pci_offset_99;
311 | u8 org_pci_offset_180;
312 | u8 issue_offset_99_event;
313 |
314 | u8 org_pci_offset_80;
315 | u8 org_pci_offset_81;
316 | u8 use_timer_interrrupt;
317 |
318 | u16 wol_enabled; /* Wake On Lan */
319 | bool wolCapable;
320 | bool wolActive;
321 |
322 | unsigned features;
323 | unsigned wol_opts;
324 | u16 mac_ocp_data;
325 | // u16 gphy_val;
326 | u32 bios_setting;
327 |
328 | ulong mc_filter0, mc_filter1; // cached multicast filter bits
329 |
330 | static int max_interrupt_work;
331 | static UInt32 multicast_filter_limit;
332 | static const u32 ethernet_polynomial;
333 |
334 | static const u16 r1000_intr_mask;
335 | static const u16 rtl8101_intr_mask;
336 | static const u16 rtl8101_napi_event;
337 | static const uint32_t rtl8101_rx_config;
338 | static const u16 rtl8168_intr_mask;
339 | static const u16 rtl8168_napi_event;
340 | static const struct RtlChipInfo rtl_chip_info[];
341 | static struct IOPMPowerState powerStateArray[kR1000PowerStateCount];
342 |
343 | //
344 | // Primitive IO operations
345 | //
346 |
347 | UInt16 pioBase; // Port IO base address
348 | IOMemoryMap *mmioBase; // Memory map for IO
349 | bool forcedPio; // True = no memory mapped IO
350 |
351 | //
352 | // Writes - equivalent to RTL_W{8,16,32}
353 | //
354 | inline void WriteMMIO8(ushort offset, uchar value)
355 | { (forcedPio) ? outb(pioBase + offset, value) : pciDev->ioWrite8(offset, value, mmioBase); }
356 | inline void WriteMMIO16(ushort offset, ushort value)
357 | { (forcedPio) ? outw(pioBase + offset, value) : pciDev->ioWrite16(offset, value, mmioBase); }
358 | inline void WriteMMIO32(ushort offset, UInt32 value)
359 | { (forcedPio) ? outl(pioBase + offset, value) : pciDev->ioWrite32(offset, value, mmioBase); }
360 |
361 | //
362 | // Reads - equivalent to RTL_R{8,16,32}
363 | //
364 | inline uchar ReadMMIO8(ushort offset)
365 | { return ((forcedPio) ? inb(pioBase + offset) : pciDev->ioRead8(offset, mmioBase)); }
366 | inline ushort ReadMMIO16(ushort offset)
367 | { return ((forcedPio) ? inw(pioBase + offset) : pciDev->ioRead16(offset, mmioBase)); }
368 | inline ulong ReadMMIO32(ushort offset)
369 | { return ((forcedPio) ? inl(pioBase + offset) : pciDev->ioRead32(offset, mmioBase)); }
370 |
371 | //
372 | // Less primitive IO
373 | //
374 |
375 | //
376 | // GMII access
377 | // Equivalent to mdio_{write,read}
378 | //
379 | void WriteGMII16(int RegAddr, u16 value);
380 | u16 ReadGMII16(int RegAddr);
381 |
382 | //
383 | // EPHY access
384 | // Equivalent to RTL8xxx_ephy_{write,read}
385 | //
386 | void WriteEPHY16(int RegAddr, u16 value);
387 | u16 ReadEPHY16(int RegAddr);
388 |
389 | //
390 | // CSI access
391 | // Equivalent to RTL8xxx_csi_{write,read}
392 | //
393 | void WriteCSI32(int addr, int value);
394 | int ReadCSI32(int addr);
395 |
396 | u32 rtl8168_csi_other_fun_read(u8 multi_fun_sel_bit,
397 | u32 addr);
398 | void rtl8168_csi_other_fun_write(u8 multi_fun_sel_bit,
399 | u32 addr,
400 | u32 value);
401 | u8 rtl8168_csi_fun0_read_byte(u32 addr);
402 | void rtl8168_csi_fun0_write_byte(u32 addr, u8 value);
403 |
404 | void rtl8168_get_hw_wol();
405 | void rtl8168_set_hw_wol(u32 wolopts);
406 |
407 | //
408 | // ERI Register access
409 | // Equivalent to rtl8xxx_eri_write/rtl8xxx_eri_read
410 | int WriteERI(int addr, int len, int value, int type);
411 | int ReadERI(int addr, int len, int type);
412 |
413 | //
414 | // EEPROM access
415 | //
416 | int rtl_eeprom_type();
417 | void rtl_eeprom_cleanup();
418 | u16 rtl_eeprom_read_sc(u16 reg);
419 | void rtl_eeprom_write_sc(u16 reg, u16 data);
420 | void rtl_shift_out_bits(int data, int count);
421 | u16 rtl_shift_in_bits();
422 | void rtl_raise_clock(u8 *x);
423 | void rtl_lower_clock(u8 *);
424 | void rtl_stand_by();
425 | int rtl_eeprom_cmd_done();
426 |
427 | void rtl8168_enable_rxdvgate();
428 | void rtl8168_disable_rxdvgate();
429 | void rtl8168_wait_txrx_fifo_empty();
430 | void rtl8168_rar_set(uint8_t *addr);
431 |
432 |
433 | void R1000GetMacVersion();
434 | bool R1000InitBoard();
435 | bool R1000ProbeAndStartBoard();
436 | bool R1000StopBoard();
437 |
438 | IOReturn setWakeOnMagicPacket(bool active);
439 |
440 | // Meant to be called as an IOWorkLoop Action.
441 | IOReturn R1000ResetTask();
442 |
443 | void R1000SetMedium(ushort speed, uchar duplex, uchar autoneg);
444 |
445 | bool increaseActivationLevel(UInt32 level);
446 | bool decreaseActivationLevel(UInt32 level);
447 | bool setActivationLevel(UInt32 level);
448 |
449 | void R1000HwPhyReset();
450 | void R1000HwPhyConfig();
451 | void R1000NicReset();
452 | void R1000HwStart();
453 | void R1000TxClear();
454 | void R1000Suspend();
455 | void R1000Resume();
456 | bool R1000CheckLinkStatus();
457 |
458 | void R1000DSM(int dev_state);
459 |
460 | void R1000PowerDownPLL();
461 | void R1000PowerUpPLL();
462 |
463 | void R1000PowerDownPHY();
464 | void R1000PowerUpPHY();
465 |
466 | void R1000ASICDown();
467 |
468 | void R1000IRQMaskAndAck();
469 |
470 |
471 | inline void R1000InitRingIndices()
472 | {
473 | cur_rx = cur_tx = dirty_tx = 0;
474 | }
475 |
476 | inline u16 map_phy_ocp_addr(u16 page, u16 reg)
477 | {
478 | if (page != OCP_STD_PHY_BASE_PAGE) {
479 | reg -= 16;
480 | }
481 |
482 | page <<= 4;
483 | reg <<= 1;
484 |
485 | return (page + reg);
486 | }
487 |
488 |
489 |
490 | //
491 | // Specialized methods by chip family
492 | //
493 |
494 | // RTL8100
495 | //
496 | void RTL8100HwStart();
497 | // Chip specific subroutines
498 | void RTL8100HwStart1Gen();
499 | void RTL8105EHwStart1();
500 | void RTL8105EHwStart();
501 | void RTL8402HwStart();
502 | void RTL8106HwStart();
503 |
504 | void RTL8100HwPhyConfig();
505 | // Chip specific configuration
506 | void RTL8102EHwPhyConfig();
507 | void RTL8401PhyHwConfig();
508 | void RTL8105E1HwPhyConfig();
509 | void RTL8105EHwPhyConfig();
510 | void RTL8402HwPhyConfig();
511 | void RTL8106EHwPhyConfig();
512 |
513 | void RTL8100NicReset();
514 |
515 | void RTL8100SetMedium(ushort speedIn, uchar duplexIn, uchar autonegIn);
516 |
517 | void RTL8100DSM(int dev_state);
518 |
519 | static const int eee_enable = 0;
520 | void RTL8100EnableEEE();
521 | void RTL8100DisableEEE();
522 |
523 | void RTL8100PowerDownPLL();
524 | void RTL8100PowerUpPLL();
525 |
526 | void RTL8100PowerDownPHY();
527 | void RTL8100PowerUpPHY();
528 |
529 | void RTL8100WritePhyIO(int RegAddr, int value);
530 | int RTL8100ReadPhyIO(int RegAddr);
531 |
532 | //
533 | // RTL8168
534 | //
535 | void RTL8168HwStart();
536 | // subroutines of above
537 | void RTL8168BHwStart2();
538 | void RTL8168CHwStart2();
539 | void RTL8168CPHwStart2();
540 | void RTL8168DHwStart2();
541 | void RTL8168DPHwStart2();
542 | void RTL8168EHwStart2();
543 | void RTL8168EVLHwStart2();
544 | void RTL8168FHwStart2();
545 |
546 | void rtl8168_get_bios_setting();
547 | void rtl8168_set_bios_setting();
548 | void rtl8168_init_software_variable();
549 | void RTL8168HwPhyConfig();
550 | // subroutines of above
551 | void RTL8168BHwPhyConfig();
552 | void RTL8168CHwPhyConfig();
553 | void RTL8168CPHwPhyConfig();
554 | void RTL8168DHwPhyConfig();
555 | void RTL8168DPHwPhyConfig();
556 | void RTL8168EHwPhyConfig();
557 | void RTL8168FHwPhyConfig();
558 | void RTL8168GHwPhyConfig();
559 | void RTL8411HwPhyConfig();
560 |
561 | void RTL8168NicReset();
562 |
563 | void RTL8168SleepRxEnable();
564 |
565 | void RTL8168SetMedium(ushort speedIn, uchar duplexIn, uchar autonegIn);
566 |
567 | void RTL8168DSM(int dev_state);
568 |
569 | void RTL8168PowerDownPLL();
570 | void RTL8168PowerUpPLL();
571 |
572 | void RTL8168PowerDownPHY();
573 | void RTL8168PowerUpPHY();
574 |
575 | u16 mac_ocp_read(u16 reg_addr);
576 | void mac_ocp_write(u16 reg_addr, u16 value);
577 | u32 OCP_read(u8 mask, u16 Reg);
578 | void OCP_write(u8 mask, u16 Reg, u32 data);
579 |
580 | void RTL8168WriteOCP_GPHY(int RegAddr, u16 value);
581 | u16 RTL8168ReadOCP_GPHY(int RegAddr);
582 |
583 | u8 RTL8168ReadEfuse(u16 reg);
584 |
585 | //
586 | // RTL8169
587 | //
588 | void RTL8169HwStart();
589 | void RTL8169HwPhyConfig();
590 | void RTL8169NicReset();
591 |
592 | void RTL8169SetMedium(ushort speedIn, uchar duplexIn, uchar autonegIn);
593 |
594 | void RTL8169PowerDownPHY();
595 | void RTL8169PowerUpPHY();
596 |
597 |
598 | ulong ether_crc(int length, unsigned char *data);
599 |
600 | //
601 | // Buffer pool allocation/deallocation
602 | //
603 |
604 | // Descriptor buffers
605 | bool AllocateDescriptorsMemory();
606 | void FreeDescriptorsMemory();
607 |
608 | // Packet buffers
609 | void InitializeBufferMemoryPointers();
610 | bool AllocateBufferMemory();
611 | void FreeBufferMemory();
612 | #ifdef R1000_ORIGINAL_BUFFER_ALLOCATION
613 | inline IOPhysicalAddress RxBufferPhysicalAddress(int n) { return Rx_skbuff_Dma[n]; }
614 | inline IOPhysicalAddress TxBufferPhysicalAddress(int n) { return Tx_skbuff_Dma[n]; }
615 | inline uchar* RxBufferVirtualAddress(int n) { return Rx_dbuff[n]; }
616 | inline uchar* TxBufferVirtualAddress(int n) { return Tx_dbuff[n]; }
617 | #endif
618 |
619 | #ifdef R1000_NEW_BUFFER_ALLOCATION_1
620 | // FIXME - buffer sizes should be a variable, not a macro!
621 | inline IOPhysicalAddress RxBufferPhysicalAddress(int n)
622 | { return Rx_skbuff_pool_phys_addr + (n * MAX_RX_SKBDATA_SIZE); }
623 | inline IOPhysicalAddress TxBufferPhysicalAddress(int n)
624 | { return Tx_skbuff_pool_phys_addr + (n * MAX_TX_SKBDATA_SIZE); }
625 | inline uchar* RxBufferVirtualAddress(int n)
626 | { return reinterpret_cast(Rx_skbuff_pool_virt_addr + (n * MAX_RX_SKBDATA_SIZE)); }
627 | inline uchar* TxBufferVirtualAddress(int n)
628 | { return reinterpret_cast(Tx_skbuff_pool_virt_addr + (n * MAX_TX_SKBDATA_SIZE)); }
629 | #endif
630 |
631 | void rtl8168_disable_pci_offset_99();
632 | void rtl8168_enable_pci_offset_99();
633 | void rtl8168_init_pci_offset_99();
634 | void rtl8168_disable_pci_offset_180();
635 | void rtl8168_enable_pci_offset_180();
636 | void rtl8168_init_pci_offset_180();
637 |
638 | void rtl8168_set_pci_99_180_exit_driver_para();
639 | void rtl8168_issue_offset_99_event();
640 |
641 | void rtl8168_hw_d3_para();
642 |
643 | void InitializeRingBufferDescriptors();
644 | void R1000InitRxDescCmds(bool nicOwn);
645 |
646 |
647 | bool R1000InitEventSources(IOService *provide);
648 | bool R1000OpenAdapter();
649 | void R1000CloseAdapter();
650 |
651 | void R1000RxInterrupt(u16 intStatus);
652 | void R1000TxInterrupt(u16 intStatus);
653 | void R1000PCIErrorInterrupt();
654 |
655 | bool OSAddNetworkMedium(ulong type, UInt32 bps, ulong index);
656 | };
657 |
658 | #endif
659 |
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 0F758A3F10790A83009EA5D9 /* R1000Regs.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F758A3E10790A83009EA5D9 /* R1000Regs.h */; };
11 | 0F758A4610790AC5009EA5D9 /* mii.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F758A4510790AC5009EA5D9 /* mii.h */; };
12 | 0FCB3C6E107F05FF00032BEC /* RTL8168.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */; };
13 | 0FCB3C70107F061300032BEC /* RTL8169.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB3C6F107F061300032BEC /* RTL8169.cpp */; };
14 | 0FCB3C72107F062F00032BEC /* RTL8100.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FCB3C71107F062F00032BEC /* RTL8100.cpp */; };
15 | 0FCB3C80107F0A1600032BEC /* impl_defs.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FCB3C7F107F0A1600032BEC /* impl_defs.h */; };
16 | 32D94FC60562CBF700B6AF17 /* RealtekR1000SL.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A224C3EFF42367911CA2CB7 /* RealtekR1000SL.h */; };
17 | 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C167DFE841241C02AAC07 /* InfoPlist.strings */; };
18 | 32D94FCA0562CBF700B6AF17 /* RealtekR1000SL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A224C3FFF42367911CA2CB7 /* RealtekR1000SL.cpp */; settings = {ATTRIBUTES = (); }; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXFileReference section */
22 | 089C167EFE841241C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; };
23 | 0F758A3E10790A83009EA5D9 /* R1000Regs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = R1000Regs.h; sourceTree = ""; };
24 | 0F758A4510790AC5009EA5D9 /* mii.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mii.h; sourceTree = ""; };
25 | 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTL8168.cpp; sourceTree = ""; };
26 | 0FCB3C6F107F061300032BEC /* RTL8169.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTL8169.cpp; sourceTree = ""; };
27 | 0FCB3C71107F062F00032BEC /* RTL8100.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RTL8100.cpp; sourceTree = ""; };
28 | 0FCB3C7F107F0A1600032BEC /* impl_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = impl_defs.h; sourceTree = ""; };
29 | 12EEA3C9185DAE9C003A92F8 /* autorun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = autorun.sh; sourceTree = ""; };
30 | 12EEA3CA185DAE9C003A92F8 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; };
31 | 12EEA3CB185DAE9C003A92F8 /* readme */ = {isa = PBXFileReference; lastKnownFileType = text; path = readme; sourceTree = ""; };
32 | 12EEA3CD185DAE9C003A92F8 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; };
33 | 12EEA3CE185DAE9C003A92F8 /* Makefile_linux24x */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile_linux24x; sourceTree = ""; };
34 | 12EEA3CF185DAE9C003A92F8 /* r8101.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = r8101.h; sourceTree = ""; };
35 | 12EEA3D0185DAE9C003A92F8 /* r8101_n.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = r8101_n.c; sourceTree = ""; };
36 | 12EEA3D1185DAE9C003A92F8 /* rtl_eeprom.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rtl_eeprom.c; sourceTree = ""; };
37 | 12EEA3D2185DAE9C003A92F8 /* rtl_eeprom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rtl_eeprom.h; sourceTree = ""; };
38 | 12EEA3D3185DAE9C003A92F8 /* rtl_ethtool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rtl_ethtool.h; sourceTree = ""; };
39 | 12EEA3D4185DAE9C003A92F8 /* rtltool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rtltool.c; sourceTree = ""; };
40 | 12EEA3D5185DAE9C003A92F8 /* rtltool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rtltool.h; sourceTree = ""; };
41 | 12EEA3E6185DAEBE003A92F8 /* autorun.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = autorun.sh; sourceTree = ""; };
42 | 12EEA3E7185DAEBE003A92F8 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; };
43 | 12EEA3E8185DAEBE003A92F8 /* README */ = {isa = PBXFileReference; lastKnownFileType = text; path = README; sourceTree = ""; };
44 | 12EEA3EA185DAEBE003A92F8 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; };
45 | 12EEA3EB185DAEBE003A92F8 /* Makefile_linux24x */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile_linux24x; sourceTree = ""; };
46 | 12EEA3EC185DAEBE003A92F8 /* r8168.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = r8168.h; sourceTree = ""; };
47 | 12EEA3ED185DAEBE003A92F8 /* r8168_asf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = r8168_asf.c; sourceTree = ""; };
48 | 12EEA3EE185DAEBE003A92F8 /* r8168_asf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = r8168_asf.h; sourceTree = ""; };
49 | 12EEA3EF185DAEBE003A92F8 /* r8168_n.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = r8168_n.c; sourceTree = ""; };
50 | 12EEA3F0185DAEBE003A92F8 /* rtl_eeprom.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rtl_eeprom.c; sourceTree = ""; };
51 | 12EEA3F1185DAEBE003A92F8 /* rtl_eeprom.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rtl_eeprom.h; sourceTree = ""; };
52 | 12EEA3F2185DAEBE003A92F8 /* rtltool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rtltool.c; sourceTree = ""; };
53 | 12EEA3F3185DAEBE003A92F8 /* rtltool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rtltool.h; sourceTree = ""; };
54 | 1A224C3EFF42367911CA2CB7 /* RealtekR1000SL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtekR1000SL.h; sourceTree = ""; };
55 | 1A224C3FFF42367911CA2CB7 /* RealtekR1000SL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtekR1000SL.cpp; sourceTree = ""; };
56 | 32D94FCF0562CBF700B6AF17 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
57 | 32D94FD00562CBF700B6AF17 /* RealtekR1000SL.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RealtekR1000SL.kext; sourceTree = BUILT_PRODUCTS_DIR; };
58 | 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Kernel.framework; path = /System/Library/Frameworks/Kernel.framework; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 32D94FCB0562CBF700B6AF17 /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | );
67 | runOnlyForDeploymentPostprocessing = 0;
68 | };
69 | /* End PBXFrameworksBuildPhase section */
70 |
71 | /* Begin PBXGroup section */
72 | 089C166AFE841209C02AAC07 /* RealtekR1000SL */ = {
73 | isa = PBXGroup;
74 | children = (
75 | 247142CAFF3F8F9811CA285C /* Source */,
76 | 12EEA3C8185DAE9C003A92F8 /* r8101-1.024.00 */,
77 | 12EEA3E5185DAEBE003A92F8 /* r8168-8.037.00 */,
78 | 8DA8362C06AD9B9200E5AC22 /* Kernel.framework */,
79 | 089C167CFE841241C02AAC07 /* Resources */,
80 | 19C28FB6FE9D52B211CA2CBB /* Products */,
81 | );
82 | name = RealtekR1000SL;
83 | sourceTree = "";
84 | };
85 | 089C167CFE841241C02AAC07 /* Resources */ = {
86 | isa = PBXGroup;
87 | children = (
88 | 32D94FCF0562CBF700B6AF17 /* Info.plist */,
89 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */,
90 | );
91 | name = Resources;
92 | sourceTree = "";
93 | };
94 | 12EEA3C8185DAE9C003A92F8 /* r8101-1.024.00 */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 12EEA3C9185DAE9C003A92F8 /* autorun.sh */,
98 | 12EEA3CA185DAE9C003A92F8 /* Makefile */,
99 | 12EEA3CB185DAE9C003A92F8 /* readme */,
100 | 12EEA3CC185DAE9C003A92F8 /* src */,
101 | );
102 | path = "r8101-1.024.00";
103 | sourceTree = "";
104 | };
105 | 12EEA3CC185DAE9C003A92F8 /* src */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 12EEA3CD185DAE9C003A92F8 /* Makefile */,
109 | 12EEA3CE185DAE9C003A92F8 /* Makefile_linux24x */,
110 | 12EEA3CF185DAE9C003A92F8 /* r8101.h */,
111 | 12EEA3D0185DAE9C003A92F8 /* r8101_n.c */,
112 | 12EEA3D1185DAE9C003A92F8 /* rtl_eeprom.c */,
113 | 12EEA3D2185DAE9C003A92F8 /* rtl_eeprom.h */,
114 | 12EEA3D3185DAE9C003A92F8 /* rtl_ethtool.h */,
115 | 12EEA3D4185DAE9C003A92F8 /* rtltool.c */,
116 | 12EEA3D5185DAE9C003A92F8 /* rtltool.h */,
117 | );
118 | path = src;
119 | sourceTree = "";
120 | };
121 | 12EEA3E5185DAEBE003A92F8 /* r8168-8.037.00 */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 12EEA3E6185DAEBE003A92F8 /* autorun.sh */,
125 | 12EEA3E7185DAEBE003A92F8 /* Makefile */,
126 | 12EEA3E8185DAEBE003A92F8 /* README */,
127 | 12EEA3E9185DAEBE003A92F8 /* src */,
128 | );
129 | path = "r8168-8.037.00";
130 | sourceTree = "";
131 | };
132 | 12EEA3E9185DAEBE003A92F8 /* src */ = {
133 | isa = PBXGroup;
134 | children = (
135 | 12EEA3EA185DAEBE003A92F8 /* Makefile */,
136 | 12EEA3EB185DAEBE003A92F8 /* Makefile_linux24x */,
137 | 12EEA3EC185DAEBE003A92F8 /* r8168.h */,
138 | 12EEA3ED185DAEBE003A92F8 /* r8168_asf.c */,
139 | 12EEA3EE185DAEBE003A92F8 /* r8168_asf.h */,
140 | 12EEA3EF185DAEBE003A92F8 /* r8168_n.c */,
141 | 12EEA3F0185DAEBE003A92F8 /* rtl_eeprom.c */,
142 | 12EEA3F1185DAEBE003A92F8 /* rtl_eeprom.h */,
143 | 12EEA3F2185DAEBE003A92F8 /* rtltool.c */,
144 | 12EEA3F3185DAEBE003A92F8 /* rtltool.h */,
145 | );
146 | path = src;
147 | sourceTree = "";
148 | };
149 | 19C28FB6FE9D52B211CA2CBB /* Products */ = {
150 | isa = PBXGroup;
151 | children = (
152 | 32D94FD00562CBF700B6AF17 /* RealtekR1000SL.kext */,
153 | );
154 | name = Products;
155 | sourceTree = "";
156 | };
157 | 247142CAFF3F8F9811CA285C /* Source */ = {
158 | isa = PBXGroup;
159 | children = (
160 | 0FCB3C7F107F0A1600032BEC /* impl_defs.h */,
161 | 0FCB3C6F107F061300032BEC /* RTL8169.cpp */,
162 | 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */,
163 | 1A224C3EFF42367911CA2CB7 /* RealtekR1000SL.h */,
164 | 1A224C3FFF42367911CA2CB7 /* RealtekR1000SL.cpp */,
165 | 0F758A3E10790A83009EA5D9 /* R1000Regs.h */,
166 | 0F758A4510790AC5009EA5D9 /* mii.h */,
167 | 0FCB3C71107F062F00032BEC /* RTL8100.cpp */,
168 | );
169 | name = Source;
170 | sourceTree = "";
171 | };
172 | /* End PBXGroup section */
173 |
174 | /* Begin PBXHeadersBuildPhase section */
175 | 32D94FC50562CBF700B6AF17 /* Headers */ = {
176 | isa = PBXHeadersBuildPhase;
177 | buildActionMask = 2147483647;
178 | files = (
179 | 32D94FC60562CBF700B6AF17 /* RealtekR1000SL.h in Headers */,
180 | 0F758A3F10790A83009EA5D9 /* R1000Regs.h in Headers */,
181 | 0F758A4610790AC5009EA5D9 /* mii.h in Headers */,
182 | 0FCB3C80107F0A1600032BEC /* impl_defs.h in Headers */,
183 | );
184 | runOnlyForDeploymentPostprocessing = 0;
185 | };
186 | /* End PBXHeadersBuildPhase section */
187 |
188 | /* Begin PBXNativeTarget section */
189 | 32D94FC30562CBF700B6AF17 /* RealtekR1000SL */ = {
190 | isa = PBXNativeTarget;
191 | buildConfigurationList = 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "RealtekR1000SL" */;
192 | buildPhases = (
193 | 32D94FC50562CBF700B6AF17 /* Headers */,
194 | 32D94FC70562CBF700B6AF17 /* Resources */,
195 | 32D94FC90562CBF700B6AF17 /* Sources */,
196 | 32D94FCB0562CBF700B6AF17 /* Frameworks */,
197 | 32D94FCC0562CBF700B6AF17 /* Rez */,
198 | );
199 | buildRules = (
200 | );
201 | dependencies = (
202 | );
203 | name = RealtekR1000SL;
204 | productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions";
205 | productName = RealtekR1000SL;
206 | productReference = 32D94FD00562CBF700B6AF17 /* RealtekR1000SL.kext */;
207 | productType = "com.apple.product-type.kernel-extension.iokit";
208 | };
209 | /* End PBXNativeTarget section */
210 |
211 | /* Begin PBXProject section */
212 | 089C1669FE841209C02AAC07 /* Project object */ = {
213 | isa = PBXProject;
214 | attributes = {
215 | LastUpgradeCheck = 0440;
216 | ORGANIZATIONNAME = chucko.com;
217 | };
218 | buildConfigurationList = 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "RealtekR1000SL" */;
219 | compatibilityVersion = "Xcode 3.2";
220 | developmentRegion = English;
221 | hasScannedForEncodings = 1;
222 | knownRegions = (
223 | en,
224 | );
225 | mainGroup = 089C166AFE841209C02AAC07 /* RealtekR1000SL */;
226 | projectDirPath = "";
227 | projectRoot = "";
228 | targets = (
229 | 32D94FC30562CBF700B6AF17 /* RealtekR1000SL */,
230 | );
231 | };
232 | /* End PBXProject section */
233 |
234 | /* Begin PBXResourcesBuildPhase section */
235 | 32D94FC70562CBF700B6AF17 /* Resources */ = {
236 | isa = PBXResourcesBuildPhase;
237 | buildActionMask = 2147483647;
238 | files = (
239 | 32D94FC80562CBF700B6AF17 /* InfoPlist.strings in Resources */,
240 | );
241 | runOnlyForDeploymentPostprocessing = 0;
242 | };
243 | /* End PBXResourcesBuildPhase section */
244 |
245 | /* Begin PBXRezBuildPhase section */
246 | 32D94FCC0562CBF700B6AF17 /* Rez */ = {
247 | isa = PBXRezBuildPhase;
248 | buildActionMask = 2147483647;
249 | files = (
250 | );
251 | runOnlyForDeploymentPostprocessing = 0;
252 | };
253 | /* End PBXRezBuildPhase section */
254 |
255 | /* Begin PBXSourcesBuildPhase section */
256 | 32D94FC90562CBF700B6AF17 /* Sources */ = {
257 | isa = PBXSourcesBuildPhase;
258 | buildActionMask = 2147483647;
259 | files = (
260 | 32D94FCA0562CBF700B6AF17 /* RealtekR1000SL.cpp in Sources */,
261 | 0FCB3C6E107F05FF00032BEC /* RTL8168.cpp in Sources */,
262 | 0FCB3C70107F061300032BEC /* RTL8169.cpp in Sources */,
263 | 0FCB3C72107F062F00032BEC /* RTL8100.cpp in Sources */,
264 | );
265 | runOnlyForDeploymentPostprocessing = 0;
266 | };
267 | /* End PBXSourcesBuildPhase section */
268 |
269 | /* Begin PBXVariantGroup section */
270 | 089C167DFE841241C02AAC07 /* InfoPlist.strings */ = {
271 | isa = PBXVariantGroup;
272 | children = (
273 | 089C167EFE841241C02AAC07 /* English */,
274 | );
275 | name = InfoPlist.strings;
276 | sourceTree = "";
277 | };
278 | /* End PBXVariantGroup section */
279 |
280 | /* Begin XCBuildConfiguration section */
281 | 1DEB91DA08733DB10010E9CD /* Debug */ = {
282 | isa = XCBuildConfiguration;
283 | buildSettings = {
284 | ALWAYS_SEARCH_USER_PATHS = NO;
285 | ARCHS = "$(NATIVE_ARCH_ACTUAL)";
286 | CLANG_X86_VECTOR_INSTRUCTIONS = default;
287 | CODE_SIGN_IDENTITY = "-";
288 | COMBINE_HIDPI_IMAGES = YES;
289 | COPY_PHASE_STRIP = NO;
290 | CURRENT_PROJECT_VERSION = "$(MODULE_VERSION)";
291 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
292 | GCC_DYNAMIC_NO_PIC = NO;
293 | GCC_ENABLE_CPP_EXCEPTIONS = YES;
294 | GCC_ENABLE_CPP_RTTI = YES;
295 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
296 | GCC_MODEL_TUNING = "";
297 | GCC_OPTIMIZATION_LEVEL = 0;
298 | GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
299 | INFOPLIST_FILE = Info.plist;
300 | INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
301 | MODULE_NAME = org.chuko.driver.RealtekR1000SL;
302 | MODULE_VERSION = 3.1.2;
303 | PRODUCT_NAME = RealtekR1000SL;
304 | SDKROOT = macosx10.11;
305 | WRAPPER_EXTENSION = kext;
306 | };
307 | name = Debug;
308 | };
309 | 1DEB91DB08733DB10010E9CD /* Release */ = {
310 | isa = XCBuildConfiguration;
311 | buildSettings = {
312 | ALWAYS_SEARCH_USER_PATHS = NO;
313 | ARCHS = "$(NATIVE_ARCH_ACTUAL)";
314 | CLANG_X86_VECTOR_INSTRUCTIONS = default;
315 | CODE_SIGN_IDENTITY = "-";
316 | COMBINE_HIDPI_IMAGES = YES;
317 | CURRENT_PROJECT_VERSION = "$(MODULE_VERSION)";
318 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
319 | GCC_ENABLE_CPP_EXCEPTIONS = YES;
320 | GCC_ENABLE_CPP_RTTI = YES;
321 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
322 | GCC_MODEL_TUNING = "";
323 | GCC_VERSION = "";
324 | INFOPLIST_FILE = Info.plist;
325 | INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Extensions";
326 | MODULE_NAME = org.chuko.driver.RealtekR1000SL;
327 | MODULE_VERSION = 3.1.2;
328 | PRODUCT_NAME = RealtekR1000SL;
329 | SDKROOT = macosx10.11;
330 | WRAPPER_EXTENSION = kext;
331 | };
332 | name = Release;
333 | };
334 | 1DEB91DE08733DB10010E9CD /* Debug */ = {
335 | isa = XCBuildConfiguration;
336 | buildSettings = {
337 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
338 | BUILD_VARIANTS = normal;
339 | GCC_C_LANGUAGE_STANDARD = gnu99;
340 | GCC_ENABLE_OBJC_EXCEPTIONS = NO;
341 | GCC_ENABLE_PASCAL_STRINGS = NO;
342 | GCC_ENABLE_SSE3_EXTENSIONS = YES;
343 | GCC_MODEL_TUNING = "";
344 | GCC_OPTIMIZATION_LEVEL = s;
345 | GCC_PREPROCESSOR_DEFINITIONS = DEBUG;
346 | GCC_VERSION = "";
347 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
348 | GCC_WARN_MISSING_PARENTHESES = YES;
349 | GCC_WARN_SHADOW = YES;
350 | GCC_WARN_UNINITIALIZED_AUTOS = NO;
351 | GCC_WARN_UNUSED_VARIABLE = YES;
352 | INSTALL_OWNER = root;
353 | MODULE_VERSION = 3.0.3d1;
354 | ONLY_ACTIVE_ARCH = NO;
355 | OTHER_CFLAGS = (
356 | "-DCONFIG_DOWN_SPEED_100",
357 | "-DNO_R1000_CHECKSUM_OFFLOAD",
358 | "-DPCI_ERROR",
359 | );
360 | SDKROOT = "";
361 | VALID_ARCHS = "i386 x86_64";
362 | };
363 | name = Debug;
364 | };
365 | 1DEB91DF08733DB10010E9CD /* Release */ = {
366 | isa = XCBuildConfiguration;
367 | buildSettings = {
368 | ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
369 | GCC_C_LANGUAGE_STANDARD = gnu99;
370 | GCC_ENABLE_OBJC_EXCEPTIONS = NO;
371 | GCC_ENABLE_PASCAL_STRINGS = NO;
372 | GCC_ENABLE_SSE3_EXTENSIONS = YES;
373 | GCC_MODEL_TUNING = "";
374 | GCC_OPTIMIZATION_LEVEL = s;
375 | GCC_VERSION = com.apple.compilers.llvmgcc42;
376 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
377 | GCC_WARN_MISSING_PARENTHESES = YES;
378 | GCC_WARN_SHADOW = YES;
379 | GCC_WARN_UNINITIALIZED_AUTOS = NO;
380 | GCC_WARN_UNUSED_VARIABLE = YES;
381 | INSTALL_OWNER = root;
382 | MODULE_VERSION = 3.0.4d1;
383 | ONLY_ACTIVE_ARCH = NO;
384 | SDKROOT = "";
385 | VALID_ARCHS = "i386 x86_64";
386 | };
387 | name = Release;
388 | };
389 | /* End XCBuildConfiguration section */
390 |
391 | /* Begin XCConfigurationList section */
392 | 1DEB91D908733DB10010E9CD /* Build configuration list for PBXNativeTarget "RealtekR1000SL" */ = {
393 | isa = XCConfigurationList;
394 | buildConfigurations = (
395 | 1DEB91DA08733DB10010E9CD /* Debug */,
396 | 1DEB91DB08733DB10010E9CD /* Release */,
397 | );
398 | defaultConfigurationIsVisible = 0;
399 | defaultConfigurationName = Debug;
400 | };
401 | 1DEB91DD08733DB10010E9CD /* Build configuration list for PBXProject "RealtekR1000SL" */ = {
402 | isa = XCConfigurationList;
403 | buildConfigurations = (
404 | 1DEB91DE08733DB10010E9CD /* Debug */,
405 | 1DEB91DF08733DB10010E9CD /* Release */,
406 | );
407 | defaultConfigurationIsVisible = 0;
408 | defaultConfigurationName = Debug;
409 | };
410 | /* End XCConfigurationList section */
411 | };
412 | rootObject = 089C1669FE841209C02AAC07 /* Project object */;
413 | }
414 |
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SergeySlice/RealtekLANv3/379ce46ded5df358714dcace6fb07efd11c6ff3e/RealtekR1000SL.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/project.xcworkspace/xcuserdata/Slice.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/slice.pbxuser:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | 089C1669FE841209C02AAC07 /* Project object */ = {
4 | activeBuildConfigurationName = Release;
5 | activeTarget = 32D94FC30562CBF700B6AF17 /* RealtekR1000SL */;
6 | addToTargets = (
7 | );
8 | codeSenseManager = 1281C1B516EDE1E600A58CCC /* Code sense */;
9 | perUserDictionary = {
10 | PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
11 | PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
12 | PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
13 | PBXFileTableDataSourceColumnWidthsKey = (
14 | 20,
15 | 649,
16 | 20,
17 | 48,
18 | 43,
19 | 43,
20 | 20,
21 | );
22 | PBXFileTableDataSourceColumnsKey = (
23 | PBXFileDataSource_FiletypeID,
24 | PBXFileDataSource_Filename_ColumnID,
25 | PBXFileDataSource_Built_ColumnID,
26 | PBXFileDataSource_ObjectSize_ColumnID,
27 | PBXFileDataSource_Errors_ColumnID,
28 | PBXFileDataSource_Warnings_ColumnID,
29 | PBXFileDataSource_Target_ColumnID,
30 | );
31 | };
32 | PBXPerProjectTemplateStateSaveDate = 388589946;
33 | PBXWorkspaceStateSaveDate = 388589946;
34 | };
35 | perUserProjectItems = {
36 | 125CDCD916F058FA0087E6D0 /* PBXTextBookmark */ = 125CDCD916F058FA0087E6D0 /* PBXTextBookmark */;
37 | 125CDE6516F8A8240087E6D0 /* PBXTextBookmark */ = 125CDE6516F8A8240087E6D0 /* PBXTextBookmark */;
38 | 1281C94516EE186A00A58CCC /* PBXTextBookmark */ = 1281C94516EE186A00A58CCC /* PBXTextBookmark */;
39 | 1281C94616EE186A00A58CCC /* PBXTextBookmark */ = 1281C94616EE186A00A58CCC /* PBXTextBookmark */;
40 | 1281C94716EE186A00A58CCC /* PBXTextBookmark */ = 1281C94716EE186A00A58CCC /* PBXTextBookmark */;
41 | 1281C94916EE186A00A58CCC /* PBXTextBookmark */ = 1281C94916EE186A00A58CCC /* PBXTextBookmark */;
42 | 1281C94B16EE186A00A58CCC /* PBXTextBookmark */ = 1281C94B16EE186A00A58CCC /* PBXTextBookmark */;
43 | 1281C94D16EE186A00A58CCC /* PBXTextBookmark */ = 1281C94D16EE186A00A58CCC /* PBXTextBookmark */;
44 | 1281C94F16EE186A00A58CCC /* PBXTextBookmark */ = 1281C94F16EE186A00A58CCC /* PBXTextBookmark */;
45 | 1281C95116EE186A00A58CCC /* PBXTextBookmark */ = 1281C95116EE186A00A58CCC /* PBXTextBookmark */;
46 | 1281C95316EE186A00A58CCC /* PBXTextBookmark */ = 1281C95316EE186A00A58CCC /* PBXTextBookmark */;
47 | 1281C95516EE186A00A58CCC /* PBXTextBookmark */ = 1281C95516EE186A00A58CCC /* PBXTextBookmark */;
48 | 1281C95816EE186A00A58CCC /* PBXTextBookmark */ = 1281C95816EE186A00A58CCC /* PBXTextBookmark */;
49 | 1281C95A16EE186A00A58CCC /* PBXTextBookmark */ = 1281C95A16EE186A00A58CCC /* PBXTextBookmark */;
50 | 12C9C9E216FAF66600DC5408 /* PBXTextBookmark */ = 12C9C9E216FAF66600DC5408 /* PBXTextBookmark */;
51 | 12C9C9E316FAF66600DC5408 /* PBXTextBookmark */ = 12C9C9E316FAF66600DC5408 /* PBXTextBookmark */;
52 | 12C9C9E416FAF66600DC5408 /* PBXTextBookmark */ = 12C9C9E416FAF66600DC5408 /* PBXTextBookmark */;
53 | 12E3C5BA1729693500C3BCE7 /* PBXTextBookmark */ = 12E3C5BA1729693500C3BCE7 /* PBXTextBookmark */;
54 | 12E3C5C51729698F00C3BCE7 /* PlistBookmark */ = 12E3C5C51729698F00C3BCE7 /* PlistBookmark */;
55 | 12E3C5C61729698F00C3BCE7 /* PBXTextBookmark */ = 12E3C5C61729698F00C3BCE7 /* PBXTextBookmark */;
56 | 12E3C5CD17296A0E00C3BCE7 /* PBXTextBookmark */ = 12E3C5CD17296A0E00C3BCE7 /* PBXTextBookmark */;
57 | };
58 | sourceControlManager = 1281C1B416EDE1E600A58CCC /* Source Control */;
59 | userBuildSettings = {
60 | };
61 | };
62 | 0F758A3E10790A83009EA5D9 /* R1000Regs.h */ = {
63 | uiCtxt = {
64 | sepNavIntBoundsRect = "{{0, 0}, {758, 10322}}";
65 | sepNavSelRange = "{5658, 0}";
66 | sepNavVisRange = "{4567, 976}";
67 | };
68 | };
69 | 0F758A4510790AC5009EA5D9 /* mii.h */ = {
70 | uiCtxt = {
71 | sepNavIntBoundsRect = "{{0, 0}, {878, 884}}";
72 | sepNavSelRange = "{2266, 0}";
73 | sepNavVisRange = "{1324, 1178}";
74 | };
75 | };
76 | 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */ = {
77 | uiCtxt = {
78 | sepNavIntBoundsRect = "{{0, 0}, {827, 133367}}";
79 | sepNavSelRange = "{6003, 0}";
80 | sepNavVisRange = "{5857, 956}";
81 | sepNavWindowFrame = "{{61, 69}, {868, 762}}";
82 | };
83 | };
84 | 0FCB3C6F107F061300032BEC /* RTL8169.cpp */ = {
85 | uiCtxt = {
86 | sepNavIntBoundsRect = "{{0, 0}, {827, 897}}";
87 | sepNavSelRange = "{0, 0}";
88 | sepNavVisRange = "{1314, 438}";
89 | };
90 | };
91 | 0FCB3C71107F062F00032BEC /* RTL8100.cpp */ = {
92 | uiCtxt = {
93 | sepNavIntBoundsRect = "{{0, 0}, {827, 43784}}";
94 | sepNavSelRange = "{90770, 18}";
95 | sepNavVisRange = "{1111, 1109}";
96 | sepNavWindowFrame = "{{38, 90}, {868, 762}}";
97 | };
98 | };
99 | 0FCB3C7F107F0A1600032BEC /* impl_defs.h */ = {
100 | uiCtxt = {
101 | sepNavIntBoundsRect = "{{0, 0}, {878, 780}}";
102 | sepNavSelRange = "{0, 0}";
103 | sepNavVisRange = "{535, 1552}";
104 | };
105 | };
106 | 1252BE0416E9CAB8002467B3 /* r8168.h */ = {
107 | uiCtxt = {
108 | sepNavIntBoundsRect = "{{0, 0}, {758, 16861}}";
109 | sepNavSelRange = "{36512, 13}";
110 | sepNavVisRange = "{36345, 748}";
111 | };
112 | };
113 | 1252BE0716E9CAB8002467B3 /* r8168_n.c */ = {
114 | uiCtxt = {
115 | sepNavIntBoundsRect = "{{0, 0}, {758, 227409}}";
116 | sepNavSelRange = "{30849, 16}";
117 | sepNavVisRange = "{33024, 851}";
118 | sepNavWindowFrame = "{{16, 55}, {868, 762}}";
119 | };
120 | };
121 | 125CDCCF16F058830087E6D0 /* r8101.h */ = {
122 | uiCtxt = {
123 | sepNavIntBoundsRect = "{{0, 0}, {758, 10673}}";
124 | sepNavSelRange = "{1373, 8}";
125 | sepNavVisRange = "{632, 1159}";
126 | };
127 | };
128 | 125CDCD016F058830087E6D0 /* r8101_n.c */ = {
129 | uiCtxt = {
130 | sepNavFolds = "{\n c = (\n {\n r = \"{177010, 831}\";\n s = 0;\n },\n {\n r = \"{177875, 718}\";\n s = 0;\n },\n {\n r = \"{178627, 718}\";\n s = 0;\n },\n {\n r = \"{179379, 876}\";\n s = 0;\n },\n {\n r = \"{180289, 1120}\";\n s = 0;\n },\n {\n r = \"{181443, 747}\";\n s = 0;\n },\n {\n r = \"{187464, 643}\";\n s = 0;\n }\n );\n r = \"{0, 220052}\";\n s = 0;\n}";
131 | sepNavIntBoundsRect = "{{0, 0}, {827, 107393}}";
132 | sepNavSelRange = "{193724, 8}";
133 | sepNavVisRange = "{193254, 805}";
134 | sepNavWindowFrame = "{{61, 69}, {868, 762}}";
135 | };
136 | };
137 | 125CDCD916F058FA0087E6D0 /* PBXTextBookmark */ = {
138 | isa = PBXTextBookmark;
139 | fRef = 125CDCCF16F058830087E6D0 /* r8101.h */;
140 | name = "r8101.h: 1";
141 | rLen = 0;
142 | rLoc = 0;
143 | rType = 0;
144 | vrLen = 628;
145 | vrLoc = 19679;
146 | };
147 | 125CDE6516F8A8240087E6D0 /* PBXTextBookmark */ = {
148 | isa = PBXTextBookmark;
149 | fRef = 125CDCD016F058830087E6D0 /* r8101_n.c */;
150 | name = "r8101_n.c: 7527";
151 | rLen = 8;
152 | rLoc = 199370;
153 | rType = 0;
154 | vrLen = 805;
155 | vrLoc = 198900;
156 | };
157 | 1281C1B416EDE1E600A58CCC /* Source Control */ = {
158 | isa = PBXSourceControlManager;
159 | fallbackIsa = XCSourceControlManager;
160 | isSCMEnabled = 0;
161 | scmConfiguration = {
162 | repositoryNamesForRoots = {
163 | "" = "";
164 | };
165 | };
166 | };
167 | 1281C1B516EDE1E600A58CCC /* Code sense */ = {
168 | isa = PBXCodeSenseManager;
169 | indexTemplatePath = "";
170 | };
171 | 1281C94516EE186A00A58CCC /* PBXTextBookmark */ = {
172 | isa = PBXTextBookmark;
173 | fRef = 1252BE0716E9CAB8002467B3 /* r8168_n.c */;
174 | name = "r8168_n.c: 1755";
175 | rLen = 7;
176 | rLoc = 45591;
177 | rType = 0;
178 | vrLen = 791;
179 | vrLoc = 45008;
180 | };
181 | 1281C94616EE186A00A58CCC /* PBXTextBookmark */ = {
182 | isa = PBXTextBookmark;
183 | fRef = 0FCB3C7F107F0A1600032BEC /* impl_defs.h */;
184 | name = "impl_defs.h: 1";
185 | rLen = 0;
186 | rLoc = 0;
187 | rType = 0;
188 | vrLen = 1552;
189 | vrLoc = 535;
190 | };
191 | 1281C94716EE186A00A58CCC /* PBXTextBookmark */ = {
192 | isa = PBXTextBookmark;
193 | fRef = 1281C94816EE186A00A58CCC /* ipc_types.h */;
194 | name = "ipc_types.h: 1";
195 | rLen = 0;
196 | rLoc = 0;
197 | rType = 0;
198 | vrLen = 1575;
199 | vrLoc = 0;
200 | };
201 | 1281C94816EE186A00A58CCC /* ipc_types.h */ = {
202 | isa = PBXFileReference;
203 | lastKnownFileType = sourcecode.c.h;
204 | name = ipc_types.h;
205 | path = /System/Library/Frameworks/Kernel.framework/Headers/ipc/ipc_types.h;
206 | sourceTree = "";
207 | };
208 | 1281C94916EE186A00A58CCC /* PBXTextBookmark */ = {
209 | isa = PBXTextBookmark;
210 | fRef = 1281C94A16EE186A00A58CCC /* ethernet.h */;
211 | name = "ethernet.h: 1";
212 | rLen = 0;
213 | rLoc = 0;
214 | rType = 0;
215 | vrLen = 1507;
216 | vrLoc = 0;
217 | };
218 | 1281C94A16EE186A00A58CCC /* ethernet.h */ = {
219 | isa = PBXFileReference;
220 | lastKnownFileType = sourcecode.c.h;
221 | name = ethernet.h;
222 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/ethernet.h;
223 | sourceTree = "";
224 | };
225 | 1281C94B16EE186A00A58CCC /* PBXTextBookmark */ = {
226 | isa = PBXTextBookmark;
227 | fRef = 1281C94C16EE186A00A58CCC /* if.h */;
228 | name = "if.h: 1";
229 | rLen = 0;
230 | rLoc = 0;
231 | rType = 0;
232 | vrLen = 1806;
233 | vrLoc = 0;
234 | };
235 | 1281C94C16EE186A00A58CCC /* if.h */ = {
236 | isa = PBXFileReference;
237 | lastKnownFileType = sourcecode.c.h;
238 | name = if.h;
239 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if.h;
240 | sourceTree = "";
241 | };
242 | 1281C94D16EE186A00A58CCC /* PBXTextBookmark */ = {
243 | isa = PBXTextBookmark;
244 | fRef = 1281C94E16EE186A00A58CCC /* if_arp.h */;
245 | name = "if_arp.h: 1";
246 | rLen = 0;
247 | rLoc = 0;
248 | rType = 0;
249 | vrLen = 1799;
250 | vrLoc = 0;
251 | };
252 | 1281C94E16EE186A00A58CCC /* if_arp.h */ = {
253 | isa = PBXFileReference;
254 | lastKnownFileType = sourcecode.c.h;
255 | name = if_arp.h;
256 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if_arp.h;
257 | sourceTree = "";
258 | };
259 | 1281C94F16EE186A00A58CCC /* PBXTextBookmark */ = {
260 | isa = PBXTextBookmark;
261 | fRef = 1281C95016EE186A00A58CCC /* if_media.h */;
262 | name = "if_media.h: 1";
263 | rLen = 0;
264 | rLoc = 0;
265 | rType = 0;
266 | vrLen = 1715;
267 | vrLoc = 0;
268 | };
269 | 1281C95016EE186A00A58CCC /* if_media.h */ = {
270 | isa = PBXFileReference;
271 | lastKnownFileType = sourcecode.c.h;
272 | name = if_media.h;
273 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if_media.h;
274 | sourceTree = "";
275 | };
276 | 1281C95116EE186A00A58CCC /* PBXTextBookmark */ = {
277 | isa = PBXTextBookmark;
278 | fRef = 1281C95216EE186A00A58CCC /* if_var.h */;
279 | name = "if_var.h: 1";
280 | rLen = 0;
281 | rLoc = 0;
282 | rType = 0;
283 | vrLen = 1806;
284 | vrLoc = 0;
285 | };
286 | 1281C95216EE186A00A58CCC /* if_var.h */ = {
287 | isa = PBXFileReference;
288 | lastKnownFileType = sourcecode.c.h;
289 | name = if_var.h;
290 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/if_var.h;
291 | sourceTree = "";
292 | };
293 | 1281C95316EE186A00A58CCC /* PBXTextBookmark */ = {
294 | isa = PBXTextBookmark;
295 | fRef = 1281C95416EE186A00A58CCC /* init.h */;
296 | name = "init.h: 1";
297 | rLen = 0;
298 | rLoc = 0;
299 | rType = 0;
300 | vrLen = 1676;
301 | vrLoc = 0;
302 | };
303 | 1281C95416EE186A00A58CCC /* init.h */ = {
304 | isa = PBXFileReference;
305 | lastKnownFileType = sourcecode.c.h;
306 | name = init.h;
307 | path = /System/Library/Frameworks/Kernel.framework/Headers/net/init.h;
308 | sourceTree = "";
309 | };
310 | 1281C95516EE186A00A58CCC /* PBXTextBookmark */ = {
311 | isa = PBXTextBookmark;
312 | fRef = 1281C95616EE186A00A58CCC /* IONetworkController.h */;
313 | name = "IONetworkController.h: 924";
314 | rLen = 1;
315 | rLoc = 41877;
316 | rType = 0;
317 | vrLen = 2256;
318 | vrLoc = 41314;
319 | };
320 | 1281C95616EE186A00A58CCC /* IONetworkController.h */ = {
321 | isa = PBXFileReference;
322 | lastKnownFileType = sourcecode.c.h;
323 | name = IONetworkController.h;
324 | path = /Users/slice/Projects/Chameleons/chameleon/branches/Chimera/Dev/i386/include/IOKit/network/IONetworkController.h;
325 | sourceTree = "";
326 | };
327 | 1281C95816EE186A00A58CCC /* PBXTextBookmark */ = {
328 | isa = PBXTextBookmark;
329 | fRef = 0F758A4510790AC5009EA5D9 /* mii.h */;
330 | name = "mii.h: 50";
331 | rLen = 0;
332 | rLoc = 2266;
333 | rType = 0;
334 | vrLen = 1178;
335 | vrLoc = 1324;
336 | };
337 | 1281C95A16EE186A00A58CCC /* PBXTextBookmark */ = {
338 | isa = PBXTextBookmark;
339 | fRef = 0F758A3E10790A83009EA5D9 /* R1000Regs.h */;
340 | name = "R1000Regs.h: 632";
341 | rLen = 0;
342 | rLoc = 18004;
343 | rType = 0;
344 | vrLen = 1777;
345 | vrLoc = 16662;
346 | };
347 | 12C9C9E216FAF66600DC5408 /* PBXTextBookmark */ = {
348 | isa = PBXTextBookmark;
349 | fRef = 1A224C3FFF42367911CA2CB7 /* RealtekR1000SL.cpp */;
350 | name = "RealtekR1000SL.cpp: 3423";
351 | rLen = 22;
352 | rLoc = 86035;
353 | rType = 0;
354 | vrLen = 655;
355 | vrLoc = 1274;
356 | };
357 | 12C9C9E316FAF66600DC5408 /* PBXTextBookmark */ = {
358 | isa = PBXTextBookmark;
359 | fRef = 1A224C3EFF42367911CA2CB7 /* RealtekR1000SL.h */;
360 | name = "RealtekR1000SL.h: 187";
361 | rLen = 10;
362 | rLoc = 5512;
363 | rType = 0;
364 | vrLen = 503;
365 | vrLoc = 1922;
366 | };
367 | 12C9C9E416FAF66600DC5408 /* PBXTextBookmark */ = {
368 | isa = PBXTextBookmark;
369 | fRef = 0FCB3C6F107F061300032BEC /* RTL8169.cpp */;
370 | name = "RTL8169.cpp: 1";
371 | rLen = 0;
372 | rLoc = 0;
373 | rType = 0;
374 | vrLen = 438;
375 | vrLoc = 1314;
376 | };
377 | 12E3C5BA1729693500C3BCE7 /* PBXTextBookmark */ = {
378 | isa = PBXTextBookmark;
379 | fRef = 0FCB3C71107F062F00032BEC /* RTL8100.cpp */;
380 | name = "RTL8100.cpp: 3353";
381 | rLen = 18;
382 | rLoc = 90770;
383 | rType = 0;
384 | vrLen = 1109;
385 | vrLoc = 1111;
386 | };
387 | 12E3C5C51729698F00C3BCE7 /* PlistBookmark */ = {
388 | isa = PlistBookmark;
389 | fRef = 32D94FCF0562CBF700B6AF17 /* Info.plist */;
390 | fallbackIsa = PBXBookmark;
391 | isK = 0;
392 | kPath = (
393 | CFBundleSignature,
394 | );
395 | name = "/Users/slice/Projects/RealtekR1000SL_src_[25.04.2013]/Info.plist";
396 | rLen = 0;
397 | rLoc = 9223372036854775807;
398 | };
399 | 12E3C5C61729698F00C3BCE7 /* PBXTextBookmark */ = {
400 | isa = PBXTextBookmark;
401 | fRef = 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */;
402 | name = "RTL8168.cpp: 10063";
403 | rLen = 10;
404 | rLoc = 288695;
405 | rType = 0;
406 | vrLen = 727;
407 | vrLoc = 1806;
408 | };
409 | 12E3C5CD17296A0E00C3BCE7 /* PBXTextBookmark */ = {
410 | isa = PBXTextBookmark;
411 | fRef = 0FCB3C6D107F05FF00032BEC /* RTL8168.cpp */;
412 | name = "RTL8168.cpp: 228";
413 | rLen = 0;
414 | rLoc = 6003;
415 | rType = 0;
416 | vrLen = 956;
417 | vrLoc = 5857;
418 | };
419 | 1A224C3EFF42367911CA2CB7 /* RealtekR1000SL.h */ = {
420 | uiCtxt = {
421 | sepNavIntBoundsRect = "{{0, 0}, {827, 7436}}";
422 | sepNavSelRange = "{5512, 10}";
423 | sepNavVisRange = "{1922, 503}";
424 | };
425 | };
426 | 1A224C3FFF42367911CA2CB7 /* RealtekR1000SL.cpp */ = {
427 | uiCtxt = {
428 | sepNavFolds = "{\n c = (\n {\n r = \"{39310, 337}\";\n s = 0;\n },\n {\n r = \"{39757, 468}\";\n s = 0;\n }\n );\n r = \"{0, 91245}\";\n s = 0;\n}";
429 | sepNavIntBoundsRect = "{{0, 0}, {827, 46748}}";
430 | sepNavSelRange = "{85232, 22}";
431 | sepNavVisRange = "{1274, 655}";
432 | sepNavWindowFrame = "{{15, 111}, {868, 762}}";
433 | };
434 | };
435 | 32D94FC30562CBF700B6AF17 /* RealtekR1000SL */ = {
436 | activeExec = 0;
437 | };
438 | }
439 |
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/xcuserdata/Slice.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/xcuserdata/Slice.xcuserdatad/xcschemes/RealtekR1000SL.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
42 |
43 |
44 |
45 |
51 |
52 |
54 |
55 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/RealtekR1000SL.xcodeproj/xcuserdata/Slice.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | RealtekR1000SL.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 32D94FC30562CBF700B6AF17
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/impl_defs.h:
--------------------------------------------------------------------------------
1 | /*
2 | * impl_defs.h - Miscellaneous definitions for implementation use
3 | * RealtekR1000SL
4 | *
5 | * Created by Chuck Fry on 10/8/09.
6 | * Copyright 2009 Chuck Fry. All rights reserved.
7 | *
8 | * This software incorporates code from Realtek's open source Linux drivers
9 | * and the open source Mac OS X project RealtekR1000 by Dmitri Arekhta,
10 | * as modified by PSYSTAR Corporation.
11 | *
12 | * Copyright(c) 2009 Realtek Semiconductor Corp. All rights reserved.
13 | * copyright PSYSTAR Corporation, 2008
14 | * 2006 (c) Dmitri Arekhta (DaemonES@gmail.com)
15 | *
16 | * This program is free software; you can redistribute it and/or
17 | * modify it under the terms of the GNU General Public License
18 | * as published by the Free Software Foundation; either version 2
19 | * of the License, or (at your option) any later version.
20 | *
21 | * This program is distributed in the hope that it will be useful,
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 | * GNU General Public License for more details.
25 | *
26 | * You should have received a copy of the GNU General Public License
27 | * along with this program; if not, write to the Free Software
28 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 | */
30 |
31 |
32 |
33 | // Implementation macros
34 | #define RELEASE(x) do { if(x) { (x)->release(); (x) = 0; } } while(0)
35 | // copied from AppleRTL8139Ethernet source
36 | #define BUMP_NET_COUNTER(x) do { netStats->x += 1; } while(0)
37 | #define BUMP_ETHER_COUNTER(x) do { etherStats->dot3StatsEntry.x += 1; } while(0)
38 | #define BUMP_ETHER_RX_COUNTER(x) do { etherStats->dot3RxExtraEntry.x += 1; } while(0)
39 | #define BUMP_ETHER_TX_COUNTER(x) do { etherStats->dot3TxExtraEntry.x += 1; } while(0)
40 |
41 | enum
42 | {
43 | kActivationLevelNone = 0, /* adapter shut off */
44 | kActivationLevelKDP, /* adapter partially up to support KDP */
45 | kActivationLevelBSD /* adapter fully up to support KDP and BSD */
46 | };
47 |
48 | // Used in configuration description
49 | struct RtlChipInfo
50 | {
51 | const char *name;
52 | u16 mcfg;
53 | u16 max_desc; /* Maximum # of Rx/Tx buffer descriptors */
54 | u32 RCR_Cfg; /* Base value for RxConfig register */
55 | u32 RxConfigMask; /* Clears the bits supported by this chip */
56 | u16 jumbo_frame_sz; /* Max size of jumbo frame; 0 = not capable */
57 | u16 efuse; /* Whether or not chip supports efuse */
58 | };
59 |
--------------------------------------------------------------------------------
/mii.h:
--------------------------------------------------------------------------------
1 | /* This driver based on R1000 Linux Driver for Realtek controllers.
2 | * It's not supported by Realtek company, so use it for your own risk.
3 | * 2006 (c) Dmitri Arekhta (DaemonES@gmail.com)
4 | *
5 | * This program is free software; you can redistribute it and/or
6 | * modify it under the terms of the GNU General Public License
7 | * as published by the Free Software Foundation; either version 2
8 | * of the License, or (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program; if not, write to the Free Software
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 | *
19 | *****************************************************************
20 | *
21 | * MODIFIED by PSYSTAR, 2008 -- (Rudy Pedraza)
22 | * -- all changes released under GPL as required
23 | * -- changes made to code are copyright PSYSTAR Corporation, 2008
24 | **** Enhancement Log
25 | * - added sleep/wake DHCP fix for
26 | * - changed tx/rx interrupt handling, 2x speedup
27 | * - added support for multiple NIC's, driver didnt play nice before
28 | * - fixed com.apple.kernel & com.apple.kpi dependencies, you cant use both (warning now, future error)
29 | * - cleaned up Info.plist, fixed matching
30 | *
31 | *****************************************************************
32 | *
33 | * MODIFIED by Chuck Fry (chucko@chucko.com) 2009
34 | * -- released under GPL
35 | **** Enhancement log
36 | * - 64 bit clean
37 | * - Handle 64 bit pointers as appropriate
38 | * - you can safely ignore compiler warning "Right shift count >= width of type" on 32 bit platforms
39 | * - fix compiler errors in increaseActivationLevel()
40 | * - better thread safety for outputPacket()
41 | * - added liberal comments where I needed to figure out what was happening
42 | *
43 | *****************************************************************
44 | *
45 | * modified by Slice 2013
46 | * -- updated according latest linux's sources r8168-8.035.00, 2012
47 | * -- added speed check
48 | * -- warning eliminatings
49 | *
50 | ******************************************************************
51 | */
52 |
53 | #ifndef _MII_H_
54 | #define _MII_H_
55 |
56 | #define AUTONEG_ENABLE 0x01
57 | #define AUTONEG_DISABLE 0x02
58 |
59 | #define DUPLEX_HALF 0x01
60 | #define DUPLEX_FULL 0x02
61 |
62 | #define SPEED_10 0x01
63 | #define SPEED_100 0x02
64 | #define SPEED_1000 0x03
65 |
66 |
67 | #endif
68 |
--------------------------------------------------------------------------------
/r8101-1.024.00/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SergeySlice/RealtekLANv3/379ce46ded5df358714dcace6fb07efd11c6ff3e/r8101-1.024.00/.DS_Store
--------------------------------------------------------------------------------
/r8101-1.024.00/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | #
3 | # r8101 is the Linux device driver released for Realtek Fast Ethernet
4 | # controllers with PCI-Express interface.
5 | #
6 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
7 | #
8 | # This program is free software; you can redistribute it and/or modify it
9 | # under the terms of the GNU General Public License as published by the Free
10 | # Software Foundation; either version 2 of the License, or (at your option)
11 | # any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful, but WITHOUT
14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 | # more details.
17 | #
18 | # You should have received a copy of the GNU General Public License along with
19 | # this program; if not, see .
20 | #
21 | # Author:
22 | # Realtek NIC software team
23 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
24 | #
25 | ################################################################################
26 |
27 | ################################################################################
28 | # This product is covered by one or more of the following patents:
29 | # US6,570,884, US6,115,776, and US6,327,625.
30 | ################################################################################
31 |
32 | KFLAG := 2$(shell uname -r | sed -ne 's/^2\.[4]\..*/4/p')x
33 |
34 | all: clean modules install
35 |
36 | modules:
37 | ifeq ($(KFLAG),24x)
38 | $(MAKE) -C src/ -f Makefile_linux24x modules
39 | else
40 | $(MAKE) -C src/ modules
41 | endif
42 |
43 | clean:
44 | ifeq ($(KFLAG),24x)
45 | $(MAKE) -C src/ -f Makefile_linux24x clean
46 | else
47 | $(MAKE) -C src/ clean
48 | endif
49 |
50 | install:
51 | ifeq ($(KFLAG),24x)
52 | $(MAKE) -C src/ -f Makefile_linux24x install
53 | else
54 | $(MAKE) -C src/ install
55 | endif
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/r8101-1.024.00/autorun.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # invoke insmod with all arguments we got
4 | # and use a pathname, as insmod doesn't look in . by default
5 |
6 | TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net -name realtek -type d)
7 | if [ "$TARGET_PATH" = "" ]; then
8 | TARGET_PATH=/lib/modules/$(uname -r)/kernel/drivers/net
9 | fi
10 | echo
11 | echo "Check old driver and unload it."
12 | check=`lsmod | grep r8169`
13 | if [ "$check" != "" ]; then
14 | echo "rmmod r8169"
15 | /sbin/rmmod r8169
16 | fi
17 |
18 | check=`lsmod | grep r8101`
19 | if [ "$check" != "" ]; then
20 | echo "rmmod r8101"
21 | /sbin/rmmod r8101
22 | fi
23 |
24 | echo "Build the module and install"
25 | echo "-------------------------------" >> log.txt
26 | date 1>>log.txt
27 | make all 1>>log.txt || exit 1
28 | module=`ls src/*.ko`
29 | module=${module#src/}
30 | module=${module%.ko}
31 |
32 | if [ "$module" = "" ]; then
33 | echo "No driver exists!!!"
34 | exit 1
35 | elif [ "$module" != "r8169" ]; then
36 | if test -e $TARGET_PATH/r8169.ko ; then
37 | echo "Backup r8169.ko"
38 | if test -e $TARGET_PATH/r8169.bak ; then
39 | i=0
40 | while test -e $TARGET_PATH/r8169.bak$i
41 | do
42 | i=$(($i+1))
43 | done
44 | echo "rename r8169.ko to r8169.bak$i"
45 | mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak$i
46 | else
47 | echo "rename r8169.ko to r8169.bak"
48 | mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak
49 | fi
50 | fi
51 | fi
52 |
53 | echo "DEPMOD $(uname -r)"
54 | depmod `uname -r`
55 | echo "load module $module"
56 | modprobe $module
57 |
58 | is_update_initramfs=n
59 | distrib_list="ubuntu debian"
60 |
61 | if [ -r /etc/debian_version ]; then
62 | is_update_initramfs=y
63 | elif [ -r /etc/lsb-release ]; then
64 | for distrib in $distrib_list
65 | do
66 | /bin/grep -i "$distrib" /etc/lsb-release 2>&1 /dev/null && \
67 | is_update_initramfs=y && break
68 | done
69 | fi
70 |
71 | if [ "$is_update_initramfs" = "y" ]; then
72 | if which update-initramfs >/dev/null ; then
73 | echo "Updating initramfs. Please wait."
74 | update-initramfs -u -k $(uname -r)
75 | else
76 | echo "update-initramfs: command not found"
77 | exit 1
78 | fi
79 | fi
80 |
81 | echo "Completed."
82 | exit 0
83 |
84 |
--------------------------------------------------------------------------------
/r8101-1.024.00/readme:
--------------------------------------------------------------------------------
1 |
2 |
3 | This is the Linux device driver released for RealTek RTL8101E, RTL8102E(L) and RTL8103E(L), the Fast Ethernet controller with PCI-Express interface.
4 |
5 |
6 |
7 | - kernel source tree (supported Linux kernel 2.6.x and 2.4.x)
8 | - For linux kernel 2.4.x, this driver supports linux kernel 2.4.20 and latter.
9 | - compiler/binutils for kernel compilation
10 |
11 |
12 | Unpack the tarball :
13 | # tar vjxf r8101-1.aaa.bb.tar.bz2
14 |
15 | Change to the directory:
16 | # cd r8101-1.aaa.bb
17 |
18 | If you are running the target kernel, then you should be able to do :
19 |
20 | # ./autorun.sh (as root or with sudo)
21 |
22 | You can check whether the driver is loaded by using following commands.
23 |
24 | # lsmod | grep r8101
25 | # ifconfig -a
26 |
27 | If there is a device name, ethX, shown on the monitor, the linux
28 | driver is loaded. Then, you can use the following command to activate
29 | the ethX.
30 |
31 | # ifconfig ethX up
32 |
33 | ,where X=0,1,2,...
34 |
35 |
36 | 1. Set manually
37 | a. Set the IP address of your machine.
38 |
39 | # ifconfig ethX "the IP address of your machine"
40 |
41 | b. Set the IP address of DNS.
42 |
43 | Insert the following configuration in /etc/resolv.conf.
44 |
45 | nameserver "the IP address of DNS"
46 |
47 | c. Set the IP address of gateway.
48 |
49 | # route add default gw "the IP address of gateway"
50 |
51 | 2. Set by doing configurations in /etc/sysconfig/network-scripts
52 | /ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network
53 | /ifcfg-ethX for SuSE. There are two examples to set network
54 | configurations.
55 |
56 | a. Fixed IP address:
57 | DEVICE=eth0
58 | BOOTPROTO=static
59 | ONBOOT=yes
60 | TYPE=ethernet
61 | NETMASK=255.255.255.0
62 | IPADDR=192.168.1.1
63 | GATEWAY=192.168.1.254
64 | BROADCAST=192.168.1.255
65 |
66 | b. DHCP:
67 | DEVICE=eth0
68 | BOOTPROTO=dhcp
69 | ONBOOT=yes
70 |
71 |
72 | There are two ways to modify the MAC address of the NIC.
73 | 1. Use ifconfig:
74 |
75 | # ifconfig ethX hw ether YY:YY:YY:YY:YY:YY
76 |
77 | ,where X is the device number assigned by Linux kernel, and
78 | YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
79 |
80 | 2. Use ip:
81 |
82 | # ip link set ethX address YY:YY:YY:YY:YY:YY
83 |
84 | ,where X is the device number assigned by Linux kernel, and
85 | YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
86 |
87 |
88 |
89 | 1. Force the link status when insert the driver.
90 |
91 | If the user is in the path ~/r8101, the link status can be forced
92 | to one of the 4 modes as following command.
93 |
94 | # insmod ./src/r8101.ko speed=SPEED_MODE duplex=DUPLEX_MODE autoneg=NWAY_OPTION
95 |
96 | ,where
97 | SPEED_MODE = 100 for 100Mbps
98 | = 10 for 10Mbps
99 | DUPLEX_MODE = 0 for half-duplex
100 | = 1 for full-duplex
101 | NWAY_OPTION = 0 for auto-negotiation off (true force)
102 | = 1 for auto-negotiation on (nway force)
103 | For example:
104 |
105 | # insmod ./src/r8101.ko speed=100 duplex=0 autoneg=1
106 |
107 | will force PHY to operate in 100Mpbs Half-duplex(nway force).
108 |
109 | 2. Force the link status by using ethtool.
110 | a. Insert the driver first.
111 | b. Make sure that ethtool exists in /sbin.
112 | c. Force the link status as the following command.
113 |
114 | # ethtool -s ethX speed SPEED_MODE duplex DUPLEX_MODE autoneg NWAY_OPTION
115 |
116 | ,where
117 | SPEED_MODE = 100 for 100Mbps
118 | = 10 for 10Mbps
119 | DUPLEX_MODE = half for half-duplex
120 | = full for full-duplex
121 | NWAY_OPTION = off for auto-negotiation off (true force)
122 | = on for auto-negotiation on (nway force)
123 |
124 | For example:
125 |
126 | # ethtool -s eth0 speed 100 duplex full autoneg on
127 |
128 | will force PHY to operate in 100Mpbs Full-duplex(nway force).
129 |
130 |
131 | RTL8101E, RTL8102E and RTL8103E do not support Jumbo Frame.
132 |
133 |
--------------------------------------------------------------------------------
/r8101-1.024.00/src/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | #
3 | # r8101 is the Linux device driver released for Realtek Fast Ethernet
4 | # controllers with PCI-Express interface.
5 | #
6 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
7 | #
8 | # This program is free software; you can redistribute it and/or modify it
9 | # under the terms of the GNU General Public License as published by the Free
10 | # Software Foundation; either version 2 of the License, or (at your option)
11 | # any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful, but WITHOUT
14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 | # more details.
17 | #
18 | # You should have received a copy of the GNU General Public License along with
19 | # this program; if not, see .
20 | #
21 | # Author:
22 | # Realtek NIC software team
23 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
24 | #
25 | ################################################################################
26 |
27 | ################################################################################
28 | # This product is covered by one or more of the following patents:
29 | # US6,570,884, US6,115,776, and US6,327,625.
30 | ################################################################################
31 |
32 | CONFIG_ASPM = y
33 | ENABLE_S5WOL = y
34 |
35 | ifneq ($(KERNELRELEASE),)
36 | obj-m := r8101.o
37 | r8101-objs := r8101_n.o rtl_eeprom.o rtltool.o
38 | EXTRA_CFLAGS += -DCONFIG_R8101_NAPI
39 | EXTRA_CFLAGS += -DCONFIG_R8101_VLAN
40 | ifeq ($(CONFIG_ASPM), y)
41 | EXTRA_CFLAGS += -DCONFIG_ASPM
42 | endif
43 | ifeq ($(ENABLE_S5WOL), y)
44 | EXTRA_CFLAGS += -DENABLE_S5WOL
45 | endif
46 | else
47 | BASEDIR := /lib/modules/$(shell uname -r)
48 | KERNELDIR ?= $(BASEDIR)/build
49 | PWD :=$(shell pwd)
50 | DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d)
51 | ifeq ($(DRIVERDIR),)
52 | DRIVERDIR := $(BASEDIR)/kernel/drivers/net
53 | endif
54 | RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR))
55 |
56 | .PHONY: all
57 | all: clean modules install
58 |
59 | .PHONY:modules
60 | modules:
61 | $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
62 |
63 | .PHONY:clean
64 | clean:
65 | $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean
66 |
67 | .PHONY:install
68 | install:
69 | $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
70 |
71 | endif
72 |
73 |
--------------------------------------------------------------------------------
/r8101-1.024.00/src/Makefile_linux24x:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8101 is the Linux device driver released for Realtek Fast Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | CC := gcc
35 | LD := ld
36 | ARCH := $(shell uname -m | sed 's/i.86/i386/')
37 | KSRC := /lib/modules/$(shell uname -r)/build
38 | CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
39 | KMISC := /lib/modules/$(shell uname -r)/kernel/drivers/net/
40 |
41 |
42 | ifeq ($(ARCH),x86_64)
43 | MODCFLAGS += -mcmodel=kernel -mno-red-zone
44 | endif
45 |
46 | #standard flags for module builds
47 | MODCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
48 | MODCFLAGS += -I$(KSRC)/include -I.
49 | MODCFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h
50 | SOURCE := r8101_n.c rtl_eeprom.c rtltool.c
51 | OBJS := $(SOURCE:.c=.o)
52 |
53 |
54 | SMP := $(shell $(CC) $(MODCFLAGS) -E -dM $(CONFIG_FILE) | \
55 | grep CONFIG_SMP | awk '{print $$3}')
56 |
57 | ifneq ($(SMP),1)
58 | SMP := 0
59 | endif
60 |
61 | ifeq ($(SMP),1)
62 | MODCFLAGS += -D__SMP__
63 | endif
64 |
65 | modules: $(OBJS)
66 | $(LD) -r $^ -o r8101.o
67 | strip --strip-debug r8101.o
68 |
69 | %.o: %.c
70 | $(CC) $(MODCFLAGS) -c $< -o $@
71 |
72 | clean:
73 | rm *.o -f
74 |
75 | install:
76 | install -m 744 -c r8101.o $(KMISC)
77 |
--------------------------------------------------------------------------------
/r8101-1.024.00/src/rtl_eeprom.c:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8101 is the Linux device driver released for Realtek Fast Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 | #include
42 |
43 | #include "r8101.h"
44 | #include "rtl_eeprom.h"
45 |
46 | //-------------------------------------------------------------------
47 | //rtl_eeprom_type():
48 | // tell the eeprom type
49 | //return value:
50 | // 0: the eeprom type is 93C46
51 | // 1: the eeprom type is 93C56 or 93C66
52 | //-------------------------------------------------------------------
53 | void rtl_eeprom_type(struct rtl8101_private *tp)
54 | {
55 | void __iomem *ioaddr=tp->mmio_addr;
56 | u16 magic = 0;
57 |
58 | if (mcfg == CFG_METHOD_UNKNOWN)
59 | goto out_no_eeprom;
60 |
61 | if(ReadMMIO8(0xD2)&0x04) {
62 | //not support
63 | //tp->eeprom_type = EEPROM_TWSI;
64 | //tp->eeprom_len = 256;
65 | goto out_no_eeprom;
66 | } else if(ReadMMIO32(RxConfig) & RxCfg_9356SEL) {
67 | tp->eeprom_type = EEPROM_TYPE_93C56;
68 | tp->eeprom_len = 256;
69 | } else {
70 | tp->eeprom_type = EEPROM_TYPE_93C46;
71 | tp->eeprom_len = 128;
72 | }
73 |
74 | magic = rtl_eeprom_read_sc(tp, 0);
75 |
76 | out_no_eeprom:
77 | if ((magic != 0x8129) && (magic != 0x8128)) {
78 | tp->eeprom_type = EEPROM_TYPE_NONE;
79 | tp->eeprom_len = 0;
80 | }
81 | }
82 |
83 | void rtl_eeprom_cleanup(void __iomem *ioaddr)
84 | {
85 | u8 x;
86 |
87 | x = ReadMMIO8(Cfg9346);
88 | x &= ~(Cfg9346_EEDI | Cfg9346_EECS);
89 |
90 | WriteMMIO8(Cfg9346, x);
91 |
92 | rtl_raise_clock(&x, ioaddr);
93 | rtl_lower_clock(&x, ioaddr);
94 | }
95 |
96 | int rtl_eeprom_cmd_done(void __iomem *ioaddr)
97 | {
98 | u8 x;
99 | int i;
100 |
101 | rtl_stand_by(ioaddr);
102 |
103 | for (i = 0; i < 50000; i++) {
104 | x = ReadMMIO8(Cfg9346);
105 |
106 | if (x & Cfg9346_EEDO) {
107 | IODelay(RTL_CLOCK_RATE * 2 * 3);
108 | return 0;
109 | }
110 | IODelay(1);
111 | }
112 |
113 | return -1;
114 | }
115 |
116 | //-------------------------------------------------------------------
117 | //rtl_eeprom_read_sc():
118 | // read one word from eeprom
119 | //-------------------------------------------------------------------
120 | u16 rtl_eeprom_read_sc(struct rtl8101_private *tp, u16 reg)
121 | {
122 | void __iomem *ioaddr=tp->mmio_addr;
123 | int addr_sz = 6;
124 | u8 x;
125 | u16 data;
126 |
127 | if(tp->eeprom_type == EEPROM_TYPE_NONE) {
128 | return -1;
129 | }
130 |
131 | if (tp->eeprom_type==EEPROM_TYPE_93C46)
132 | addr_sz = 6;
133 | else if (tp->eeprom_type==EEPROM_TYPE_93C56)
134 | addr_sz = 8;
135 |
136 | x = Cfg9346_EEM1 | Cfg9346_EECS;
137 | WriteMMIO8(Cfg9346, x);
138 |
139 | rtl_shift_out_bits(RTL_EEPROM_READ_OPCODE, 3, ioaddr);
140 | rtl_shift_out_bits(reg, addr_sz, ioaddr);
141 |
142 | data = rtl_shift_in_bits(ioaddr);
143 |
144 | rtl_eeprom_cleanup(ioaddr);
145 |
146 | WriteMMIO8(Cfg9346, 0);
147 |
148 | return data;
149 | }
150 |
151 | //-------------------------------------------------------------------
152 | //rtl_eeprom_write_sc():
153 | // write one word to a specific address in the eeprom
154 | //-------------------------------------------------------------------
155 | void rtl_eeprom_write_sc(struct rtl8101_private *tp, u16 reg, u16 data)
156 | {
157 | void __iomem *ioaddr=tp->mmio_addr;
158 | u8 x;
159 | int addr_sz = 6;
160 | int w_dummy_addr = 4;
161 |
162 | if(tp->eeprom_type == EEPROM_TYPE_NONE) {
163 | return ;
164 | }
165 |
166 | if (tp->eeprom_type==EEPROM_TYPE_93C46) {
167 | addr_sz = 6;
168 | w_dummy_addr = 4;
169 | } else if (tp->eeprom_type==EEPROM_TYPE_93C56) {
170 | addr_sz = 8;
171 | w_dummy_addr = 6;
172 | }
173 |
174 | x = Cfg9346_EEM1 | Cfg9346_EECS;
175 | WriteMMIO8(Cfg9346, x);
176 |
177 | rtl_shift_out_bits(RTL_EEPROM_EWEN_OPCODE, 5, ioaddr);
178 | rtl_shift_out_bits(reg, w_dummy_addr, ioaddr);
179 | rtl_stand_by(ioaddr);
180 |
181 | rtl_shift_out_bits(RTL_EEPROM_ERASE_OPCODE, 3, ioaddr);
182 | rtl_shift_out_bits(reg, addr_sz, ioaddr);
183 | if (rtl_eeprom_cmd_done(ioaddr) < 0) {
184 | return;
185 | }
186 | rtl_stand_by(ioaddr);
187 |
188 | rtl_shift_out_bits(RTL_EEPROM_WRITE_OPCODE, 3, ioaddr);
189 | rtl_shift_out_bits(reg, addr_sz, ioaddr);
190 | rtl_shift_out_bits(data, 16, ioaddr);
191 | if (rtl_eeprom_cmd_done(ioaddr) < 0) {
192 | return;
193 | }
194 | rtl_stand_by(ioaddr);
195 |
196 | rtl_shift_out_bits(RTL_EEPROM_EWDS_OPCODE, 5, ioaddr);
197 | rtl_shift_out_bits(reg, w_dummy_addr, ioaddr);
198 |
199 | rtl_eeprom_cleanup(ioaddr);
200 | WriteMMIO8(Cfg9346, 0);
201 | }
202 |
203 | void rtl_raise_clock(u8 *x, void __iomem *ioaddr)
204 | {
205 | *x = *x | Cfg9346_EESK;
206 | WriteMMIO8(Cfg9346, *x);
207 | IODelay(RTL_CLOCK_RATE);
208 | }
209 |
210 | void rtl_lower_clock(u8 *x, void __iomem *ioaddr)
211 | {
212 |
213 | *x = *x & ~Cfg9346_EESK;
214 | WriteMMIO8(Cfg9346, *x);
215 | IODelay(RTL_CLOCK_RATE);
216 | }
217 |
218 | void rtl_shift_out_bits(int data, int count, void __iomem *ioaddr)
219 | {
220 | u8 x;
221 | int mask;
222 |
223 | mask = 0x01 << (count - 1);
224 | x = ReadMMIO8(Cfg9346);
225 | x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);
226 |
227 | do {
228 | if (data & mask)
229 | x |= Cfg9346_EEDI;
230 | else
231 | x &= ~Cfg9346_EEDI;
232 |
233 | WriteMMIO8(Cfg9346, x);
234 | IODelay(RTL_CLOCK_RATE);
235 | rtl_raise_clock(&x, ioaddr);
236 | rtl_lower_clock(&x, ioaddr);
237 | mask = mask >> 1;
238 | } while(mask);
239 |
240 | x &= ~Cfg9346_EEDI;
241 | WriteMMIO8(Cfg9346, x);
242 | }
243 |
244 | u16 rtl_shift_in_bits(void __iomem *ioaddr)
245 | {
246 | u8 x;
247 | u16 d, i;
248 |
249 | x = ReadMMIO8(Cfg9346);
250 | x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);
251 |
252 | d = 0;
253 |
254 | for (i = 0; i < 16; i++) {
255 | d = d << 1;
256 | rtl_raise_clock(&x, ioaddr);
257 |
258 | x = ReadMMIO8(Cfg9346);
259 | x &= ~Cfg9346_EEDI;
260 |
261 | if (x & Cfg9346_EEDO)
262 | d |= 1;
263 |
264 | rtl_lower_clock(&x, ioaddr);
265 | }
266 |
267 | return d;
268 | }
269 |
270 | void rtl_stand_by(void __iomem *ioaddr)
271 | {
272 | u8 x;
273 |
274 | x = ReadMMIO8(Cfg9346);
275 | x &= ~(Cfg9346_EECS | Cfg9346_EESK);
276 | WriteMMIO8(Cfg9346, x);
277 | IODelay(RTL_CLOCK_RATE);
278 |
279 | x |= Cfg9346_EECS;
280 | WriteMMIO8(Cfg9346, x);
281 | }
282 |
283 | void rtl_set_eeprom_sel_low(void __iomem *ioaddr)
284 | {
285 | WriteMMIO8(Cfg9346, Cfg9346_EEM1);
286 | WriteMMIO8(Cfg9346, Cfg9346_EEM1 | Cfg9346_EESK);
287 |
288 | IODelay(20);
289 |
290 | WriteMMIO8(Cfg9346, Cfg9346_EEM1);
291 | }
292 |
--------------------------------------------------------------------------------
/r8101-1.024.00/src/rtl_eeprom.h:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8101 is the Linux device driver released for Realtek Fast Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | //EEPROM opcodes
35 | #define RTL_EEPROM_READ_OPCODE 06
36 | #define RTL_EEPROM_WRITE_OPCODE 05
37 | #define RTL_EEPROM_ERASE_OPCODE 07
38 | #define RTL_EEPROM_EWEN_OPCODE 19
39 | #define RTL_EEPROM_EWDS_OPCODE 16
40 |
41 | #define RTL_CLOCK_RATE 3
42 |
43 | void rtl_eeprom_type(struct rtl8101_private *tp);
44 | void rtl_eeprom_cleanup(void __iomem *ioaddr);
45 | u16 rtl_eeprom_read_sc(struct rtl8101_private *tp, u16 reg);
46 | void rtl_eeprom_write_sc(struct rtl8101_private *tp, u16 reg, u16 data);
47 | void rtl_shift_out_bits(int data, int count, void __iomem *ioaddr);
48 | u16 rtl_shift_in_bits(void __iomem *ioaddr);
49 | void rtl_raise_clock(u8 *x, void __iomem *ioaddr);
50 | void rtl_lower_clock(u8 *x, void __iomem *ioaddr);
51 | void rtl_stand_by(void __iomem *ioaddr);
52 | void rtl_set_eeprom_sel_low(void __iomem *ioaddr);
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/r8101-1.024.00/src/rtl_ethtool.h:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8101 is the Linux device driver released for Realtek Fast Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | /*****************************************************************************/
35 | /* 2.6.4 => 2.6.0 */
36 | #if ( LINUX_VERSION_CODE < KERNEL_VERSION(2,4,25) || \
37 | ( LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && \
38 | LINUX_VERSION_CODE < KERNEL_VERSION(2,6,4) ) )
39 | #define ETHTOOL_OPS_COMPAT
40 | #endif /* 2.6.4 => 2.6.0 */
41 |
42 | /*****************************************************************************/
43 |
44 | #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
45 | #undef ethtool_ops
46 | #define ethtool_ops _kc_ethtool_ops
47 |
48 | struct _kc_ethtool_ops {
49 | int (*get_settings)(struct net_device *, struct ethtool_cmd *);
50 | int (*set_settings)(struct net_device *, struct ethtool_cmd *);
51 | void (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);
52 | int (*get_regs_len)(struct net_device *);
53 | void (*get_regs)(struct net_device *, struct ethtool_regs *, void *);
54 | void (*get_wol)(struct net_device *, struct ethtool_wolinfo *);
55 | int (*set_wol)(struct net_device *, struct ethtool_wolinfo *);
56 | u32 (*get_msglevel)(struct net_device *);
57 | void (*set_msglevel)(struct net_device *, u32);
58 | int (*nway_reset)(struct net_device *);
59 | u32 (*get_link)(struct net_device *);
60 | int (*get_eeprom_len)(struct net_device *);
61 | int (*get_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
62 | int (*set_eeprom)(struct net_device *, struct ethtool_eeprom *, u8 *);
63 | int (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);
64 | int (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);
65 | void (*get_ringparam)(struct net_device *, struct ethtool_ringparam *);
66 | int (*set_ringparam)(struct net_device *, struct ethtool_ringparam *);
67 | void (*get_pauseparam)(struct net_device *,
68 | struct ethtool_pauseparam*);
69 | int (*set_pauseparam)(struct net_device *,
70 | struct ethtool_pauseparam*);
71 | u32 (*get_rx_csum)(struct net_device *);
72 | int (*set_rx_csum)(struct net_device *, u32);
73 | u32 (*get_tx_csum)(struct net_device *);
74 | int (*set_tx_csum)(struct net_device *, u32);
75 | u32 (*get_sg)(struct net_device *);
76 | int (*set_sg)(struct net_device *, u32);
77 | u32 (*get_tso)(struct net_device *);
78 | int (*set_tso)(struct net_device *, u32);
79 | int (*self_test_count)(struct net_device *);
80 | void (*self_test)(struct net_device *, struct ethtool_test *, u64 *);
81 | void (*get_strings)(struct net_device *, u32 stringset, u8 *);
82 | int (*phys_id)(struct net_device *, u32);
83 | int (*get_stats_count)(struct net_device *);
84 | void (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *,
85 | u64 *);
86 | } *ethtool_ops = NULL;
87 |
88 | #undef SET_ETHTOOL_OPS
89 | #define SET_ETHTOOL_OPS(netdev, ops) (ethtool_ops = (ops))
90 |
91 | #endif //LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
92 |
93 | /*****************************************************************************/
94 | /* Installations with ethtool version without eeprom, adapter id, or statistics
95 | * support */
96 |
97 | #ifndef ETH_GSTRING_LEN
98 | #define ETH_GSTRING_LEN 32
99 | #endif
100 |
101 | #ifndef ETHTOOL_GSTATS
102 | #define ETHTOOL_GSTATS 0x1d
103 | #undef ethtool_drvinfo
104 | #define ethtool_drvinfo k_ethtool_drvinfo
105 | struct k_ethtool_drvinfo {
106 | u32 cmd;
107 | char driver[32];
108 | char version[32];
109 | char fw_version[32];
110 | char bus_info[32];
111 | char reserved1[32];
112 | char reserved2[16];
113 | u32 n_stats;
114 | u32 testinfo_len;
115 | u32 eedump_len;
116 | u32 regdump_len;
117 | };
118 |
119 | struct ethtool_stats {
120 | u32 cmd;
121 | u32 n_stats;
122 | u64 data[0];
123 | };
124 | #endif /* ETHTOOL_GSTATS */
125 |
126 | #ifndef ETHTOOL_PHYS_ID
127 | #define ETHTOOL_PHYS_ID 0x1c
128 | #endif /* ETHTOOL_PHYS_ID */
129 |
130 | #ifndef ETHTOOL_GSTRINGS
131 | #define ETHTOOL_GSTRINGS 0x1b
132 | enum ethtool_stringset {
133 | ETH_SS_TEST = 0,
134 | ETH_SS_STATS,
135 | };
136 | struct ethtool_gstrings {
137 | u32 cmd; /* ETHTOOL_GSTRINGS */
138 | u32 string_set; /* string set id e.c. ETH_SS_TEST, etc*/
139 | u32 len; /* number of strings in the string set */
140 | u8 data[0];
141 | };
142 | #endif /* ETHTOOL_GSTRINGS */
143 |
144 | #ifndef ETHTOOL_TEST
145 | #define ETHTOOL_TEST 0x1a
146 | enum ethtool_test_flags {
147 | ETH_TEST_FL_OFFLINE = (1 << 0),
148 | ETH_TEST_FL_FAILED = (1 << 1),
149 | };
150 | struct ethtool_test {
151 | u32 cmd;
152 | u32 flags;
153 | u32 reserved;
154 | u32 len;
155 | u64 data[0];
156 | };
157 | #endif /* ETHTOOL_TEST */
158 |
159 | #ifndef ETHTOOL_GEEPROM
160 | #define ETHTOOL_GEEPROM 0xb
161 | #undef ETHTOOL_GREGS
162 | struct ethtool_eeprom {
163 | u32 cmd;
164 | u32 magic;
165 | u32 offset;
166 | u32 len;
167 | u8 data[0];
168 | };
169 |
170 | struct ethtool_value {
171 | u32 cmd;
172 | u32 data;
173 | };
174 | #endif /* ETHTOOL_GEEPROM */
175 |
176 | #ifndef ETHTOOL_GLINK
177 | #define ETHTOOL_GLINK 0xa
178 | #endif /* ETHTOOL_GLINK */
179 |
180 | #ifndef ETHTOOL_GREGS
181 | #define ETHTOOL_GREGS 0x00000004 /* Get NIC registers */
182 | #define ethtool_regs _kc_ethtool_regs
183 | /* for passing big chunks of data */
184 | struct _kc_ethtool_regs {
185 | u32 cmd;
186 | u32 version; /* driver-specific, indicates different chips/revs */
187 | u32 len; /* bytes */
188 | u8 data[0];
189 | };
190 | #endif /* ETHTOOL_GREGS */
191 |
192 | #ifndef ETHTOOL_GMSGLVL
193 | #define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
194 | #endif
195 | #ifndef ETHTOOL_SMSGLVL
196 | #define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level, priv. */
197 | #endif
198 | #ifndef ETHTOOL_NWAY_RST
199 | #define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation, priv */
200 | #endif
201 | #ifndef ETHTOOL_GLINK
202 | #define ETHTOOL_GLINK 0x0000000a /* Get link status */
203 | #endif
204 | #ifndef ETHTOOL_GEEPROM
205 | #define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
206 | #endif
207 | #ifndef ETHTOOL_SEEPROM
208 | #define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data */
209 | #endif
210 | #ifndef ETHTOOL_GCOALESCE
211 | #define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
212 | /* for configuring coalescing parameters of chip */
213 | #define ethtool_coalesce _kc_ethtool_coalesce
214 | struct _kc_ethtool_coalesce {
215 | u32 cmd; /* ETHTOOL_{G,S}COALESCE */
216 |
217 | /* How many usecs to delay an RX interrupt after
218 | * a packet arrives. If 0, only rx_max_coalesced_frames
219 | * is used.
220 | */
221 | u32 rx_coalesce_usecs;
222 |
223 | /* How many packets to delay an RX interrupt after
224 | * a packet arrives. If 0, only rx_coalesce_usecs is
225 | * used. It is illegal to set both usecs and max frames
226 | * to zero as this would cause RX interrupts to never be
227 | * generated.
228 | */
229 | u32 rx_max_coalesced_frames;
230 |
231 | /* Same as above two parameters, except that these values
232 | * apply while an IRQ is being serviced by the host. Not
233 | * all cards support this feature and the values are ignored
234 | * in that case.
235 | */
236 | u32 rx_coalesce_usecs_irq;
237 | u32 rx_max_coalesced_frames_irq;
238 |
239 | /* How many usecs to delay a TX interrupt after
240 | * a packet is sent. If 0, only tx_max_coalesced_frames
241 | * is used.
242 | */
243 | u32 tx_coalesce_usecs;
244 |
245 | /* How many packets to delay a TX interrupt after
246 | * a packet is sent. If 0, only tx_coalesce_usecs is
247 | * used. It is illegal to set both usecs and max frames
248 | * to zero as this would cause TX interrupts to never be
249 | * generated.
250 | */
251 | u32 tx_max_coalesced_frames;
252 |
253 | /* Same as above two parameters, except that these values
254 | * apply while an IRQ is being serviced by the host. Not
255 | * all cards support this feature and the values are ignored
256 | * in that case.
257 | */
258 | u32 tx_coalesce_usecs_irq;
259 | u32 tx_max_coalesced_frames_irq;
260 |
261 | /* How many usecs to delay in-memory statistics
262 | * block updates. Some drivers do not have an in-memory
263 | * statistic block, and in such cases this value is ignored.
264 | * This value must not be zero.
265 | */
266 | u32 stats_block_coalesce_usecs;
267 |
268 | /* Adaptive RX/TX coalescing is an algorithm implemented by
269 | * some drivers to improve latency under low packet rates and
270 | * improve throughput under high packet rates. Some drivers
271 | * only implement one of RX or TX adaptive coalescing. Anything
272 | * not implemented by the driver causes these values to be
273 | * silently ignored.
274 | */
275 | u32 use_adaptive_rx_coalesce;
276 | u32 use_adaptive_tx_coalesce;
277 |
278 | /* When the packet rate (measured in packets per second)
279 | * is below pkt_rate_low, the {rx,tx}_*_low parameters are
280 | * used.
281 | */
282 | u32 pkt_rate_low;
283 | u32 rx_coalesce_usecs_low;
284 | u32 rx_max_coalesced_frames_low;
285 | u32 tx_coalesce_usecs_low;
286 | u32 tx_max_coalesced_frames_low;
287 |
288 | /* When the packet rate is below pkt_rate_high but above
289 | * pkt_rate_low (both measured in packets per second) the
290 | * normal {rx,tx}_* coalescing parameters are used.
291 | */
292 |
293 | /* When the packet rate is (measured in packets per second)
294 | * is above pkt_rate_high, the {rx,tx}_*_high parameters are
295 | * used.
296 | */
297 | u32 pkt_rate_high;
298 | u32 rx_coalesce_usecs_high;
299 | u32 rx_max_coalesced_frames_high;
300 | u32 tx_coalesce_usecs_high;
301 | u32 tx_max_coalesced_frames_high;
302 |
303 | /* How often to do adaptive coalescing packet rate sampling,
304 | * measured in seconds. Must not be zero.
305 | */
306 | u32 rate_sample_interval;
307 | };
308 | #endif /* ETHTOOL_GCOALESCE */
309 |
310 | #ifndef ETHTOOL_SCOALESCE
311 | #define ETHTOOL_SCOALESCE 0x0000000f /* Set coalesce config. */
312 | #endif
313 | #ifndef ETHTOOL_GRINGPARAM
314 | #define ETHTOOL_GRINGPARAM 0x00000010 /* Get ring parameters */
315 | /* for configuring RX/TX ring parameters */
316 | #define ethtool_ringparam _kc_ethtool_ringparam
317 | struct _kc_ethtool_ringparam {
318 | u32 cmd; /* ETHTOOL_{G,S}RINGPARAM */
319 |
320 | /* Read only attributes. These indicate the maximum number
321 | * of pending RX/TX ring entries the driver will allow the
322 | * user to set.
323 | */
324 | u32 rx_max_pending;
325 | u32 rx_mini_max_pending;
326 | u32 rx_jumbo_max_pending;
327 | u32 tx_max_pending;
328 |
329 | /* Values changeable by the user. The valid values are
330 | * in the range 1 to the "*_max_pending" counterpart above.
331 | */
332 | u32 rx_pending;
333 | u32 rx_mini_pending;
334 | u32 rx_jumbo_pending;
335 | u32 tx_pending;
336 | };
337 | #endif /* ETHTOOL_GRINGPARAM */
338 |
339 | #ifndef ETHTOOL_SRINGPARAM
340 | #define ETHTOOL_SRINGPARAM 0x00000011 /* Set ring parameters, priv. */
341 | #endif
342 | #ifndef ETHTOOL_GPAUSEPARAM
343 | #define ETHTOOL_GPAUSEPARAM 0x00000012 /* Get pause parameters */
344 | /* for configuring link flow control parameters */
345 | #define ethtool_pauseparam _kc_ethtool_pauseparam
346 | struct _kc_ethtool_pauseparam {
347 | u32 cmd; /* ETHTOOL_{G,S}PAUSEPARAM */
348 |
349 | /* If the link is being auto-negotiated (via ethtool_cmd.autoneg
350 | * being true) the user may set 'autonet' here non-zero to have the
351 | * pause parameters be auto-negotiated too. In such a case, the
352 | * {rx,tx}_pause values below determine what capabilities are
353 | * advertised.
354 | *
355 | * If 'autoneg' is zero or the link is not being auto-negotiated,
356 | * then {rx,tx}_pause force the driver to use/not-use pause
357 | * flow control.
358 | */
359 | u32 autoneg;
360 | u32 rx_pause;
361 | u32 tx_pause;
362 | };
363 | #endif /* ETHTOOL_GPAUSEPARAM */
364 |
365 | #ifndef ETHTOOL_SPAUSEPARAM
366 | #define ETHTOOL_SPAUSEPARAM 0x00000013 /* Set pause parameters. */
367 | #endif
368 | #ifndef ETHTOOL_GRXCSUM
369 | #define ETHTOOL_GRXCSUM 0x00000014 /* Get RX hw csum enable (ethtool_value) */
370 | #endif
371 | #ifndef ETHTOOL_SRXCSUM
372 | #define ETHTOOL_SRXCSUM 0x00000015 /* Set RX hw csum enable (ethtool_value) */
373 | #endif
374 | #ifndef ETHTOOL_GTXCSUM
375 | #define ETHTOOL_GTXCSUM 0x00000016 /* Get TX hw csum enable (ethtool_value) */
376 | #endif
377 | #ifndef ETHTOOL_STXCSUM
378 | #define ETHTOOL_STXCSUM 0x00000017 /* Set TX hw csum enable (ethtool_value) */
379 | #endif
380 | #ifndef ETHTOOL_GSG
381 | #define ETHTOOL_GSG 0x00000018 /* Get scatter-gather enable
382 | * (ethtool_value) */
383 | #endif
384 | #ifndef ETHTOOL_SSG
385 | #define ETHTOOL_SSG 0x00000019 /* Set scatter-gather enable
386 | * (ethtool_value). */
387 | #endif
388 | #ifndef ETHTOOL_TEST
389 | #define ETHTOOL_TEST 0x0000001a /* execute NIC self-test, priv. */
390 | #endif
391 | #ifndef ETHTOOL_GSTRINGS
392 | #define ETHTOOL_GSTRINGS 0x0000001b /* get specified string set */
393 | #endif
394 | #ifndef ETHTOOL_PHYS_ID
395 | #define ETHTOOL_PHYS_ID 0x0000001c /* identify the NIC */
396 | #endif
397 | #ifndef ETHTOOL_GSTATS
398 | #define ETHTOOL_GSTATS 0x0000001d /* get NIC-specific statistics */
399 | #endif
400 | #ifndef ETHTOOL_GTSO
401 | #define ETHTOOL_GTSO 0x0000001e /* Get TSO enable (ethtool_value) */
402 | #endif
403 | #ifndef ETHTOOL_STSO
404 | #define ETHTOOL_STSO 0x0000001f /* Set TSO enable (ethtool_value) */
405 | #endif
406 |
407 | #ifndef ETHTOOL_BUSINFO_LEN
408 | #define ETHTOOL_BUSINFO_LEN 32
409 | #endif
410 |
411 | /*****************************************************************************/
412 |
--------------------------------------------------------------------------------
/r8101-1.024.00/src/rtltool.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include "r8101.h"
7 | #include "rtltool.h"
8 |
9 | void mdio_write(void __iomem *ioaddr, u32 RegAddr, u32 value);
10 | u32 mdio_read(void __iomem *ioaddr, u32 RegAddr);
11 | void rtl8101_ephy_write(void __iomem *ioaddr, u32 RegAddr, u32 value);
12 | u16 rtl8101_ephy_read(void __iomem *ioaddr, u32 RegAddr);
13 |
14 | int rtltool_ioctl(struct rtl8101_private *tp, struct ifreq *ifr)
15 | {
16 | struct rtltool_cmd my_cmd;
17 | unsigned long flags;
18 | int ret;
19 |
20 | if (!capable(CAP_NET_ADMIN)) {
21 | return -EPERM;
22 | }
23 |
24 | if (copy_from_user(&my_cmd, ifr->ifr_data, sizeof(struct rtltool_cmd))) {
25 | return -EFAULT;
26 | }
27 |
28 | ret = 0;
29 | switch(my_cmd.cmd) {
30 | case RTLTOOL_READ_MAC:
31 | if(my_cmd.len==1) {
32 | my_cmd.data = readb(tp->mmio_addr+my_cmd.offset);
33 | } else if(my_cmd.len==2) {
34 | my_cmd.data = readw(tp->mmio_addr+(my_cmd.offset&~1));
35 | } else if(my_cmd.len==4) {
36 | my_cmd.data = readl(tp->mmio_addr+(my_cmd.offset&~3));
37 | } else {
38 | ret = -EOPNOTSUPP;
39 | break;
40 | }
41 |
42 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(struct rtltool_cmd))) {
43 | ret = -EFAULT;
44 | break;
45 | }
46 | break;
47 |
48 | case RTLTOOL_WRITE_MAC:
49 | if(my_cmd.len==1) {
50 | writeb(my_cmd.data, tp->mmio_addr+my_cmd.offset);
51 | } else if(my_cmd.len==2) {
52 | writew(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~1));
53 | } else if(my_cmd.len==4) {
54 | writel(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~3));
55 | } else {
56 | ret = -EOPNOTSUPP;
57 | break;
58 | }
59 |
60 | break;
61 |
62 | case RTLTOOL_READ_PHY:
63 | spin_lock_irqsave(&tp->phy_lock, flags);
64 | my_cmd.data = mdio_read(tp->mmio_addr, my_cmd.offset);
65 | spin_unlock_irqrestore(&tp->phy_lock, flags);
66 |
67 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(struct rtltool_cmd))) {
68 | ret = -EFAULT;
69 | break;
70 | }
71 |
72 | break;
73 |
74 | case RTLTOOL_WRITE_PHY:
75 | spin_lock_irqsave(&tp->phy_lock, flags);
76 | mdio_write(tp->mmio_addr, my_cmd.offset, my_cmd.data);
77 | spin_unlock_irqrestore(&tp->phy_lock, flags);
78 | break;
79 |
80 | case RTLTOOL_READ_EPHY:
81 | my_cmd.data = rtl8101_ephy_read(tp->mmio_addr, my_cmd.offset);
82 |
83 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(struct rtltool_cmd))) {
84 | ret = -EFAULT;
85 | break;
86 | }
87 |
88 | break;
89 |
90 | case RTLTOOL_WRITE_EPHY:
91 | rtl8101_ephy_write(tp->mmio_addr, my_cmd.offset, my_cmd.data);
92 | break;
93 |
94 | case RTLTOOL_READ_PCI:
95 | my_cmd.data = 0;
96 | if(my_cmd.len==1) {
97 | pci_read_config_byte(tp->pci_dev, my_cmd.offset, (u8 *)&my_cmd.data);
98 | } else if(my_cmd.len==2) {
99 | pci_read_config_word(tp->pci_dev, my_cmd.offset, (u16 *)&my_cmd.data);
100 | } else if(my_cmd.len==4) {
101 | pci_read_config_dword(tp->pci_dev, my_cmd.offset, &my_cmd.data);
102 | } else {
103 | ret = -EOPNOTSUPP;
104 | break;
105 | }
106 |
107 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(struct rtltool_cmd))) {
108 | ret = -EFAULT;
109 | break;
110 | }
111 | break;
112 |
113 | case RTLTOOL_WRITE_PCI:
114 | if(my_cmd.len==1) {
115 | pci_write_config_byte(tp->pci_dev, my_cmd.offset, my_cmd.data);
116 | } else if(my_cmd.len==2) {
117 | pci_write_config_word(tp->pci_dev, my_cmd.offset, my_cmd.data);
118 | } else if(my_cmd.len==4) {
119 | pci_write_config_dword(tp->pci_dev, my_cmd.offset, my_cmd.data);
120 | } else {
121 | ret = -EOPNOTSUPP;
122 | break;
123 | }
124 |
125 | break;
126 |
127 | default:
128 | ret = -EOPNOTSUPP;
129 | break;
130 | }
131 |
132 | return ret;
133 | }
134 |
--------------------------------------------------------------------------------
/r8101-1.024.00/src/rtltool.h:
--------------------------------------------------------------------------------
1 | #ifndef _LINUX_RTLTOOL_H
2 | #define _LINUX_RTLTOOL_H
3 |
4 | #define SIOCRTLTOOL SIOCDEVPRIVATE+1
5 |
6 | enum rtl_cmd {
7 | RTLTOOL_READ_MAC=0,
8 | RTLTOOL_WRITE_MAC,
9 | RTLTOOL_READ_PHY,
10 | RTLTOOL_WRITE_PHY,
11 | RTLTOOL_READ_EPHY,
12 | RTLTOOL_WRITE_EPHY,
13 | RTLTOOL_READ_PCI,
14 | RTLTOOL_WRITE_PCI,
15 | RTLTOOL_READ_EEPROM,
16 | RTLTOOL_WRITE_EEPROM,
17 | RTLTOOL_INVALID
18 | };
19 |
20 | struct rtltool_cmd {
21 | __u32 cmd;
22 | __u32 offset;
23 | __u32 len;
24 | __u32 data;
25 | };
26 |
27 | enum mode_access {
28 | MODE_NONE=0,
29 | MODE_READ,
30 | MODE_WRITE
31 | };
32 |
33 | #ifdef __KERNEL__
34 | int rtltool_ioctl(struct rtl8101_private *tp, struct ifreq *ifr);
35 | #endif
36 |
37 | #endif /* _LINUX_RTLTOOL_H */
38 |
--------------------------------------------------------------------------------
/r8168-8.037.00/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | #
3 | # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
4 | # controllers with PCI-Express interface.
5 | #
6 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
7 | #
8 | # This program is free software; you can redistribute it and/or modify it
9 | # under the terms of the GNU General Public License as published by the Free
10 | # Software Foundation; either version 2 of the License, or (at your option)
11 | # any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful, but WITHOUT
14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 | # more details.
17 | #
18 | # You should have received a copy of the GNU General Public License along with
19 | # this program; if not, see .
20 | #
21 | # Author:
22 | # Realtek NIC software team
23 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
24 | #
25 | ################################################################################
26 |
27 | ################################################################################
28 | # This product is covered by one or more of the following patents:
29 | # US6,570,884, US6,115,776, and US6,327,625.
30 | ################################################################################
31 |
32 | KFLAG := 2$(shell uname -r | sed -ne 's/^2\.[4]\..*/4/p')x
33 |
34 | all: clean modules install
35 |
36 | modules:
37 | ifeq ($(KFLAG),24x)
38 | $(MAKE) -C src/ -f Makefile_linux24x modules
39 | else
40 | $(MAKE) -C src/ modules
41 | endif
42 |
43 | clean:
44 | ifeq ($(KFLAG),24x)
45 | $(MAKE) -C src/ -f Makefile_linux24x clean
46 | else
47 | $(MAKE) -C src/ clean
48 | endif
49 |
50 | install:
51 | ifeq ($(KFLAG),24x)
52 | $(MAKE) -C src/ -f Makefile_linux24x install
53 | else
54 | $(MAKE) -C src/ install
55 | endif
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/r8168-8.037.00/README:
--------------------------------------------------------------------------------
1 |
2 |
3 | This is the Linux device driver released for RealTek RTL8168B/8111B, RTL8168C/8111C, RTL8168CP/8111CP, RTL8168D/8111D, RTL8168DP/8111DP, and RTL8168E/8111E Gigabit Ethernet controllers with PCI-Express interface.
4 |
5 |
6 |
7 | - Kernel source tree (supported Linux kernel 2.6.x and 2.4.x)
8 | - For linux kernel 2.4.x, this driver supports 2.4.20 and latter.
9 | - Compiler/binutils for kernel compilation
10 |
11 |
12 | Unpack the tarball :
13 | # tar vjxf r8168-8.aaa.bb.tar.bz2
14 |
15 | Change to the directory:
16 | # cd r8168-8.aaa.bb
17 |
18 | If you are running the target kernel, then you should be able to do :
19 |
20 | # ./autorun.sh (as root or with sudo)
21 |
22 | You can check whether the driver is loaded by using following commands.
23 |
24 | # lsmod | grep r8168
25 | # ifconfig -a
26 |
27 | If there is a device name, ethX, shown on the monitor, the linux
28 | driver is loaded. Then, you can use the following command to activate
29 | the ethX.
30 |
31 | # ifconfig ethX up
32 |
33 | ,where X=0,1,2,...
34 |
35 |
36 | 1. Set manually
37 | a. Set the IP address of your machine.
38 |
39 | # ifconfig ethX "the IP address of your machine"
40 |
41 | b. Set the IP address of DNS.
42 |
43 | Insert the following configuration in /etc/resolv.conf.
44 |
45 | nameserver "the IP address of DNS"
46 |
47 | c. Set the IP address of gateway.
48 |
49 | # route add default gw "the IP address of gateway"
50 |
51 | 2. Set by doing configurations in /etc/sysconfig/network-scripts
52 | /ifcfg-ethX for Redhat and Fedora, or /etc/sysconfig/network
53 | /ifcfg-ethX for SuSE. There are two examples to set network
54 | configurations.
55 |
56 | a. Fixed IP address:
57 | DEVICE=eth0
58 | BOOTPROTO=static
59 | ONBOOT=yes
60 | TYPE=ethernet
61 | NETMASK=255.255.255.0
62 | IPADDR=192.168.1.1
63 | GATEWAY=192.168.1.254
64 | BROADCAST=192.168.1.255
65 |
66 | b. DHCP:
67 | DEVICE=eth0
68 | BOOTPROTO=dhcp
69 | ONBOOT=yes
70 |
71 |
72 | There are two ways to modify the MAC address of the NIC.
73 | 1. Use ifconfig:
74 |
75 | # ifconfig ethX hw ether YY:YY:YY:YY:YY:YY
76 |
77 | ,where X is the device number assigned by Linux kernel, and
78 | YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
79 |
80 | 2. Use ip:
81 |
82 | # ip link set ethX address YY:YY:YY:YY:YY:YY
83 |
84 | ,where X is the device number assigned by Linux kernel, and
85 | YY:YY:YY:YY:YY:YY is the MAC address assigned by the user.
86 |
87 |
88 |
89 | 1. Force the link status when insert the driver.
90 |
91 | If the user is in the path ~/r8168, the link status can be forced
92 | to one of the 5 modes as following command.
93 |
94 | # insmod ./src/r8168.ko speed=SPEED_MODE duplex=DUPLEX_MODE autoneg=NWAY_OPTION
95 |
96 | ,where
97 | SPEED_MODE = 1000 for 1000Mbps
98 | = 100 for 100Mbps
99 | = 10 for 10Mbps
100 | DUPLEX_MODE = 0 for half-duplex
101 | = 1 for full-duplex
102 | NWAY_OPTION = 0 for auto-negotiation off (true force)
103 | = 1 for auto-negotiation on (nway force)
104 | For example:
105 |
106 | # insmod ./src/r8168.ko speed=100 duplex=0 autoneg=1
107 |
108 | will force PHY to operate in 100Mpbs Half-duplex(nway force).
109 |
110 | 2. Force the link status by using ethtool.
111 | a. Insert the driver first.
112 | b. Make sure that ethtool exists in /sbin.
113 | c. Force the link status as the following command.
114 |
115 | # ethtool -s ethX speed SPEED_MODE duplex DUPLEX_MODE autoneg NWAY_OPTION
116 |
117 | ,where
118 | SPEED_MODE = 1000 for 1000Mbps
119 | = 100 for 100Mbps
120 | = 10 for 10Mbps
121 | DUPLEX_MODE = half for half-duplex
122 | = full for full-duplex
123 | NWAY_OPTION = off for auto-negotiation off (true force)
124 | = on for auto-negotiation on (nway force)
125 |
126 | For example:
127 |
128 | # ethtool -s eth0 speed 100 duplex full autoneg on
129 |
130 | will force PHY to operate in 100Mpbs Full-duplex(nway force).
131 |
132 |
133 | Transmitting Jumbo Frames, whose packet size is bigger than 1500 bytes, please change mtu by the following command.
134 |
135 | # ifconfig ethX mtu MTU
136 |
137 | , where X=0,1,2,..., and MTU is configured by user.
138 |
139 | RTL8168B/8111B supports Jumbo Frame size up to 4 kBytes.
140 | RTL8168C/8111C and RTL8168CP/8111CP support Jumbo Frame size up to 6 kBytes.
141 | RTL8168D/8111D supports Jumbo Frame size up to 9 kBytes.
142 |
--------------------------------------------------------------------------------
/r8168-8.037.00/autorun.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # invoke insmod with all arguments we got
4 | # and use a pathname, as insmod doesn't look in . by default
5 |
6 | TARGET_PATH=$(find /lib/modules/$(uname -r)/kernel/drivers/net -name realtek -type d)
7 | if [ "$TARGET_PATH" = "" ]; then
8 | TARGET_PATH=/lib/modules/$(uname -r)/kernel/drivers/net
9 | fi
10 | echo
11 | echo "Check old driver and unload it."
12 | check=`lsmod | grep r8169`
13 | if [ "$check" != "" ]; then
14 | echo "rmmod r8169"
15 | /sbin/rmmod r8169
16 | fi
17 |
18 | check=`lsmod | grep r8168`
19 | if [ "$check" != "" ]; then
20 | echo "rmmod r8168"
21 | /sbin/rmmod r8168
22 | fi
23 |
24 | echo "Build the module and install"
25 | echo "-------------------------------" >> log.txt
26 | date 1>>log.txt
27 | make $@ all 1>>log.txt || exit 1
28 | module=`ls src/*.ko`
29 | module=${module#src/}
30 | module=${module%.ko}
31 |
32 | if [ "$module" = "" ]; then
33 | echo "No driver exists!!!"
34 | exit 1
35 | elif [ "$module" != "r8169" ]; then
36 | if test -e $TARGET_PATH/r8169.ko ; then
37 | echo "Backup r8169.ko"
38 | if test -e $TARGET_PATH/r8169.bak ; then
39 | i=0
40 | while test -e $TARGET_PATH/r8169.bak$i
41 | do
42 | i=$(($i+1))
43 | done
44 | echo "rename r8169.ko to r8169.bak$i"
45 | mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak$i
46 | else
47 | echo "rename r8169.ko to r8169.bak"
48 | mv $TARGET_PATH/r8169.ko $TARGET_PATH/r8169.bak
49 | fi
50 | fi
51 | fi
52 |
53 | echo "DEPMOD $(uname -r)"
54 | depmod `uname -r`
55 | echo "load module $module"
56 | modprobe $module
57 |
58 | is_update_initramfs=n
59 | distrib_list="ubuntu debian"
60 |
61 | if [ -r /etc/debian_version ]; then
62 | is_update_initramfs=y
63 | elif [ -r /etc/lsb-release ]; then
64 | for distrib in $distrib_list
65 | do
66 | /bin/grep -i "$distrib" /etc/lsb-release 2>&1 /dev/null && \
67 | is_update_initramfs=y && break
68 | done
69 | fi
70 |
71 | if [ "$is_update_initramfs" = "y" ]; then
72 | if which update-initramfs >/dev/null ; then
73 | echo "Updating initramfs. Please wait."
74 | update-initramfs -u -k $(uname -r)
75 | else
76 | echo "update-initramfs: command not found"
77 | exit 1
78 | fi
79 | fi
80 |
81 | echo "Completed."
82 | exit 0
83 |
84 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/Makefile:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | #
3 | # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
4 | # controllers with PCI-Express interface.
5 | #
6 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
7 | #
8 | # This program is free software; you can redistribute it and/or modify it
9 | # under the terms of the GNU General Public License as published by the Free
10 | # Software Foundation; either version 2 of the License, or (at your option)
11 | # any later version.
12 | #
13 | # This program is distributed in the hope that it will be useful, but WITHOUT
14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 | # more details.
17 | #
18 | # You should have received a copy of the GNU General Public License along with
19 | # this program; if not, see .
20 | #
21 | # Author:
22 | # Realtek NIC software team
23 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
24 | #
25 | ################################################################################
26 |
27 | ################################################################################
28 | # This product is covered by one or more of the following patents:
29 | # US6,570,884, US6,115,776, and US6,327,625.
30 | ################################################################################
31 |
32 | CONFIG_DOWN_SPEED_100 = n
33 | CONFIG_ASPM = y
34 | ENABLE_S5WOL = y
35 |
36 | ifneq ($(KERNELRELEASE),)
37 | obj-m := r8168.o
38 | r8168-objs := r8168_n.o r8168_asf.o rtl_eeprom.o rtltool.o
39 | EXTRA_CFLAGS += -DCONFIG_R8168_NAPI
40 | EXTRA_CFLAGS += -DCONFIG_R8168_VLAN
41 | ifeq ($(CONFIG_DOWN_SPEED_100), y)
42 | EXTRA_CFLAGS += -DCONFIG_DOWN_SPEED_100
43 | endif
44 | ifeq ($(CONFIG_ASPM), y)
45 | EXTRA_CFLAGS += -DCONFIG_ASPM
46 | endif
47 | ifeq ($(ENABLE_S5WOL), y)
48 | EXTRA_CFLAGS += -DENABLE_S5WOL
49 | endif
50 | else
51 | BASEDIR := /lib/modules/$(shell uname -r)
52 | KERNELDIR ?= $(BASEDIR)/build
53 | PWD :=$(shell pwd)
54 | DRIVERDIR := $(shell find $(BASEDIR)/kernel/drivers/net -name realtek -type d)
55 | ifeq ($(DRIVERDIR),)
56 | DRIVERDIR := $(BASEDIR)/kernel/drivers/net
57 | endif
58 | RTKDIR := $(subst $(BASEDIR)/,,$(DRIVERDIR))
59 |
60 | .PHONY: all
61 | all: clean modules install
62 |
63 | .PHONY:modules
64 | modules:
65 | $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) modules
66 |
67 | .PHONY:clean
68 | clean:
69 | $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) clean
70 |
71 | .PHONY:install
72 | install:
73 | $(MAKE) -C $(KERNELDIR) SUBDIRS=$(PWD) INSTALL_MOD_DIR=$(RTKDIR) modules_install
74 |
75 | endif
76 |
77 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/Makefile_linux24x:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | CC := gcc
35 | LD := ld
36 | ARCH := $(shell uname -m | sed 's/i.86/i386/')
37 | KSRC := /lib/modules/$(shell uname -r)/build
38 | CONFIG_FILE := $(KSRC)/include/linux/autoconf.h
39 | KMISC := /lib/modules/$(shell uname -r)/kernel/drivers/net/
40 |
41 |
42 | ifeq ($(ARCH),x86_64)
43 | MODCFLAGS += -mcmodel=kernel -mno-red-zone
44 | endif
45 |
46 | #standard flags for module builds
47 | MODCFLAGS += -DLINUX -D__KERNEL__ -DMODULE -O2 -pipe -Wall
48 | MODCFLAGS += -I$(KSRC)/include -I.
49 | MODCFLAGS += -DMODVERSIONS -DEXPORT_SYMTAB -include $(KSRC)/include/linux/modversions.h
50 | SOURCE := r8168_n.c r8168_asf.c rtl_eeprom.c rtltool.c
51 | OBJS := $(SOURCE:.c=.o)
52 |
53 |
54 | SMP := $(shell $(CC) $(MODCFLAGS) -E -dM $(CONFIG_FILE) | \
55 | grep CONFIG_SMP | awk '{print $$3}')
56 |
57 | ifneq ($(SMP),1)
58 | SMP := 0
59 | endif
60 |
61 | ifeq ($(SMP),1)
62 | MODCFLAGS += -D__SMP__
63 | endif
64 |
65 | modules: $(OBJS)
66 | $(LD) -r $^ -o r8168.o
67 | strip --strip-debug r8168.o
68 |
69 | %.o: %.c
70 | $(CC) $(MODCFLAGS) -c $< -o $@
71 |
72 | clean:
73 | rm *.o -f
74 |
75 | install:
76 | install -m 744 -c r8168.o $(KMISC)
77 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/r8168_asf.c:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 | #include
41 | #include
42 | #include
43 | #include
44 | #include
45 | #include
46 | #include
47 | #include
48 | #include
49 |
50 | #include
51 |
52 | #include "r8168.h"
53 | #include "r8168_asf.h"
54 | #include "rtl_eeprom.h"
55 |
56 | int rtl8168_asf_ioctl(struct net_device *dev,
57 | struct ifreq *ifr)
58 | {
59 | struct rtl8168_private *tp = netdev_priv(dev);
60 | void __iomem *ioaddr = tp->mmio_addr;
61 | void *user_data = ifr->ifr_data;
62 | struct asf_ioctl_struct asf_usrdata;
63 |
64 | if (mcfg != CFG_METHOD_7 && mcfg != CFG_METHOD_8)
65 | return -EOPNOTSUPP;
66 |
67 | if (copy_from_user(&asf_usrdata, user_data, sizeof(struct asf_ioctl_struct)))
68 | return -EFAULT;
69 |
70 | switch (asf_usrdata.offset) {
71 | case HBPeriod:
72 | rtl8168_asf_hbperiod(ioaddr, asf_usrdata.arg, asf_usrdata.u.data);
73 | break;
74 | case WD8Timer:
75 | break;
76 | case WD16Rst:
77 | rtl8168_asf_wd16rst(ioaddr, asf_usrdata.arg, asf_usrdata.u.data);
78 | break;
79 | case WD8Rst:
80 | rtl8168_asf_time_period(ioaddr, asf_usrdata.arg, WD8Rst, asf_usrdata.u.data);
81 | break;
82 | case LSnsrPollCycle:
83 | rtl8168_asf_time_period(ioaddr, asf_usrdata.arg, LSnsrPollCycle, asf_usrdata.u.data);
84 | break;
85 | case ASFSnsrPollPrd:
86 | rtl8168_asf_time_period(ioaddr, asf_usrdata.arg, ASFSnsrPollPrd, asf_usrdata.u.data);
87 | break;
88 | case AlertReSendItvl:
89 | rtl8168_asf_time_period(ioaddr, asf_usrdata.arg, AlertReSendItvl, asf_usrdata.u.data);
90 | break;
91 | case SMBAddr:
92 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, SMBAddr, RW_ONE_BYTE, asf_usrdata.u.data);
93 | break;
94 | case ASFConfigR0:
95 | rtl8168_asf_config_regs(ioaddr, asf_usrdata.arg, ASFConfigR0, asf_usrdata.u.data);
96 | break;
97 | case ASFConfigR1:
98 | rtl8168_asf_config_regs(ioaddr, asf_usrdata.arg, ASFConfigR1, asf_usrdata.u.data);
99 | break;
100 | case ConsoleMA:
101 | rtl8168_asf_console_mac(tp, asf_usrdata.arg, asf_usrdata.u.data);
102 | break;
103 | case ConsoleIP:
104 | rtl8168_asf_ip_address(ioaddr, asf_usrdata.arg, ConsoleIP, asf_usrdata.u.data);
105 | break;
106 | case IPAddr:
107 | rtl8168_asf_ip_address(tp, asf_usrdata.arg, IPAddr, asf_usrdata.u.data);
108 | break;
109 | case UUID:
110 | rtl8168_asf_rw_uuid(ioaddr, asf_usrdata.arg, asf_usrdata.u.data);
111 | break;
112 | case IANA:
113 | rtl8168_asf_rw_iana(ioaddr, asf_usrdata.arg, asf_usrdata.u.data);
114 | break;
115 | case SysID:
116 | rtl8168_asf_rw_systemid(ioaddr, asf_usrdata.arg, asf_usrdata.u.data);
117 | break;
118 | case Community:
119 | rtl8168_asf_community_string(ioaddr, asf_usrdata.arg, asf_usrdata.u.string);
120 | break;
121 | case StringLength:
122 | rtl8168_asf_community_string_len(ioaddr, asf_usrdata.arg, asf_usrdata.u.data);
123 | break;
124 | case FmCapMsk:
125 | rtl8168_asf_capability_masks(ioaddr, asf_usrdata.arg, FmCapMsk, asf_usrdata.u.data);
126 | break;
127 | case SpCMDMsk:
128 | rtl8168_asf_capability_masks(ioaddr, asf_usrdata.arg, SpCMDMsk, asf_usrdata.u.data);
129 | break;
130 | case SysCapMsk:
131 | rtl8168_asf_capability_masks(ioaddr, asf_usrdata.arg, SysCapMsk, asf_usrdata.u.data);
132 | break;
133 | case RmtRstAddr:
134 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtRstAddr, RW_ONE_BYTE, asf_usrdata.u.data);
135 | break;
136 | case RmtRstCmd:
137 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtRstCmd, RW_ONE_BYTE, asf_usrdata.u.data);
138 | break;
139 | case RmtRstData:
140 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtRstData, RW_ONE_BYTE, asf_usrdata.u.data);
141 | break;
142 | case RmtPwrOffAddr:
143 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPwrOffAddr, RW_ONE_BYTE, asf_usrdata.u.data);
144 | break;
145 | case RmtPwrOffCmd:
146 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPwrOffCmd, RW_ONE_BYTE, asf_usrdata.u.data);
147 | break;
148 | case RmtPwrOffData:
149 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPwrOffData, RW_ONE_BYTE, asf_usrdata.u.data);
150 | break;
151 | case RmtPwrOnAddr:
152 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPwrOnAddr, RW_ONE_BYTE, asf_usrdata.u.data);
153 | break;
154 | case RmtPwrOnCmd:
155 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPwrOnCmd, RW_ONE_BYTE, asf_usrdata.u.data);
156 | break;
157 | case RmtPwrOnData:
158 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPwrOnData, RW_ONE_BYTE, asf_usrdata.u.data);
159 | break;
160 | case RmtPCRAddr:
161 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPCRAddr, RW_ONE_BYTE, asf_usrdata.u.data);
162 | break;
163 | case RmtPCRCmd:
164 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPCRCmd, RW_ONE_BYTE, asf_usrdata.u.data);
165 | break;
166 | case RmtPCRData:
167 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, RmtPCRData, RW_ONE_BYTE, asf_usrdata.u.data);
168 | break;
169 | case ASFSnsr0Addr:
170 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, ASFSnsr0Addr, RW_ONE_BYTE, asf_usrdata.u.data);
171 | break;
172 | case LSnsrAddr0:
173 | rtl8168_asf_rw_hexadecimal(ioaddr, asf_usrdata.arg, LSnsrAddr0, RW_ONE_BYTE, asf_usrdata.u.data);
174 | break;
175 | case KO:
176 | /* Get/Set Key Operation */
177 | rtl8168_asf_key_access(ioaddr, asf_usrdata.arg, KO, asf_usrdata.u.data);
178 | break;
179 | case KA:
180 | /* Get/Set Key Administrator */
181 | rtl8168_asf_key_access(ioaddr, asf_usrdata.arg, KA, asf_usrdata.u.data);
182 | break;
183 | case KG:
184 | /* Get/Set Key Generation */
185 | rtl8168_asf_key_access(ioaddr, asf_usrdata.arg, KG, asf_usrdata.u.data);
186 | break;
187 | case KR:
188 | /* Get/Set Key Random */
189 | rtl8168_asf_key_access(tp, asf_usrdata.arg, KR, asf_usrdata.u.data);
190 | break;
191 | default:
192 | return -EOPNOTSUPP;
193 | }
194 |
195 | if (copy_to_user(user_data, &asf_usrdata, sizeof(struct asf_ioctl_struct)))
196 | return -EFAULT;
197 |
198 | return 0;
199 | }
200 |
201 | void rtl8168_asf_hbperiod(void __iomem *ioaddr, int arg, unsigned int *data)
202 | {
203 | if (arg == ASF_GET)
204 | data[ASFHBPERIOD] = ReadERI(HBPeriod, RW_TWO_BYTES, ERIAR_ASF);
205 | else if (arg == ASF_SET) {
206 | WriteERI(HBPeriod, RW_TWO_BYTES, data[ASFHBPERIOD], ERIAR_ASF);
207 | WriteERI(0x1EC, RW_ONE_BYTE, 0x07, ERIAR_ASF);
208 | }
209 | }
210 |
211 | void rtl8168_asf_wd16rst(void __iomem *ioaddr, int arg, unsigned int *data)
212 | {
213 | data[ASFWD16RST] = ReadERI(WD16Rst, RW_TWO_BYTES, ERIAR_ASF);
214 | }
215 |
216 | void rtl8168_asf_console_mac(struct rtl8168_private *tp, int arg, unsigned int *data)
217 | {
218 | void __iomem *ioaddr=tp->mmio_addr;
219 | int i;
220 |
221 | if (arg == ASF_GET) {
222 | for (i = 0; i < 6; i++)
223 | data[i] = ReadERI(ConsoleMA + i, RW_ONE_BYTE, ERIAR_ASF);
224 | } else if (arg == ASF_SET) {
225 | for (i = 0; i < 6; i++)
226 | WriteERI(ConsoleMA + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
227 |
228 | /* write the new console MAC address to EEPROM */
229 | rtl_eeprom_write_sc(tp, 70, (data[1] << 8) | data[0]);
230 | rtl_eeprom_write_sc(tp, 71, (data[3] << 8) | data[2]);
231 | rtl_eeprom_write_sc(tp, 72, (data[5] << 8) | data[4]);
232 | }
233 | }
234 |
235 | void rtl8168_asf_ip_address(struct rtl8168_private *tp, int arg, int offset, unsigned int *data)
236 | {
237 | void __iomem *ioaddr=tp->mmio_addr;
238 | int i;
239 | int eeprom_off = 0;
240 |
241 | if (arg == ASF_GET) {
242 | for (i = 0; i < 4; i++)
243 | data[i] = ReadERI(offset + i, RW_ONE_BYTE, ERIAR_ASF);
244 | } else if (arg == ASF_SET) {
245 | for (i = 0; i < 4; i++)
246 | WriteERI(offset + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
247 |
248 | if (offset == ConsoleIP)
249 | eeprom_off = 73;
250 | else if (offset == IPAddr)
251 | eeprom_off = 75;
252 |
253 | /* write the new IP address to EEPROM */
254 | rtl_eeprom_write_sc(tp, eeprom_off, (data[1] << 8) | data[0]);
255 | rtl_eeprom_write_sc(tp, eeprom_off + 1, (data[3] << 8) | data[2]);
256 |
257 | }
258 | }
259 |
260 | void rtl8168_asf_config_regs(void __iomem *ioaddr, int arg, int offset, unsigned int *data)
261 | {
262 | unsigned int value;
263 |
264 | if (arg == ASF_GET) {
265 | data[ASFCAPABILITY] = (ReadERI(offset, RW_ONE_BYTE, ERIAR_ASF) & data[ASFCONFIG]) ? FUNCTION_ENABLE : FUNCTION_DISABLE;
266 | } else if (arg == ASF_SET) {
267 | value = ReadERI(offset, RW_ONE_BYTE, ERIAR_ASF);
268 |
269 | if (data[ASFCAPABILITY] == FUNCTION_ENABLE)
270 | value |= data[ASFCONFIG];
271 | else if (data[ASFCAPABILITY] == FUNCTION_DISABLE)
272 | value &= ~data[ASFCONFIG];
273 |
274 | WriteERI(offset, RW_ONE_BYTE, value, ERIAR_ASF);
275 | }
276 | }
277 |
278 | void rtl8168_asf_capability_masks(void __iomem *ioaddr, int arg, int offset, unsigned int *data)
279 | {
280 | unsigned int len, bit_mask;
281 |
282 | bit_mask = DISABLE_MASK;
283 |
284 | if (offset == FmCapMsk) {
285 | /* System firmware capabilities */
286 | len = RW_FOUR_BYTES;
287 | if (data[ASFCAPMASK] == FUNCTION_ENABLE)
288 | bit_mask = FMW_CAP_MASK;
289 | } else if (offset == SpCMDMsk) {
290 | /* Special commands */
291 | len = RW_TWO_BYTES;
292 | if (data[ASFCAPMASK] == FUNCTION_ENABLE)
293 | bit_mask = SPC_CMD_MASK;
294 | } else {
295 | /* System capability (offset == SysCapMsk)*/
296 | len = RW_ONE_BYTE;
297 | if (data[ASFCAPMASK] == FUNCTION_ENABLE)
298 | bit_mask = SYS_CAP_MASK;
299 | }
300 |
301 | if (arg == ASF_GET)
302 | data[ASFCAPMASK] = ReadERI(offset, len, ERIAR_ASF) ? FUNCTION_ENABLE : FUNCTION_DISABLE;
303 | else /* arg == ASF_SET */
304 | WriteERI(offset, len, bit_mask, ERIAR_ASF);
305 | }
306 |
307 | void rtl8168_asf_community_string(void __iomem *ioaddr, int arg, char *string)
308 | {
309 | int i;
310 |
311 | if (arg == ASF_GET) {
312 | for (i = 0; i < COMMU_STR_MAX_LEN; i++)
313 | string[i] = ReadERI(Community + i, RW_ONE_BYTE, ERIAR_ASF);
314 | } else { /* arg == ASF_SET */
315 | for (i = 0; i < COMMU_STR_MAX_LEN; i++)
316 | WriteERI(Community + i, RW_ONE_BYTE, string[i], ERIAR_ASF);
317 | }
318 | }
319 |
320 | void rtl8168_asf_community_string_len(void __iomem *ioaddr, int arg, unsigned int *data)
321 | {
322 | if (arg == ASF_GET)
323 | data[ASFCOMMULEN] = ReadERI(StringLength, RW_ONE_BYTE, ERIAR_ASF);
324 | else /* arg == ASF_SET */
325 | WriteERI(StringLength, RW_ONE_BYTE, data[ASFCOMMULEN], ERIAR_ASF);
326 | }
327 |
328 | void rtl8168_asf_time_period(void __iomem *ioaddr, int arg, int offset, unsigned int *data)
329 | {
330 | int pos = 0;
331 |
332 | if (offset == WD8Rst)
333 | pos = ASFWD8RESET;
334 | else if (offset == LSnsrPollCycle)
335 | pos = ASFLSNRPOLLCYC;
336 | else if (offset == ASFSnsrPollPrd)
337 | pos = ASFSNRPOLLCYC;
338 | else if (offset == AlertReSendItvl)
339 | pos = ASFALERTRESND;
340 |
341 | if (arg == ASF_GET)
342 | data[pos] = ReadERI(offset, RW_ONE_BYTE, ERIAR_ASF);
343 | else /* arg == ASF_SET */
344 | WriteERI(offset, RW_ONE_BYTE, data[pos], ERIAR_ASF);
345 |
346 | }
347 |
348 | void rtl8168_asf_key_access(struct rtl8168_private *tp, int arg, int offset, unsigned int *data)
349 | {
350 | void __iomem *ioaddr=tp->mmio_addr;
351 | int i, j;
352 | int key_off = 0;
353 |
354 | if (arg == ASF_GET) {
355 | for (i = 0; i < KEY_LEN; i++)
356 | data[i] = ReadERI(offset + KEY_LEN - (i + 1), RW_ONE_BYTE, ERIAR_ASF);
357 | } else {
358 | if (offset == KO)
359 | key_off = 162;
360 | else if (offset == KA)
361 | key_off = 172;
362 | else if (offset == KG)
363 | key_off = 182;
364 | else if (offset == KR)
365 | key_off = 192;
366 |
367 | /* arg == ASF_SET */
368 | for (i = 0; i < KEY_LEN; i++)
369 | WriteERI(offset + KEY_LEN - (i + 1), RW_ONE_BYTE, data[i], ERIAR_ASF);
370 |
371 | /* write the new key to EEPROM */
372 | for (i = 0, j = 19; i < 10; i++, j = j - 2)
373 | rtl_eeprom_write_sc(tp, key_off + i, (data[j - 1] << 8) | data[j]);
374 | }
375 | }
376 |
377 | void rtl8168_asf_rw_hexadecimal(void __iomem *ioaddr, int arg, int offset, int len, unsigned int *data)
378 | {
379 | if (arg == ASF_GET)
380 | data[ASFRWHEXNUM] = ReadERI(offset, len, ERIAR_ASF);
381 | else /* arg == ASF_SET */
382 | WriteERI(offset, len, data[ASFRWHEXNUM], ERIAR_ASF);
383 | }
384 |
385 | void rtl8168_asf_rw_systemid(void __iomem *ioaddr, int arg, unsigned int *data)
386 | {
387 | int i;
388 |
389 | if (arg == ASF_GET)
390 | for (i = 0; i < SYSID_LEN ; i++)
391 | data[i] = ReadERI(SysID + i, RW_ONE_BYTE, ERIAR_ASF);
392 | else /* arg == ASF_SET */
393 | for (i = 0; i < SYSID_LEN ; i++)
394 | WriteERI(SysID + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
395 | }
396 |
397 | void rtl8168_asf_rw_iana(void __iomem *ioaddr, int arg, unsigned int *data)
398 | {
399 | int i;
400 |
401 | if (arg == ASF_GET)
402 | for (i = 0; i < RW_FOUR_BYTES; i++)
403 | data[i] = ReadERI(IANA + i, RW_ONE_BYTE, ERIAR_ASF);
404 | else /* arg == ASF_SET */
405 | for (i = 0; i < RW_FOUR_BYTES; i++)
406 | WriteERI(IANA + i, RW_ONE_BYTE, data[i], ERIAR_ASF);
407 | }
408 |
409 | void rtl8168_asf_rw_uuid(void __iomem *ioaddr, int arg, unsigned int *data)
410 | {
411 | int i, j;
412 |
413 | if (arg == ASF_GET)
414 | for (i = UUID_LEN - 1, j = 0; i >= 0 ; i--, j++)
415 | data[j] = ReadERI(UUID + i, RW_ONE_BYTE, ERIAR_ASF);
416 | else /* arg == ASF_SET */
417 | for (i = UUID_LEN - 1, j = 0; i >= 0 ; i--, j++)
418 | WriteERI(UUID + i, RW_ONE_BYTE, data[j], ERIAR_ASF);
419 | }
420 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/r8168_asf.h:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | #define SIOCDEVPRIVATE_RTLASF SIOCDEVPRIVATE
35 |
36 | #define FUNCTION_ENABLE 1
37 | #define FUNCTION_DISABLE 0
38 |
39 | #define ASFCONFIG 0
40 | #define ASFCAPABILITY 1
41 | #define ASFCOMMULEN 0
42 | #define ASFHBPERIOD 0
43 | #define ASFWD16RST 0
44 | #define ASFCAPMASK 0
45 | #define ASFALERTRESND 0
46 | #define ASFLSNRPOLLCYC 0
47 | #define ASFSNRPOLLCYC 0
48 | #define ASFWD8RESET 0
49 | #define ASFRWHEXNUM 0
50 |
51 | #define FMW_CAP_MASK 0x0000F867
52 | #define SPC_CMD_MASK 0x1F00
53 | #define SYS_CAP_MASK 0xFF
54 | #define DISABLE_MASK 0x00
55 |
56 | #define MAX_DATA_LEN 200
57 | #define MAX_STR_LEN 200
58 |
59 | #define COMMU_STR_MAX_LEN 23
60 |
61 | #define KEY_LEN 20
62 | #define UUID_LEN 16
63 | #define SYSID_LEN 2
64 |
65 | #define RW_ONE_BYTE 1
66 | #define RW_TWO_BYTES 2
67 | #define RW_FOUR_BYTES 4
68 |
69 | enum asf_registers {
70 | HBPeriod = 0x0000,
71 | WD8Rst = 0x0002,
72 | WD8Timer = 0x0003,
73 | WD16Rst = 0x0004,
74 | LSnsrPollCycle = 0x0006,
75 | ASFSnsrPollPrd = 0x0007,
76 | AlertReSendCnt = 0x0008,
77 | AlertReSendItvl = 0x0009,
78 | SMBAddr = 0x000A,
79 | SMBCap = 0x000B,
80 | ASFConfigR0 = 0x000C,
81 | ASFConfigR1 = 0x000D,
82 | WD16Timer = 0x000E,
83 | ConsoleMA = 0x0010,
84 | ConsoleIP = 0x0016,
85 | IPAddr = 0x001A,
86 |
87 | UUID = 0x0020,
88 | IANA = 0x0030,
89 | SysID = 0x0034,
90 | Community = 0x0036,
91 | StringLength = 0x004D,
92 | LC = 0x004E,
93 | EntityInst = 0x004F,
94 | FmCapMsk = 0x0050,
95 | SpCMDMsk = 0x0054,
96 | SysCapMsk = 0x0056,
97 | WDSysSt = 0x0057,
98 | RxMsgType = 0x0058,
99 | RxSpCMD = 0x0059,
100 | RxSpCMDPa = 0x005A,
101 | RxBtOpMsk = 0x005C,
102 | RmtRstAddr = 0x005E,
103 | RmtRstCmd = 0x005F,
104 | RmtRstData = 0x0060,
105 | RmtPwrOffAddr = 0x0061,
106 | RmtPwrOffCmd = 0x0062,
107 | RmtPwrOffData = 0x0063,
108 | RmtPwrOnAddr = 0x0064,
109 | RmtPwrOnCmd = 0x0065,
110 | RmtPwrOnData = 0x0066,
111 | RmtPCRAddr = 0x0067,
112 | RmtPCRCmd = 0x0068,
113 | RmtPCRData = 0x0069,
114 | RMCP_IANA = 0x006A,
115 | RMCP_OEM = 0x006E,
116 | ASFSnsr0Addr = 0x0070,
117 |
118 | ASFSnsrEvSt = 0x0073,
119 | ASFSnsrEvAlert = 0x0081,
120 |
121 | LSnsrNo = 0x00AD,
122 | AssrtEvntMsk = 0x00AE,
123 | DeAssrtEvntMsk = 0x00AF,
124 |
125 | LSnsrAddr0 = 0x00B0,
126 | LAlertCMD0 = 0x00B1,
127 | LAlertDataMsk0 = 0x00B2,
128 | LAlertCmp0 = 0x00B3,
129 | LAlertESnsrT0 = 0x00B4,
130 | LAlertET0 = 0x00B5,
131 | LAlertEOffset0 = 0x00B6,
132 | LAlertES0 = 0x00B7,
133 | LAlertSN0 = 0x00B8,
134 | LAlertEntity0 = 0x00B9,
135 | LAlertEI0 = 0x00BA,
136 | LSnsrState0 = 0x00BB,
137 |
138 | LSnsrAddr1 = 0x00BD,
139 | LAlertCMD1 = 0x00BE,
140 | LAlertDataMsk1 = 0x00BF,
141 | LAlertCmp1 = 0x00C0,
142 | LAlertESnsrT1 = 0x00C1,
143 | LAlertET1 = 0x00C2,
144 | LAlertEOffset1 = 0x00C3,
145 | LAlertES1 = 0x00C4,
146 | LAlertSN1 = 0x00C5,
147 | LAlertEntity1 = 0x00C6,
148 | LAlertEI1 = 0x00C7,
149 | LSnsrState1 = 0x00C8,
150 |
151 | LSnsrAddr2 = 0x00CA,
152 | LAlertCMD2 = 0x00CB,
153 | LAlertDataMsk2 = 0x00CC,
154 | LAlertCmp2 = 0x00CD,
155 | LAlertESnsrT2 = 0x00CE,
156 | LAlertET2 = 0x00CF,
157 | LAlertEOffset2 = 0x00D0,
158 | LAlertES2 = 0x00D1,
159 | LAlertSN2 = 0x00D2,
160 | LAlertEntity2 = 0x00D3,
161 | LAlertEI2 = 0x00D4,
162 | LSnsrState2 = 0x00D5,
163 |
164 | LSnsrAddr3 = 0x00D7,
165 | LAlertCMD3 = 0x00D8,
166 | LAlertDataMsk3 = 0x00D9,
167 | LAlertCmp3 = 0x00DA,
168 | LAlertESnsrT3 = 0x00DB,
169 | LAlertET3 = 0x00DC,
170 | LAlertEOffset3 = 0x00DD,
171 | LAlertES3 = 0x00DE,
172 | LAlertSN3 = 0x00DF,
173 | LAlertEntity3 = 0x00E0,
174 | LAlertEI3 = 0x00E1,
175 | LSnsrState3 = 0x00E2,
176 |
177 | LSnsrAddr4 = 0x00E4,
178 | LAlertCMD4 = 0x00E5,
179 | LAlertDataMsk4 = 0x00E6,
180 | LAlertCmp4 = 0x00E7,
181 | LAlertESnsrT4 = 0x00E8,
182 | LAlertET4 = 0x00E9,
183 | LAlertEOffset4 = 0x00EA,
184 | LAlertES4 = 0x00EB,
185 | LAlertSN4 = 0x00EC,
186 | LAlertEntity4 = 0x00ED,
187 | LAlertEI4 = 0x00EE,
188 | LSnsrState4 = 0x00EF,
189 |
190 | LSnsrAddr5 = 0x00F1,
191 | LAlertCMD5 = 0x00F2,
192 | LAlertDataMsk5 = 0x00F3,
193 | LAlertCmp5 = 0x00F4,
194 | LAlertESnsrT5 = 0x00F5,
195 | LAlertET5 = 0x00F6,
196 | LAlertEOffset5 = 0x00F7,
197 | LAlertES5 = 0x00F8,
198 | LAlertSN5 = 0x00F9,
199 | LAlertEntity5 = 0x00FA,
200 | LAlertEI5 = 0x00FB,
201 | LSnsrState5 = 0x00FC,
202 |
203 | LSnsrAddr6 = 0x00FE,
204 | LAlertCMD6 = 0x00FF,
205 | LAlertDataMsk6 = 0x0100,
206 | LAlertCmp6 = 0x0101,
207 | LAlertESnsrT6 = 0x0102,
208 | LAlertET6 = 0x0103,
209 | LAlertEOffset6 = 0x0104,
210 | LAlertES6 = 0x0105,
211 | LAlertSN6 = 0x0106,
212 | LAlertEntity6 = 0x0107,
213 | LAlertEI6 = 0x0108,
214 | LSnsrState6 = 0x0109,
215 |
216 | LSnsrAddr7 = 0x010B,
217 | LAlertCMD7 = 0x010C,
218 | LAlertDataMsk7 = 0x010D,
219 | LAlertCmp7 = 0x010E,
220 | LAlertESnsrT7 = 0x010F,
221 | LAlertET7 = 0x0110,
222 | LAlertEOffset7 = 0x0111,
223 | LAlertES7 = 0x0112,
224 | LAlertSN7 = 0x0113,
225 | LAlertEntity7 = 0x0114,
226 | LAlertEI7 = 0x0115,
227 | LSnsrState7 = 0x0116,
228 | LAssert = 0x0117,
229 | LDAssert = 0x0118,
230 | IPServiceType = 0x0119,
231 | IPIdfr = 0x011A,
232 | FlagFOffset = 0x011C,
233 | TTL = 0x011E,
234 | HbtEI = 0x011F,
235 | MgtConSID1 = 0x0120,
236 | MgtConSID2 = 0x0124,
237 | MgdCltSID = 0x0128,
238 | StCd = 0x012C,
239 | MgtConUR = 0x012D,
240 | MgtConUNL = 0x012E,
241 |
242 | AuthPd = 0x0130,
243 | IntyPd = 0x0138,
244 | MgtConRN = 0x0140,
245 | MgdCtlRN = 0x0150,
246 | MgtConUN = 0x0160,
247 | Rakp2IntCk = 0x0170,
248 | KO = 0x017C,
249 | KA = 0x0190,
250 | KG = 0x01A4,
251 | KR = 0x01B8,
252 | CP = 0x01CC,
253 | CQ = 0x01D0,
254 | KC = 0x01D4,
255 | ConsoleSid = 0x01E8,
256 |
257 | SIK1 = 0x01FC,
258 | SIK2 = 0x0210,
259 | Udpsrc_port = 0x0224,
260 | Udpdes_port = 0x0226,
261 | Asf_debug_mux = 0x0228
262 | };
263 |
264 | enum asf_cmdln_opt {
265 | ASF_GET,
266 | ASF_SET,
267 | ASF_HELP
268 | };
269 |
270 | struct asf_ioctl_struct {
271 | unsigned int arg;
272 | unsigned int offset;
273 | union {
274 | unsigned int data[MAX_DATA_LEN];
275 | char string[MAX_STR_LEN];
276 | } u;
277 | };
278 |
279 | int rtl8168_asf_ioctl(struct net_device *dev, struct ifreq *ifr);
280 | void rtl8168_asf_hbperiod(void __iomem *ioaddr, int arg, unsigned int *data);
281 | void rtl8168_asf_wd16rst(void __iomem *ioaddr, int arg, unsigned int *data);
282 | void rtl8168_asf_console_mac(struct rtl8168_private *, int arg, unsigned int *data);
283 | void rtl8168_asf_ip_address(struct rtl8168_private *, int arg, int offset, unsigned int *data);
284 | void rtl8168_asf_config_regs(void __iomem *ioaddr, int arg, int offset, unsigned int *data);
285 | void rtl8168_asf_capability_masks(void __iomem *ioaddr, int arg, int offset, unsigned int *data);
286 | void rtl8168_asf_community_string(void __iomem *ioaddr, int arg, char *string);
287 | void rtl8168_asf_community_string_len(void __iomem *ioaddr, int arg, unsigned int *data);
288 | void rtl8168_asf_alert_resend_interval(void __iomem *ioaddr, int arg, unsigned int *data);
289 | void rtl8168_asf_time_period(void __iomem *ioaddr, int arg, int offset, unsigned int *data);
290 | void rtl8168_asf_key_access(struct rtl8168_private *, int arg, int offset, unsigned int *data);
291 | void rtl8168_asf_rw_hexadecimal(void __iomem *ioaddr, int arg, int offset, int len, unsigned int *data);
292 | void rtl8168_asf_rw_iana(void __iomem *ioaddr, int arg, unsigned int *data);
293 | void rtl8168_asf_rw_uuid(void __iomem *ioaddr, int arg, unsigned int *data);
294 | void rtl8168_asf_rw_systemid(void __iomem *ioaddr, int arg, unsigned int *data);
295 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/rtl_eeprom.c:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 | #include
42 |
43 | #include "r8168.h"
44 | #include "rtl_eeprom.h"
45 |
46 | //-------------------------------------------------------------------
47 | //rtl_eeprom_type():
48 | // tell the eeprom type
49 | //return value:
50 | // 0: the eeprom type is 93C46
51 | // 1: the eeprom type is 93C56 or 93C66
52 | //-------------------------------------------------------------------
53 | void rtl_eeprom_type(struct rtl8168_private *tp)
54 | {
55 | void __iomem *ioaddr=tp->mmio_addr;
56 | u16 magic = 0;
57 |
58 | if (mcfg == CFG_METHOD_DEFAULT)
59 | goto out_no_eeprom;
60 |
61 | if(ReadMMIO8(0xD2)&0x04) {
62 | //not support
63 | //tp->eeprom_type = EEPROM_TWSI;
64 | //tp->eeprom_len = 256;
65 | goto out_no_eeprom;
66 | } else if(ReadMMIO32(RxConfig) & RxCfg_9356SEL) {
67 | tp->eeprom_type = EEPROM_TYPE_93C56;
68 | tp->eeprom_len = 256;
69 | } else {
70 | tp->eeprom_type = EEPROM_TYPE_93C46;
71 | tp->eeprom_len = 128;
72 | }
73 |
74 | magic = rtl_eeprom_read_sc(tp, 0);
75 |
76 | out_no_eeprom:
77 | if ((magic != 0x8129) && (magic != 0x8128)) {
78 | tp->eeprom_type = EEPROM_TYPE_NONE;
79 | tp->eeprom_len = 0;
80 | }
81 | }
82 |
83 | void rtl_eeprom_cleanup(void __iomem *ioaddr)
84 | {
85 | u8 x;
86 |
87 | x = ReadMMIO8(Cfg9346);
88 | x &= ~(Cfg9346_EEDI | Cfg9346_EECS);
89 |
90 | WriteMMIO8(Cfg9346, x);
91 |
92 | rtl_raise_clock(&x, ioaddr);
93 | rtl_lower_clock(&x, ioaddr);
94 | }
95 |
96 | int rtl_eeprom_cmd_done(void __iomem *ioaddr)
97 | {
98 | u8 x;
99 | int i;
100 |
101 | rtl_stand_by(ioaddr);
102 |
103 | for (i = 0; i < 50000; i++) {
104 | x = ReadMMIO8(Cfg9346);
105 |
106 | if (x & Cfg9346_EEDO) {
107 | IODelay(RTL_CLOCK_RATE * 2 * 3);
108 | return 0;
109 | }
110 | IODelay(1);
111 | }
112 |
113 | return -1;
114 | }
115 |
116 | //-------------------------------------------------------------------
117 | //rtl_eeprom_read_sc():
118 | // read one word from eeprom
119 | //-------------------------------------------------------------------
120 | u16 rtl_eeprom_read_sc(struct rtl8168_private *tp, u16 reg)
121 | {
122 | void __iomem *ioaddr=tp->mmio_addr;
123 | int addr_sz = 6;
124 | u8 x;
125 | u16 data;
126 |
127 | if(tp->eeprom_type == EEPROM_TYPE_NONE) {
128 | return -1;
129 | }
130 |
131 | if (tp->eeprom_type==EEPROM_TYPE_93C46)
132 | addr_sz = 6;
133 | else if (tp->eeprom_type==EEPROM_TYPE_93C56)
134 | addr_sz = 8;
135 |
136 | x = Cfg9346_EEM1 | Cfg9346_EECS;
137 | WriteMMIO8(Cfg9346, x);
138 |
139 | rtl_shift_out_bits(RTL_EEPROM_READ_OPCODE, 3, ioaddr);
140 | rtl_shift_out_bits(reg, addr_sz, ioaddr);
141 |
142 | data = rtl_shift_in_bits(ioaddr);
143 |
144 | rtl_eeprom_cleanup(ioaddr);
145 |
146 | WriteMMIO8(Cfg9346, 0);
147 |
148 | return data;
149 | }
150 |
151 | //-------------------------------------------------------------------
152 | //rtl_eeprom_write_sc():
153 | // write one word to a specific address in the eeprom
154 | //-------------------------------------------------------------------
155 | void rtl_eeprom_write_sc(struct rtl8168_private *tp, u16 reg, u16 data)
156 | {
157 | void __iomem *ioaddr=tp->mmio_addr;
158 | u8 x;
159 | int addr_sz = 6;
160 | int w_dummy_addr = 4;
161 |
162 | if(tp->eeprom_type == EEPROM_TYPE_NONE) {
163 | return ;
164 | }
165 |
166 | if (tp->eeprom_type==EEPROM_TYPE_93C46) {
167 | addr_sz = 6;
168 | w_dummy_addr = 4;
169 | } else if (tp->eeprom_type==EEPROM_TYPE_93C56) {
170 | addr_sz = 8;
171 | w_dummy_addr = 6;
172 | }
173 |
174 | x = Cfg9346_EEM1 | Cfg9346_EECS;
175 | WriteMMIO8(Cfg9346, x);
176 |
177 | rtl_shift_out_bits(RTL_EEPROM_EWEN_OPCODE, 5, ioaddr);
178 | rtl_shift_out_bits(reg, w_dummy_addr, ioaddr);
179 | rtl_stand_by(ioaddr);
180 |
181 | rtl_shift_out_bits(RTL_EEPROM_ERASE_OPCODE, 3, ioaddr);
182 | rtl_shift_out_bits(reg, addr_sz, ioaddr);
183 | if (rtl_eeprom_cmd_done(ioaddr) < 0) {
184 | return;
185 | }
186 | rtl_stand_by(ioaddr);
187 |
188 | rtl_shift_out_bits(RTL_EEPROM_WRITE_OPCODE, 3, ioaddr);
189 | rtl_shift_out_bits(reg, addr_sz, ioaddr);
190 | rtl_shift_out_bits(data, 16, ioaddr);
191 | if (rtl_eeprom_cmd_done(ioaddr) < 0) {
192 | return;
193 | }
194 | rtl_stand_by(ioaddr);
195 |
196 | rtl_shift_out_bits(RTL_EEPROM_EWDS_OPCODE, 5, ioaddr);
197 | rtl_shift_out_bits(reg, w_dummy_addr, ioaddr);
198 |
199 | rtl_eeprom_cleanup(ioaddr);
200 | WriteMMIO8(Cfg9346, 0);
201 | }
202 |
203 | void rtl_raise_clock(u8 *x, void __iomem *ioaddr)
204 | {
205 | *x = *x | Cfg9346_EESK;
206 | WriteMMIO8(Cfg9346, *x);
207 | IODelay(RTL_CLOCK_RATE);
208 | }
209 |
210 | void rtl_lower_clock(u8 *x, void __iomem *ioaddr)
211 | {
212 |
213 | *x = *x & ~Cfg9346_EESK;
214 | WriteMMIO8(Cfg9346, *x);
215 | IODelay(RTL_CLOCK_RATE);
216 | }
217 |
218 | void rtl_shift_out_bits(int data, int count, void __iomem *ioaddr)
219 | {
220 | u8 x;
221 | int mask;
222 |
223 | mask = 0x01 << (count - 1);
224 | x = ReadMMIO8(Cfg9346);
225 | x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);
226 |
227 | do {
228 | if (data & mask)
229 | x |= Cfg9346_EEDI;
230 | else
231 | x &= ~Cfg9346_EEDI;
232 |
233 | WriteMMIO8(Cfg9346, x);
234 | IODelay(RTL_CLOCK_RATE);
235 | rtl_raise_clock(&x, ioaddr);
236 | rtl_lower_clock(&x, ioaddr);
237 | mask = mask >> 1;
238 | } while(mask);
239 |
240 | x &= ~Cfg9346_EEDI;
241 | WriteMMIO8(Cfg9346, x);
242 | }
243 |
244 | u16 rtl_shift_in_bits(void __iomem *ioaddr)
245 | {
246 | u8 x;
247 | u16 d, i;
248 |
249 | x = ReadMMIO8(Cfg9346);
250 | x &= ~(Cfg9346_EEDI | Cfg9346_EEDO);
251 |
252 | d = 0;
253 |
254 | for (i = 0; i < 16; i++) {
255 | d = d << 1;
256 | rtl_raise_clock(&x, ioaddr);
257 |
258 | x = ReadMMIO8(Cfg9346);
259 | x &= ~Cfg9346_EEDI;
260 |
261 | if (x & Cfg9346_EEDO)
262 | d |= 1;
263 |
264 | rtl_lower_clock(&x, ioaddr);
265 | }
266 |
267 | return d;
268 | }
269 |
270 | void rtl_stand_by(void __iomem *ioaddr)
271 | {
272 | u8 x;
273 |
274 | x = ReadMMIO8(Cfg9346);
275 | x &= ~(Cfg9346_EECS | Cfg9346_EESK);
276 | WriteMMIO8(Cfg9346, x);
277 | IODelay(RTL_CLOCK_RATE);
278 |
279 | x |= Cfg9346_EECS;
280 | WriteMMIO8(Cfg9346, x);
281 | }
282 |
283 | void rtl_set_eeprom_sel_low(void __iomem *ioaddr)
284 | {
285 | WriteMMIO8(Cfg9346, Cfg9346_EEM1);
286 | WriteMMIO8(Cfg9346, Cfg9346_EEM1 | Cfg9346_EESK);
287 |
288 | IODelay(20);
289 |
290 | WriteMMIO8(Cfg9346, Cfg9346_EEM1);
291 | }
292 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/rtl_eeprom.h:
--------------------------------------------------------------------------------
1 | /*
2 | ################################################################################
3 | #
4 | # r8168 is the Linux device driver released for Realtek Gigabit Ethernet
5 | # controllers with PCI-Express interface.
6 | #
7 | # Copyright(c) 2013 Realtek Semiconductor Corp. All rights reserved.
8 | #
9 | # This program is free software; you can redistribute it and/or modify it
10 | # under the terms of the GNU General Public License as published by the Free
11 | # Software Foundation; either version 2 of the License, or (at your option)
12 | # any later version.
13 | #
14 | # This program is distributed in the hope that it will be useful, but WITHOUT
15 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 | # more details.
18 | #
19 | # You should have received a copy of the GNU General Public License along with
20 | # this program; if not, see .
21 | #
22 | # Author:
23 | # Realtek NIC software team
24 | # No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
25 | #
26 | ################################################################################
27 | */
28 |
29 | /************************************************************************************
30 | * This product is covered by one or more of the following patents:
31 | * US6,570,884, US6,115,776, and US6,327,625.
32 | ***********************************************************************************/
33 |
34 | //EEPROM opcodes
35 | #define RTL_EEPROM_READ_OPCODE 06
36 | #define RTL_EEPROM_WRITE_OPCODE 05
37 | #define RTL_EEPROM_ERASE_OPCODE 07
38 | #define RTL_EEPROM_EWEN_OPCODE 19
39 | #define RTL_EEPROM_EWDS_OPCODE 16
40 |
41 | #define RTL_CLOCK_RATE 3
42 |
43 | void rtl_eeprom_type(struct rtl8168_private *tp);
44 | void rtl_eeprom_cleanup(void __iomem *ioaddr);
45 | u16 rtl_eeprom_read_sc(struct rtl8168_private *tp, u16 reg);
46 | void rtl_eeprom_write_sc(struct rtl8168_private *tp, u16 reg, u16 data);
47 | void rtl_shift_out_bits(int data, int count, void __iomem *ioaddr);
48 | u16 rtl_shift_in_bits(void __iomem *ioaddr);
49 | void rtl_raise_clock(u8 *x, void __iomem *ioaddr);
50 | void rtl_lower_clock(u8 *x, void __iomem *ioaddr);
51 | void rtl_stand_by(void __iomem *ioaddr);
52 | void rtl_set_eeprom_sel_low(void __iomem *ioaddr);
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/rtltool.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include "r8168.h"
9 | #include "rtl_eeprom.h"
10 | #include "rtltool.h"
11 |
12 | static int
13 | OOB_set_ip_mac(struct rtl8168_private *tp, struct sockaddr_in *sa, u8 *mac)
14 | {
15 | u32 data;
16 |
17 | if (mcfg == MCFG_8168DP_3) {
18 | OCP_write(tp, 0xF, 0xd0, be32_to_cpu(sa->sin_addr.s_addr));
19 |
20 | memcpy(&data, mac, 4);
21 | OCP_write(tp, 0xF, 0x00, le32_to_cpu(data));
22 | data = 0;
23 | memcpy(&data, mac + 4, 2);
24 | OCP_write(tp, 0x3, 0x04, le32_to_cpu(data));
25 |
26 | OOB_notify(tp, OOB_CMD_SET_IPMAC);
27 | } else if (mcfg == MCFG_8168E_VL_2) {
28 | void __iomem *ioaddr = tp->mmio_addr;
29 | struct net_device *dev = tp->dev;
30 | u32 rx_mode;
31 |
32 | rx_mode = ReadMMIO32(RxConfig);
33 | if (netif_running(dev)) {
34 | netif_stop_queue(dev);
35 | WriteMMIO32(RxConfig, rx_mode & ~0x3f);
36 | while ((ReadMMIO8(0xd3) & (BIT_5 | BIT_4)) != ((BIT_5 | BIT_4)))
37 | IODelay(20);
38 | WriteMMIO8(ChipCmd, ReadMMIO8(ChipCmd) & ~(CmdTxEnb | CmdRxEnb));
39 | // } else {
40 | // unsigned long flags;
41 | //
42 | // spin_lock_irqsave(&tp->phy_lock, flags);
43 | // WriteGMII16( 0x1f, 0x0000);
44 | // data = ReadGMII16( MII_CTRL1000);
45 | // data &= ~(ADVERTISE_1000HALF | ADVERTISE_1000FULL);
46 | // WriteGMII16( MII_CTRL1000, data);
47 | // WriteGMII16( 0x00, 0x9200);
48 | // spin_unlock_irqrestore(&tp->phy_lock, flags);
49 | //
50 | // ssleep(3);
51 | // WriteMMIO16(IntrStatus, ReadMMIO16(IntrStatus));
52 | //
53 | // WriteMMIO32(MAR0, 0);
54 | // WriteMMIO32(MAR0 + 4, 0);
55 | // WriteMMIO16(RxMaxSize, 0x05f3);
56 | }
57 | WriteMMIO8(0xD3, ReadMMIO8(0xD3) & ~BIT_7);
58 | WriteERI(0x180, 4, 0x06080888, ERIAR_ExGMAC);
59 | WriteERI(0x184, 4, 0xdd860008, ERIAR_ExGMAC);
60 |
61 | memcpy(&data, mac, 2);
62 | WriteERI(0xf0, 4, (le32_to_cpu(data) << 16), ERIAR_ExGMAC);
63 | memcpy(&data, mac + 2, 4);
64 | WriteERI(0xf4, 4, le32_to_cpu(data), ERIAR_ExGMAC);
65 |
66 | WriteERI(0x190, 4, 0x3c110600, ERIAR_ExGMAC);
67 | WriteERI(0x194, 4, 0x2c32332b, ERIAR_ExGMAC);
68 | WriteERI(0x198, 4, 0x003a0201, ERIAR_ExGMAC);
69 | WriteERI(0x19c, 4, 0x00000000, ERIAR_ExGMAC);
70 |
71 | WriteERI(0x1f0, 4, cpu_to_le32(sa->sin_addr.s_addr), ERIAR_ExGMAC);
72 |
73 | memcpy(&data, mac, 4);
74 | WriteERI(0x258, 4, le32_to_cpu(data), ERIAR_ExGMAC);
75 | memcpy(&data, mac + 4, 2);
76 | WriteERI(0x25c, 2, le32_to_cpu(data), ERIAR_ExGMAC);
77 |
78 | WriteMMIO8(0xe0, ReadMMIO8(0xe0) | BIT_6);
79 | while (!(ReadMMIO8(0xd3) & BIT_1))
80 | IODelay(20);
81 |
82 | WriteMMIO32(0xb0, 0x9800e035);
83 | WriteMMIO32(0xb0, 0x9801e034);
84 | WriteMMIO32(0xb0, 0x9802e019);
85 | WriteMMIO32(0xb0, 0x98039918);
86 | WriteMMIO32(0xb0, 0x9804c011);
87 | WriteMMIO32(0xb0, 0x98057100);
88 | WriteMMIO32(0xb0, 0x9806499f);
89 | WriteMMIO32(0xb0, 0x9807f011);
90 | WriteMMIO32(0xb0, 0x9808c00e);
91 | WriteMMIO32(0xb0, 0x98097100);
92 | WriteMMIO32(0xb0, 0x980A4995);
93 | WriteMMIO32(0xb0, 0x980Bf00d);
94 | WriteMMIO32(0xb0, 0x980C4895);
95 | WriteMMIO32(0xb0, 0x980D9900);
96 | WriteMMIO32(0xb0, 0x980Ec009);
97 | WriteMMIO32(0xb0, 0x980F7100);
98 | WriteMMIO32(0xb0, 0x98104890);
99 | WriteMMIO32(0xb0, 0x98119900);
100 | WriteMMIO32(0xb0, 0x98124810);
101 | WriteMMIO32(0xb0, 0x98139900);
102 | WriteMMIO32(0xb0, 0x9814e004);
103 | WriteMMIO32(0xb0, 0x9815d44e);
104 | WriteMMIO32(0xb0, 0x9816d506);
105 | WriteMMIO32(0xb0, 0x9817c0b4);
106 | WriteMMIO32(0xb0, 0x9818c002);
107 | WriteMMIO32(0xb0, 0x9819b800);
108 | WriteMMIO32(0xb0, 0x981A0500);
109 | WriteMMIO32(0xb0, 0x981B1a26);
110 | WriteMMIO32(0xb0, 0x981Ca4ca);
111 | WriteMMIO32(0xb0, 0x981D21bc);
112 | WriteMMIO32(0xb0, 0x981E25bc);
113 | WriteMMIO32(0xb0, 0x981F1305);
114 | WriteMMIO32(0xb0, 0x9820f00d);
115 | WriteMMIO32(0xb0, 0x9821c213);
116 | WriteMMIO32(0xb0, 0x98227340);
117 | WriteMMIO32(0xb0, 0x982349b0);
118 | WriteMMIO32(0xb0, 0x9824f009);
119 | WriteMMIO32(0xb0, 0x98251a3a);
120 | WriteMMIO32(0xb0, 0x9826a4ca);
121 | WriteMMIO32(0xb0, 0x982721b9);
122 | WriteMMIO32(0xb0, 0x982825b9);
123 | WriteMMIO32(0xb0, 0x98291303);
124 | WriteMMIO32(0xb0, 0x982Af006);
125 | WriteMMIO32(0xb0, 0x982B1309);
126 | WriteMMIO32(0xb0, 0x982Cf004);
127 | WriteMMIO32(0xb0, 0x982Dc306);
128 | WriteMMIO32(0xb0, 0x982E1a26);
129 | WriteMMIO32(0xb0, 0x982Fbb00);
130 | WriteMMIO32(0xb0, 0x9830c302);
131 | WriteMMIO32(0xb0, 0x9831bb00);
132 | WriteMMIO32(0xb0, 0x98320f3e);
133 | WriteMMIO32(0xb0, 0x98330f4e);
134 | WriteMMIO32(0xb0, 0x9834c0ae);
135 | WriteMMIO32(0xb0, 0x98351800);
136 | WriteMMIO32(0xb0, 0x9836b800);
137 | WriteMMIO32(0xb0, 0xfe173000);
138 | WriteMMIO32(0xb0, 0xfe1604ff);
139 | WriteMMIO32(0xb0, 0xfe150f4d);
140 | data = ReadERI(0xd6, 1, ERIAR_ExGMAC);
141 | WriteERI(0xd6, 1, data | BIT_0, ERIAR_ExGMAC);
142 |
143 | if (netif_running(dev)) {
144 | rtl8168_init_ring_indexes(tp);
145 | WriteMMIO8(ChipCmd, CmdRxEnb | CmdTxEnb);
146 | WriteMMIO32(RxConfig, rx_mode);
147 | netif_wake_queue(dev);
148 | } else {
149 | WriteMMIO8(0xD3, ReadMMIO8(0xD3) | BIT_7);
150 |
151 | // data = ReadERI(0xDC, 1, ERIAR_ExGMAC);
152 | // data &= ~BIT_0;
153 | // WriteERI( ioaddr, 0xDC, 1, data, ERIAR_ExGMAC);
154 | // data |= BIT_0;
155 | // WriteERI( ioaddr, 0xDC, 1, data, ERIAR_ExGMAC);
156 |
157 | WriteMMIO32(RxConfig, rx_mode | 0x0e);
158 | WriteERI(0x2F8, 1, 0x0064, ERIAR_ExGMAC);
159 | }
160 | } else {
161 | return -EFAULT;
162 | }
163 | return 0;
164 | }
165 |
166 | int rtltool_ioctl(struct rtl8168_private *tp, struct ifreq *ifr)
167 | {
168 | struct rtltool_cmd my_cmd;
169 | unsigned long flags;
170 | int ret;
171 |
172 | if (copy_from_user(&my_cmd, ifr->ifr_data, sizeof(my_cmd)))
173 | return -EFAULT;
174 |
175 | ret = 0;
176 | switch (my_cmd.cmd) {
177 | case RTLTOOL_READ_MAC:
178 | if (!capable(CAP_NET_ADMIN))
179 | return -EPERM;
180 |
181 | if (my_cmd.len==1)
182 | my_cmd.data = readb(tp->mmio_addr+my_cmd.offset);
183 | else if (my_cmd.len==2)
184 | my_cmd.data = readw(tp->mmio_addr+(my_cmd.offset&~1));
185 | else if (my_cmd.len==4)
186 | my_cmd.data = readl(tp->mmio_addr+(my_cmd.offset&~3));
187 | else {
188 | ret = -EOPNOTSUPP;
189 | break;
190 | }
191 |
192 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
193 | ret = -EFAULT;
194 | break;
195 | }
196 | break;
197 |
198 | case RTLTOOL_WRITE_MAC:
199 | if (!capable(CAP_NET_ADMIN))
200 | return -EPERM;
201 |
202 | if (my_cmd.len==1)
203 | writeb(my_cmd.data, tp->mmio_addr+my_cmd.offset);
204 | else if (my_cmd.len==2)
205 | writew(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~1));
206 | else if (my_cmd.len==4)
207 | writel(my_cmd.data, tp->mmio_addr+(my_cmd.offset&~3));
208 | else {
209 | ret = -EOPNOTSUPP;
210 | break;
211 | }
212 |
213 | break;
214 |
215 | case RTLTOOL_READ_PHY:
216 | if (!capable(CAP_NET_ADMIN))
217 | return -EPERM;
218 |
219 | spin_lock_irqsave(&tp->phy_lock, flags);
220 | my_cmd.data = ReadGMII16( my_cmd.offset);
221 | spin_unlock_irqrestore(&tp->phy_lock, flags);
222 |
223 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
224 | ret = -EFAULT;
225 | break;
226 | }
227 |
228 | break;
229 |
230 | case RTLTOOL_WRITE_PHY:
231 | if (!capable(CAP_NET_ADMIN))
232 | return -EPERM;
233 |
234 | spin_lock_irqsave(&tp->phy_lock, flags);
235 | WriteGMII16( my_cmd.offset, my_cmd.data);
236 | spin_unlock_irqrestore(&tp->phy_lock, flags);
237 | break;
238 |
239 | case RTLTOOL_READ_EPHY:
240 | if (!capable(CAP_NET_ADMIN))
241 | return -EPERM;
242 |
243 | my_cmd.data = rtl8168_ephy_read(tp->mmio_addr, my_cmd.offset);
244 |
245 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
246 | ret = -EFAULT;
247 | break;
248 | }
249 |
250 | break;
251 |
252 | case RTLTOOL_WRITE_EPHY:
253 | if (!capable(CAP_NET_ADMIN))
254 | return -EPERM;
255 |
256 | rtl8168_ephy_write(tp->mmio_addr, my_cmd.offset, my_cmd.data);
257 | break;
258 |
259 | case RTLTOOL_READ_PCI:
260 | if (!capable(CAP_NET_ADMIN))
261 | return -EPERM;
262 |
263 | my_cmd.data = 0;
264 | if (my_cmd.len==1)
265 | pci_read_config_byte(tp->pci_dev, my_cmd.offset,
266 | (u8 *)&my_cmd.data);
267 | else if (my_cmd.len==2)
268 | pci_read_config_word(tp->pci_dev, my_cmd.offset,
269 | (u16 *)&my_cmd.data);
270 | else if (my_cmd.len==4)
271 | pci_read_config_dword(tp->pci_dev, my_cmd.offset,
272 | &my_cmd.data);
273 | else {
274 | ret = -EOPNOTSUPP;
275 | break;
276 | }
277 |
278 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
279 | ret = -EFAULT;
280 | break;
281 | }
282 | break;
283 |
284 | case RTLTOOL_WRITE_PCI:
285 | if (!capable(CAP_NET_ADMIN))
286 | return -EPERM;
287 |
288 | if (my_cmd.len==1)
289 | pci_write_config_byte(tp->pci_dev, my_cmd.offset,
290 | my_cmd.data);
291 | else if (my_cmd.len==2)
292 | pci_write_config_word(tp->pci_dev, my_cmd.offset,
293 | my_cmd.data);
294 | else if (my_cmd.len==4)
295 | pci_write_config_dword(tp->pci_dev, my_cmd.offset,
296 | my_cmd.data);
297 | else {
298 | ret = -EOPNOTSUPP;
299 | break;
300 | }
301 |
302 | break;
303 |
304 | case RTLTOOL_READ_EEPROM:
305 | if (!capable(CAP_NET_ADMIN))
306 | return -EPERM;
307 |
308 | my_cmd.data = rtl_eeprom_read_sc(tp, my_cmd.offset);
309 |
310 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
311 | ret = -EFAULT;
312 | break;
313 | }
314 |
315 | break;
316 |
317 | case RTLTOOL_WRITE_EEPROM:
318 | if (!capable(CAP_NET_ADMIN))
319 | return -EPERM;
320 |
321 | rtl_eeprom_write_sc(tp->mmio_addr, my_cmd.offset, my_cmd.data);
322 | break;
323 |
324 | case RTL_ARP_NS_OFFLOAD:
325 | break;
326 |
327 | case RTL_SET_OOB_IPMAC:
328 | ret = OOB_set_ip_mac(tp,
329 | (struct sockaddr_in *)&my_cmd.ifru_addr,
330 | my_cmd.ifru_hwaddr.sa_data);
331 | break;
332 |
333 | case RTL_READ_OOB_MAC:
334 | if (!capable(CAP_NET_ADMIN))
335 | return -EPERM;
336 |
337 | my_cmd.data = OCP_read(tp, 0xf, my_cmd.offset);
338 |
339 | if (copy_to_user(ifr->ifr_data, &my_cmd, sizeof(my_cmd))) {
340 | ret = -EFAULT;
341 | break;
342 | }
343 | break;
344 |
345 | case RTL_WRITE_OOB_MAC:
346 | if (!capable(CAP_NET_ADMIN))
347 | return -EPERM;
348 |
349 | OOB_mutex_lock(tp);
350 | if (my_cmd.len == 1)
351 | OCP_write(tp, 0x1, my_cmd.offset, my_cmd.data);
352 | else if (my_cmd.len == 2)
353 | OCP_write(tp, 0x3, my_cmd.offset, my_cmd.data);
354 | else if (my_cmd.len == 4)
355 | OCP_write(tp, 0xf, my_cmd.offset, my_cmd.data);
356 | else {
357 | ret = -EOPNOTSUPP;
358 | }
359 | OOB_mutex_unlock(tp);
360 | break;
361 |
362 | default:
363 | ret = -EOPNOTSUPP;
364 | break;
365 | }
366 |
367 | return ret;
368 | }
369 |
--------------------------------------------------------------------------------
/r8168-8.037.00/src/rtltool.h:
--------------------------------------------------------------------------------
1 | #ifndef _LINUX_RTLTOOL_H
2 | #define _LINUX_RTLTOOL_H
3 |
4 | #define SIOCRTLTOOL SIOCDEVPRIVATE+1
5 |
6 | enum rtl_cmd {
7 | RTLTOOL_READ_MAC=0,
8 | RTLTOOL_WRITE_MAC,
9 | RTLTOOL_READ_PHY,
10 | RTLTOOL_WRITE_PHY,
11 | RTLTOOL_READ_EPHY,
12 | RTLTOOL_WRITE_EPHY,
13 | RTLTOOL_READ_ERI,
14 | RTLTOOL_WRITE_ERI,
15 | RTLTOOL_READ_PCI,
16 | RTLTOOL_WRITE_PCI,
17 | RTLTOOL_READ_EEPROM,
18 | RTLTOOL_WRITE_EEPROM,
19 |
20 | RTL_ARP_NS_OFFLOAD,
21 | RTL_SET_OOB_IPMAC,
22 | RTL_READ_OOB_MAC,
23 | RTL_WRITE_OOB_MAC,
24 |
25 | RTLTOOL_INVALID
26 | };
27 |
28 | struct rtltool_cmd {
29 | __u32 cmd;
30 | __u32 offset;
31 | __u32 len;
32 | __u32 data;
33 | struct sockaddr ifru_addr;
34 | struct sockaddr ifru_netmask;
35 | struct sockaddr ifru_hwaddr;
36 | };
37 |
38 | enum mode_access {
39 | MODE_NONE=0,
40 | MODE_READ,
41 | MODE_WRITE
42 | };
43 |
44 | #ifdef __KERNEL__
45 | int rtltool_ioctl(struct rtl8168_private *tp, struct ifreq *ifr);
46 | #endif
47 |
48 | #endif /* _LINUX_RTLTOOL_H */
49 |
--------------------------------------------------------------------------------
/rtl_bsd_drv/Makefile:
--------------------------------------------------------------------------------
1 | # $FreeBSD: src/sys/modules/re/Makefile,v 1.6 2000/01/28 11:26:34 bde Exp $
2 |
3 | .PATH: ${.CURDIR}/../../dev/re
4 | KMOD = if_re
5 | SRCS = if_re.c opt_bdg.h device_if.h bus_if.h pci_if.h
6 |
7 | .include
8 |
--------------------------------------------------------------------------------
/rtl_bsd_drv/Readme.txt:
--------------------------------------------------------------------------------
1 | =================================================================================
2 | = Realtek 8169S/8169SB/8169SC/8168B/8168C/8168CP/8168D/8168E/ =
3 | = 8101E/8102E/8103E/8401E/8105E Driver =
4 | = for FreeBSD v4.x/5.x/6.x/7.x/8.x/9.x =
5 | =================================================================================
6 |
7 | This driver is modified by Realtek Semiconductor corp. and it has been tested OK
8 | on FreeBSD v5.4, FreeBSD v6.4, FreeBSD v7.3, FreeBSD v8.0, and FreeBSD v9.0. To
9 | update the driver, you may use method 1. If method 1 failed, you must use method 2
10 | which is more complex.
11 |
12 | Method 1:
13 | 1.Copy if_re.ko in "modules" directory to "/modules" directory and overwrite
14 | the existing file.
15 | 2.Modify the file "/boot/defaults/loader.conf" and set "if_re_load" in "Network
16 | drivers" section to "Yes"
17 | 3.Reboot.
18 |
19 | Method 2:
20 | Because the FreeBSD kernel has default drivers to support RTL8139C and RTL8169S. To use the RTL8139C+, RTL8169SB, RTL8169SC, RTL8168B, and RTL8101E, you need to update your NIC driver by recompiling your FreeBSD kernel.
21 |
22 | The main steps you have to do:(FreeBSDSrcDir means the directory of FreeBSD source code
23 | and it may be "/usr/src/sys")
24 |
25 | 1. keep the orginal driver source code:
26 | # cd /usr/src/sys/dev/re
27 | # cp if_re.c if_re.c.org
28 |
29 | # cd /usr/src/sys/modules
30 | # cp Makefile Makefile.org
31 |
32 | # cd /usr/src/sys/modules/re
33 | # cp Makefile Makefile.org
34 |
35 | # cd /usr/src/sys/i386/conf/
36 | # cp GENERIC GENERIC.org
37 |
38 | 2. recompile your kernel (you must install your FreeBSD source code first !!)
39 | # vim /usr/src/sys/i386/conf/GENERIC and delete re
40 | # vim /usr/src/sys/modules/Makefile and delete re
41 | # cd /usr/src/sys/i386/conf
42 | # /usr/sbin/config GENERIC
43 |
44 | (for FreeBSD 5.x/6.x/7.x/8.x/9.x)
45 | # cd ../compile/GENERIC
46 | (for FreeBSD 4.x)
47 | # cd ../../compile/GENERIC
48 |
49 | # make cleandepend
50 | # make depend
51 | # make
52 | # make install
53 | # reboot
54 |
55 | 3. update the driver source code:
56 | Copy the dirver source code( if_re.c and if_rereg.h) into /usr/src/sys/dev/re
57 | Copy the Makefile into /usr/src/sys/modules/re
58 |
59 | 4. build the driver:
60 | # cd /usr/src/sys/modules/re
61 | # make clean
62 | # make
63 |
64 | 5. install the driver
65 | # cd /usr/src/sys/modules/re
66 | # kldload ./if_re.ko
67 |
68 | 6. configurate the static IP address
69 | # ifconfig re0 xxx.xxx.xxx.xxx
70 |
71 | 7. configurate the IP address by DHCP
72 | # /sbin/dhclient re0
73 |
74 | The user can use the following command to change link speed and duplexmode.
75 | 1. For auto negotiation,
76 | #ifconfig re media autoselect
77 |
78 | 2. For 1000Mbps full-duplex,
79 | #ifconfig re media 1000baseTX mediaopt full-duplex
80 |
81 | 3. For 100Mbps full-duplex,
82 | #ifconfig re media 100baseTX mediaopt full-duplex
83 |
84 | 4. For 100Mbps half-duplex,
85 | #ifconfig re media 100baseTX -mediaopt full-duplex
86 |
87 | 5. For 10Mbps full-duplex,
88 | #ifconfig re media 10baseT/UTP mediaopt full-duplex
89 |
90 | 6. For 10Mbps half-duplex,
91 | #ifconfig re media 10baseT/UTP -mediaopt full-duplex
92 |
--------------------------------------------------------------------------------
/rtl_bsd_drv/if_re.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SergeySlice/RealtekLANv3/379ce46ded5df358714dcace6fb07efd11c6ff3e/rtl_bsd_drv/if_re.c
--------------------------------------------------------------------------------