Print this page
2038 Add in I350 and ET2 support into igb
Reviewed by: Dan McDonald <danmcd@nexenta.com>
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/io/igb/igb_api.c
+++ new/usr/src/uts/common/io/igb/igb_api.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
|
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 - * Copyright(c) 2007-2010 Intel Corporation. All rights reserved.
23 + * Copyright (c) 2007-2012 Intel Corporation. All rights reserved.
24 24 */
25 25
26 26 /*
27 27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 28 */
29 29
30 30 /* IntelVersion: 1.129.2.1 v3_3_14_3_BHSW1 */
31 31
32 32 #include "igb_api.h"
33 33
34 34 /*
35 35 * e1000_init_mac_params - Initialize MAC function pointers
36 36 * @hw: pointer to the HW structure
37 37 *
38 38 * This function initializes the function pointers for the MAC
39 39 * set of functions. Called by drivers or by e1000_setup_init_funcs.
40 40 */
41 41 s32
42 42 e1000_init_mac_params(struct e1000_hw *hw)
43 43 {
44 44 s32 ret_val = E1000_SUCCESS;
45 45
46 46 if (hw->mac.ops.init_params) {
47 47 ret_val = hw->mac.ops.init_params(hw);
48 48 if (ret_val) {
49 49 DEBUGOUT("MAC Initialization Error\n");
50 50 goto out;
51 51 }
52 52 } else {
53 53 DEBUGOUT("mac.init_mac_params was NULL\n");
54 54 ret_val = -E1000_ERR_CONFIG;
55 55 }
56 56
57 57 out:
58 58 return (ret_val);
59 59 }
60 60
61 61 /*
62 62 * e1000_init_nvm_params - Initialize NVM function pointers
63 63 * @hw: pointer to the HW structure
64 64 *
65 65 * This function initializes the function pointers for the NVM
66 66 * set of functions. Called by drivers or by e1000_setup_init_funcs.
67 67 */
68 68 s32
69 69 e1000_init_nvm_params(struct e1000_hw *hw)
70 70 {
71 71 s32 ret_val = E1000_SUCCESS;
72 72
73 73 if (hw->nvm.ops.init_params) {
74 74 ret_val = hw->nvm.ops.init_params(hw);
75 75 if (ret_val) {
76 76 DEBUGOUT("NVM Initialization Error\n");
77 77 goto out;
78 78 }
79 79 } else {
80 80 DEBUGOUT("nvm.init_nvm_params was NULL\n");
81 81 ret_val = -E1000_ERR_CONFIG;
82 82 }
83 83
84 84 out:
85 85 return (ret_val);
86 86 }
87 87
88 88 /*
89 89 * e1000_init_phy_params - Initialize PHY function pointers
90 90 * @hw: pointer to the HW structure
91 91 *
92 92 * This function initializes the function pointers for the PHY
93 93 * set of functions. Called by drivers or by e1000_setup_init_funcs.
94 94 */
95 95 s32
96 96 e1000_init_phy_params(struct e1000_hw *hw)
97 97 {
98 98 s32 ret_val = E1000_SUCCESS;
99 99
100 100 if (hw->phy.ops.init_params) {
101 101 ret_val = hw->phy.ops.init_params(hw);
102 102 if (ret_val) {
103 103 DEBUGOUT("PHY Initialization Error\n");
104 104 goto out;
105 105 }
106 106 } else {
107 107 DEBUGOUT("phy.init_phy_params was NULL\n");
108 108 ret_val = -E1000_ERR_CONFIG;
109 109 }
110 110
111 111 out:
112 112 return (ret_val);
113 113 }
114 114
115 115 /*
116 116 * e1000_set_mac_type - Sets MAC type
117 117 * @hw: pointer to the HW structure
118 118 *
119 119 * This function sets the mac type of the adapter based on the
120 120 * device ID stored in the hw structure.
121 121 * MUST BE FIRST FUNCTION CALLED (explicitly or through
122 122 * e1000_setup_init_funcs()).
123 123 */
124 124 s32
125 125 e1000_set_mac_type(struct e1000_hw *hw)
126 126 {
127 127 struct e1000_mac_info *mac = &hw->mac;
128 128 s32 ret_val = E1000_SUCCESS;
129 129
130 130 DEBUGFUNC("e1000_set_mac_type");
131 131
|
↓ open down ↓ |
98 lines elided |
↑ open up ↑ |
132 132 switch (hw->device_id) {
133 133 case E1000_DEV_ID_82575EB_COPPER:
134 134 case E1000_DEV_ID_82575EB_FIBER_SERDES:
135 135 case E1000_DEV_ID_82575GB_QUAD_COPPER:
136 136 mac->type = e1000_82575;
137 137 break;
138 138 case E1000_DEV_ID_82576:
139 139 case E1000_DEV_ID_82576_FIBER:
140 140 case E1000_DEV_ID_82576_SERDES:
141 141 case E1000_DEV_ID_82576_QUAD_COPPER:
142 + case E1000_DEV_ID_82576_QUAD_COPPER_ET2:
142 143 case E1000_DEV_ID_82576_NS:
143 144 case E1000_DEV_ID_82576_NS_SERDES:
144 145 case E1000_DEV_ID_82576_SERDES_QUAD:
145 146 mac->type = e1000_82576;
146 147 break;
147 148 case E1000_DEV_ID_82580_COPPER:
148 149 case E1000_DEV_ID_82580_FIBER:
149 150 case E1000_DEV_ID_82580_SERDES:
150 151 case E1000_DEV_ID_82580_SGMII:
151 152 case E1000_DEV_ID_82580_COPPER_DUAL:
152 153 mac->type = e1000_82580;
153 154 break;
155 + case E1000_DEV_ID_I350_COPPER:
156 + mac->type = e1000_i350;
157 + break;
154 158 default:
155 159 /* Should never have loaded on this device */
156 160 ret_val = -E1000_ERR_MAC_INIT;
157 161 break;
158 162 }
159 163
160 164 return (ret_val);
161 165 }
162 166
163 167 /*
164 168 * e1000_setup_init_funcs - Initializes function pointers
165 169 * @hw: pointer to the HW structure
166 170 * @init_device: true will initialize the rest of the function pointers
167 171 * getting the device ready for use. false will only set
168 172 * MAC type and the function pointers for the other init
169 173 * functions. Passing false will not generate any hardware
170 174 * reads or writes.
171 175 *
172 176 * This function must be called by a driver in order to use the rest
173 177 * of the 'shared' code files. Called by drivers only.
174 178 */
175 179 s32
176 180 e1000_setup_init_funcs(struct e1000_hw *hw, bool init_device)
177 181 {
178 182 s32 ret_val;
179 183
180 184 /* Can't do much good without knowing the MAC type. */
181 185 ret_val = e1000_set_mac_type(hw);
182 186 if (ret_val) {
183 187 DEBUGOUT("ERROR: MAC type could not be set properly.\n");
184 188 goto out;
185 189 }
186 190
187 191 if (!hw->hw_addr) {
188 192 DEBUGOUT("ERROR: Registers not mapped\n");
189 193 ret_val = -E1000_ERR_CONFIG;
190 194 goto out;
191 195 }
192 196
193 197 /*
194 198 * Init function pointers to generic implementations. We do this first
195 199 * allowing a driver module to override it afterward.
196 200 */
197 201 e1000_init_mac_ops_generic(hw);
198 202 e1000_init_phy_ops_generic(hw);
199 203 e1000_init_nvm_ops_generic(hw);
|
↓ open down ↓ |
36 lines elided |
↑ open up ↑ |
200 204
201 205 /*
202 206 * Set up the init function pointers. These are functions within the
203 207 * adapter family file that sets up function pointers for the rest of
204 208 * the functions in that family.
205 209 */
206 210 switch (hw->mac.type) {
207 211 case e1000_82575:
208 212 case e1000_82576:
209 213 case e1000_82580:
214 + case e1000_i350:
210 215 e1000_init_function_pointers_82575(hw);
211 216 break;
212 217 default:
213 218 DEBUGOUT("Hardware not supported\n");
214 219 ret_val = -E1000_ERR_CONFIG;
215 220 break;
216 221 }
217 222
218 223 /*
219 224 * Initialize the rest of the function pointers. These require some
220 225 * register reads/writes in some cases.
221 226 */
222 227 if (!(ret_val) && init_device) {
223 228 ret_val = e1000_init_mac_params(hw);
224 229 if (ret_val)
225 230 goto out;
226 231
227 232 ret_val = e1000_init_nvm_params(hw);
228 233 if (ret_val)
229 234 goto out;
230 235
231 236 ret_val = e1000_init_phy_params(hw);
232 237 if (ret_val)
233 238 goto out;
234 239
235 240 }
236 241
237 242 out:
238 243 return (ret_val);
239 244 }
240 245
241 246 /*
242 247 * e1000_get_bus_info - Obtain bus information for adapter
243 248 * @hw: pointer to the HW structure
244 249 *
245 250 * This will obtain information about the HW bus for which the
246 251 * adapter is attached and stores it in the hw structure. This is a
247 252 * function pointer entry point called by drivers.
248 253 */
249 254 s32
250 255 e1000_get_bus_info(struct e1000_hw *hw)
251 256 {
252 257 if (hw->mac.ops.get_bus_info)
253 258 return (hw->mac.ops.get_bus_info(hw));
254 259
255 260 return (E1000_SUCCESS);
256 261 }
257 262
258 263 /*
259 264 * e1000_clear_vfta - Clear VLAN filter table
260 265 * @hw: pointer to the HW structure
261 266 *
262 267 * This clears the VLAN filter table on the adapter. This is a function
263 268 * pointer entry point called by drivers.
264 269 */
265 270 void
266 271 e1000_clear_vfta(struct e1000_hw *hw)
267 272 {
268 273 if (hw->mac.ops.clear_vfta)
269 274 hw->mac.ops.clear_vfta(hw);
270 275 }
271 276
272 277 /*
273 278 * e1000_write_vfta - Write value to VLAN filter table
274 279 * @hw: pointer to the HW structure
275 280 * @offset: the 32-bit offset in which to write the value to.
276 281 * @value: the 32-bit value to write at location offset.
277 282 *
278 283 * This writes a 32-bit value to a 32-bit offset in the VLAN filter
279 284 * table. This is a function pointer entry point called by drivers.
280 285 */
281 286 void
282 287 e1000_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
283 288 {
284 289 if (hw->mac.ops.write_vfta)
285 290 hw->mac.ops.write_vfta(hw, offset, value);
286 291 }
287 292
288 293 /*
289 294 * e1000_update_mc_addr_list - Update Multicast addresses
290 295 * @hw: pointer to the HW structure
291 296 * @mc_addr_list: array of multicast addresses to program
292 297 * @mc_addr_count: number of multicast addresses to program
293 298 *
294 299 * Updates the Multicast Table Array.
295 300 * The caller must have a packed mc_addr_list of multicast addresses.
296 301 */
297 302 void
298 303 e1000_update_mc_addr_list(struct e1000_hw *hw, u8 *mc_addr_list,
299 304 u32 mc_addr_count)
300 305 {
301 306 if (hw->mac.ops.update_mc_addr_list)
302 307 hw->mac.ops.update_mc_addr_list(hw,
303 308 mc_addr_list, mc_addr_count);
304 309 }
305 310
306 311 /*
307 312 * e1000_force_mac_fc - Force MAC flow control
308 313 * @hw: pointer to the HW structure
309 314 *
310 315 * Force the MAC's flow control settings. Currently no func pointer exists
311 316 * and all implementations are handled in the generic version of this
312 317 * function.
313 318 */
314 319 s32
315 320 e1000_force_mac_fc(struct e1000_hw *hw)
316 321 {
317 322 return (e1000_force_mac_fc_generic(hw));
318 323 }
319 324
320 325 /*
321 326 * e1000_check_for_link - Check/Store link connection
322 327 * @hw: pointer to the HW structure
323 328 *
324 329 * This checks the link condition of the adapter and stores the
325 330 * results in the hw->mac structure. This is a function pointer entry
326 331 * point called by drivers.
327 332 */
328 333 s32
329 334 e1000_check_for_link(struct e1000_hw *hw)
330 335 {
331 336 if (hw->mac.ops.check_for_link)
332 337 return (hw->mac.ops.check_for_link(hw));
333 338
334 339 return (-E1000_ERR_CONFIG);
335 340 }
336 341
337 342 /*
338 343 * e1000_check_mng_mode - Check management mode
339 344 * @hw: pointer to the HW structure
340 345 *
341 346 * This checks if the adapter has manageability enabled.
342 347 * This is a function pointer entry point called by drivers.
343 348 */
344 349 bool
345 350 e1000_check_mng_mode(struct e1000_hw *hw)
346 351 {
347 352 if (hw->mac.ops.check_mng_mode)
348 353 return (hw->mac.ops.check_mng_mode(hw));
349 354
350 355 return (false);
351 356 }
352 357
353 358 /*
354 359 * e1000_mng_write_dhcp_info - Writes DHCP info to host interface
355 360 * @hw: pointer to the HW structure
356 361 * @buffer: pointer to the host interface
357 362 * @length: size of the buffer
358 363 *
359 364 * Writes the DHCP information to the host interface.
360 365 */
361 366 s32
362 367 e1000_mng_write_dhcp_info(struct e1000_hw *hw, u8 *buffer, u16 length)
363 368 {
364 369 return (e1000_mng_write_dhcp_info_generic(hw, buffer, length));
365 370 }
366 371
367 372 /*
368 373 * e1000_reset_hw - Reset hardware
369 374 * @hw: pointer to the HW structure
370 375 *
371 376 * This resets the hardware into a known state. This is a function pointer
372 377 * entry point called by drivers.
373 378 */
374 379 s32
375 380 e1000_reset_hw(struct e1000_hw *hw)
376 381 {
377 382 if (hw->mac.ops.reset_hw)
378 383 return (hw->mac.ops.reset_hw(hw));
379 384
380 385 return (-E1000_ERR_CONFIG);
381 386 }
382 387
383 388 /*
384 389 * e1000_init_hw - Initialize hardware
385 390 * @hw: pointer to the HW structure
386 391 *
387 392 * This inits the hardware readying it for operation. This is a function
388 393 * pointer entry point called by drivers.
389 394 */
390 395 s32
391 396 e1000_init_hw(struct e1000_hw *hw)
392 397 {
393 398 if (hw->mac.ops.init_hw)
394 399 return (hw->mac.ops.init_hw(hw));
395 400
396 401 return (-E1000_ERR_CONFIG);
397 402 }
398 403
399 404 /*
400 405 * e1000_setup_link - Configures link and flow control
401 406 * @hw: pointer to the HW structure
402 407 *
403 408 * This configures link and flow control settings for the adapter. This
404 409 * is a function pointer entry point called by drivers. While modules can
405 410 * also call this, they probably call their own version of this function.
406 411 */
407 412 s32
408 413 e1000_setup_link(struct e1000_hw *hw)
409 414 {
410 415 if (hw->mac.ops.setup_link)
411 416 return (hw->mac.ops.setup_link(hw));
412 417
413 418 return (-E1000_ERR_CONFIG);
414 419 }
415 420
416 421 /*
417 422 * e1000_get_speed_and_duplex - Returns current speed and duplex
418 423 * @hw: pointer to the HW structure
419 424 * @speed: pointer to a 16-bit value to store the speed
420 425 * @duplex: pointer to a 16-bit value to store the duplex.
421 426 *
422 427 * This returns the speed and duplex of the adapter in the two 'out'
423 428 * variables passed in. This is a function pointer entry point called
424 429 * by drivers.
425 430 */
426 431 s32
427 432 e1000_get_speed_and_duplex(struct e1000_hw *hw, u16 *speed, u16 *duplex)
428 433 {
429 434 if (hw->mac.ops.get_link_up_info)
430 435 return (hw->mac.ops.get_link_up_info(hw, speed, duplex));
431 436
432 437 return (-E1000_ERR_CONFIG);
433 438 }
434 439
435 440 /*
436 441 * e1000_setup_led - Configures SW controllable LED
437 442 * @hw: pointer to the HW structure
438 443 *
439 444 * This prepares the SW controllable LED for use and saves the current state
440 445 * of the LED so it can be later restored. This is a function pointer entry
441 446 * point called by drivers.
442 447 */
443 448 s32
444 449 e1000_setup_led(struct e1000_hw *hw)
445 450 {
446 451 if (hw->mac.ops.setup_led)
447 452 return (hw->mac.ops.setup_led(hw));
448 453
449 454 return (E1000_SUCCESS);
450 455 }
451 456
452 457 /*
453 458 * e1000_cleanup_led - Restores SW controllable LED
454 459 * @hw: pointer to the HW structure
455 460 *
456 461 * This restores the SW controllable LED to the value saved off by
457 462 * e1000_setup_led. This is a function pointer entry point called by drivers.
458 463 */
459 464 s32
460 465 e1000_cleanup_led(struct e1000_hw *hw)
461 466 {
462 467 if (hw->mac.ops.cleanup_led)
463 468 return (hw->mac.ops.cleanup_led(hw));
464 469
465 470 return (E1000_SUCCESS);
466 471 }
467 472
468 473 /*
469 474 * e1000_blink_led - Blink SW controllable LED
470 475 * @hw: pointer to the HW structure
471 476 *
472 477 * This starts the adapter LED blinking. Request the LED to be setup first
473 478 * and cleaned up after. This is a function pointer entry point called by
474 479 * drivers.
475 480 */
476 481 s32
477 482 e1000_blink_led(struct e1000_hw *hw)
478 483 {
479 484 if (hw->mac.ops.blink_led)
480 485 return (hw->mac.ops.blink_led(hw));
481 486
482 487 return (E1000_SUCCESS);
483 488 }
484 489
485 490 /*
486 491 * e1000_id_led_init - store LED configurations in SW
487 492 * @hw: pointer to the HW structure
488 493 *
489 494 * Initializes the LED config in SW. This is a function pointer entry point
490 495 * called by drivers.
491 496 */
492 497 s32
493 498 e1000_id_led_init(struct e1000_hw *hw)
494 499 {
495 500 if (hw->mac.ops.id_led_init)
496 501 return (hw->mac.ops.id_led_init(hw));
497 502
498 503 return (E1000_SUCCESS);
499 504 }
500 505
501 506 /*
502 507 * e1000_led_on - Turn on SW controllable LED
503 508 * @hw: pointer to the HW structure
504 509 *
505 510 * Turns the SW defined LED on. This is a function pointer entry point
506 511 * called by drivers.
507 512 */
508 513 s32
509 514 e1000_led_on(struct e1000_hw *hw)
510 515 {
511 516 if (hw->mac.ops.led_on)
512 517 return (hw->mac.ops.led_on(hw));
513 518
514 519 return (E1000_SUCCESS);
515 520 }
516 521
517 522 /*
518 523 * e1000_led_off - Turn off SW controllable LED
519 524 * @hw: pointer to the HW structure
520 525 *
521 526 * Turns the SW defined LED off. This is a function pointer entry point
522 527 * called by drivers.
523 528 */
524 529 s32
525 530 e1000_led_off(struct e1000_hw *hw)
526 531 {
527 532 if (hw->mac.ops.led_off)
528 533 return (hw->mac.ops.led_off(hw));
529 534
530 535 return (E1000_SUCCESS);
531 536 }
532 537
533 538 /*
534 539 * e1000_reset_adaptive - Reset adaptive IFS
535 540 * @hw: pointer to the HW structure
536 541 *
537 542 * Resets the adaptive IFS. Currently no func pointer exists and all
538 543 * implementations are handled in the generic version of this function.
539 544 */
540 545 void
541 546 e1000_reset_adaptive(struct e1000_hw *hw)
542 547 {
543 548 e1000_reset_adaptive_generic(hw);
544 549 }
545 550
546 551 /*
547 552 * e1000_update_adaptive - Update adaptive IFS
548 553 * @hw: pointer to the HW structure
549 554 *
550 555 * Updates adapter IFS. Currently no func pointer exists and all
551 556 * implementations are handled in the generic version of this function.
552 557 */
553 558 void
554 559 e1000_update_adaptive(struct e1000_hw *hw)
555 560 {
556 561 e1000_update_adaptive_generic(hw);
557 562 }
558 563
559 564 /*
560 565 * e1000_disable_pcie_master - Disable PCI-Express master access
561 566 * @hw: pointer to the HW structure
562 567 *
563 568 * Disables PCI-Express master access and verifies there are no pending
564 569 * requests. Currently no func pointer exists and all implementations are
565 570 * handled in the generic version of this function.
566 571 */
567 572 s32
568 573 e1000_disable_pcie_master(struct e1000_hw *hw)
569 574 {
570 575 return (e1000_disable_pcie_master_generic(hw));
571 576 }
572 577
573 578 /*
574 579 * e1000_config_collision_dist - Configure collision distance
575 580 * @hw: pointer to the HW structure
576 581 *
577 582 * Configures the collision distance to the default value and is used
578 583 * during link setup.
579 584 */
580 585 void
581 586 e1000_config_collision_dist(struct e1000_hw *hw)
582 587 {
583 588 if (hw->mac.ops.config_collision_dist)
584 589 hw->mac.ops.config_collision_dist(hw);
585 590 }
586 591
587 592 /*
588 593 * e1000_rar_set - Sets a receive address register
589 594 * @hw: pointer to the HW structure
590 595 * @addr: address to set the RAR to
591 596 * @index: the RAR to set
592 597 *
593 598 * Sets a Receive Address Register (RAR) to the specified address.
594 599 */
595 600 void
596 601 e1000_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
597 602 {
598 603 if (hw->mac.ops.rar_set)
599 604 hw->mac.ops.rar_set(hw, addr, index);
600 605 }
601 606
602 607 /*
603 608 * e1000_validate_mdi_setting - Ensures valid MDI/MDIX SW state
604 609 * @hw: pointer to the HW structure
605 610 *
606 611 * Ensures that the MDI/MDIX SW state is valid.
607 612 */
608 613 s32
609 614 e1000_validate_mdi_setting(struct e1000_hw *hw)
610 615 {
611 616 if (hw->mac.ops.validate_mdi_setting)
612 617 return (hw->mac.ops.validate_mdi_setting(hw));
613 618
614 619 return (E1000_SUCCESS);
615 620 }
616 621
617 622 /*
618 623 * e1000_mta_set - Sets multicast table bit
619 624 * @hw: pointer to the HW structure
620 625 * @hash_value: Multicast hash value.
621 626 *
622 627 * This sets the bit in the multicast table corresponding to the
623 628 * hash value. This is a function pointer entry point called by drivers.
624 629 */
625 630 void
626 631 e1000_mta_set(struct e1000_hw *hw, u32 hash_value)
627 632 {
628 633 if (hw->mac.ops.mta_set)
629 634 hw->mac.ops.mta_set(hw, hash_value);
630 635 }
631 636
632 637 /*
633 638 * e1000_hash_mc_addr - Determines address location in multicast table
634 639 * @hw: pointer to the HW structure
635 640 * @mc_addr: Multicast address to hash.
636 641 *
637 642 * This hashes an address to determine its location in the multicast
638 643 * table. Currently no func pointer exists and all implementations
639 644 * are handled in the generic version of this function.
640 645 */
641 646 u32
642 647 e1000_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr)
643 648 {
644 649 return (e1000_hash_mc_addr_generic(hw, mc_addr));
645 650 }
646 651
647 652 /*
648 653 * e1000_enable_tx_pkt_filtering - Enable packet filtering on TX
649 654 * @hw: pointer to the HW structure
650 655 *
651 656 * Enables packet filtering on transmit packets if manageability is enabled
652 657 * and host interface is enabled.
653 658 * Currently no func pointer exists and all implementations are handled in the
654 659 * generic version of this function.
655 660 */
656 661 bool
657 662 e1000_enable_tx_pkt_filtering(struct e1000_hw *hw)
658 663 {
659 664 return (e1000_enable_tx_pkt_filtering_generic(hw));
660 665 }
661 666
662 667 /*
663 668 * e1000_mng_host_if_write - Writes to the manageability host interface
664 669 * @hw: pointer to the HW structure
665 670 * @buffer: pointer to the host interface buffer
666 671 * @length: size of the buffer
667 672 * @offset: location in the buffer to write to
668 673 * @sum: sum of the data (not checksum)
669 674 *
670 675 * This function writes the buffer content at the offset given on the host if.
671 676 * It also does alignment considerations to do the writes in most efficient
672 677 * way. Also fills up the sum of the buffer in *buffer parameter.
673 678 */
674 679 s32
675 680 e1000_mng_host_if_write(struct e1000_hw *hw, u8 *buffer, u16 length,
676 681 u16 offset, u8 *sum)
677 682 {
678 683 if (hw->mac.ops.mng_host_if_write)
679 684 return (hw->mac.ops.mng_host_if_write(hw, buffer, length,
680 685 offset, sum));
681 686
682 687 return (E1000_NOT_IMPLEMENTED);
683 688 }
684 689
685 690 /*
686 691 * e1000_mng_write_cmd_header - Writes manageability command header
687 692 * @hw: pointer to the HW structure
688 693 * @hdr: pointer to the host interface command header
689 694 *
690 695 * Writes the command header after does the checksum calculation.
691 696 */
692 697 s32
693 698 e1000_mng_write_cmd_header(struct e1000_hw *hw,
694 699 struct e1000_host_mng_command_header *hdr)
695 700 {
696 701 if (hw->mac.ops.mng_write_cmd_header)
697 702 return (hw->mac.ops.mng_write_cmd_header(hw, hdr));
698 703
699 704 return (E1000_NOT_IMPLEMENTED);
700 705 }
701 706
702 707 /*
703 708 * e1000_mng_enable_host_if - Checks host interface is enabled
704 709 * @hw: pointer to the HW structure
705 710 *
706 711 * Returns E1000_success upon success, else E1000_ERR_HOST_INTERFACE_COMMAND
707 712 *
708 713 * This function checks whether the HOST IF is enabled for command operation
709 714 * and also checks whether the previous command is completed. It busy waits
710 715 * in case of previous command is not completed.
711 716 */
712 717 s32
713 718 e1000_mng_enable_host_if(struct e1000_hw *hw)
714 719 {
715 720 if (hw->mac.ops.mng_enable_host_if)
716 721 return (hw->mac.ops.mng_enable_host_if(hw));
717 722
718 723 return (E1000_NOT_IMPLEMENTED);
719 724 }
720 725
721 726 /*
722 727 * e1000_wait_autoneg - Waits for autonegotiation completion
723 728 * @hw: pointer to the HW structure
724 729 *
725 730 * Waits for autoneg to complete. Currently no func pointer exists and all
726 731 * implementations are handled in the generic version of this function.
727 732 */
728 733 s32
729 734 e1000_wait_autoneg(struct e1000_hw *hw)
730 735 {
731 736 if (hw->mac.ops.wait_autoneg)
732 737 return (hw->mac.ops.wait_autoneg(hw));
733 738
734 739 return (E1000_SUCCESS);
735 740 }
736 741
737 742 /*
738 743 * e1000_check_reset_block - Verifies PHY can be reset
739 744 * @hw: pointer to the HW structure
740 745 *
741 746 * Checks if the PHY is in a state that can be reset or if manageability
742 747 * has it tied up. This is a function pointer entry point called by drivers.
743 748 */
744 749 s32
745 750 e1000_check_reset_block(struct e1000_hw *hw)
746 751 {
747 752 if (hw->phy.ops.check_reset_block)
748 753 return (hw->phy.ops.check_reset_block(hw));
749 754
750 755 return (E1000_SUCCESS);
751 756 }
752 757
753 758 /*
754 759 * e1000_read_phy_reg - Reads PHY register
755 760 * @hw: pointer to the HW structure
756 761 * @offset: the register to read
757 762 * @data: the buffer to store the 16-bit read.
758 763 *
759 764 * Reads the PHY register and returns the value in data.
760 765 * This is a function pointer entry point called by drivers.
761 766 */
762 767 s32
763 768 e1000_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
764 769 {
765 770 if (hw->phy.ops.read_reg)
766 771 return (hw->phy.ops.read_reg(hw, offset, data));
767 772
768 773 return (E1000_SUCCESS);
769 774 }
770 775
771 776 /*
772 777 * e1000_write_phy_reg - Writes PHY register
773 778 * @hw: pointer to the HW structure
774 779 * @offset: the register to write
775 780 * @data: the value to write.
776 781 *
777 782 * Writes the PHY register at offset with the value in data.
778 783 * This is a function pointer entry point called by drivers.
779 784 */
780 785 s32
781 786 e1000_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
782 787 {
783 788 if (hw->phy.ops.write_reg)
784 789 return (hw->phy.ops.write_reg(hw, offset, data));
785 790
786 791 return (E1000_SUCCESS);
787 792 }
788 793
789 794 /*
790 795 * e1000_release_phy - Generic release PHY
791 796 * @hw: pointer to the HW structure
792 797 *
793 798 * Return if silicon family does not require a semaphore when accessing the
794 799 * PHY.
795 800 */
796 801 void
797 802 e1000_release_phy(struct e1000_hw *hw)
798 803 {
799 804 if (hw->phy.ops.release)
800 805 hw->phy.ops.release(hw);
801 806 }
802 807
803 808 /*
804 809 * e1000_acquire_phy - Generic acquire PHY
805 810 * @hw: pointer to the HW structure
806 811 *
807 812 * Return success if silicon family does not require a semaphore when
808 813 * accessing the PHY.
809 814 */
810 815 s32
811 816 e1000_acquire_phy(struct e1000_hw *hw)
812 817 {
813 818 if (hw->phy.ops.acquire)
814 819 return (hw->phy.ops.acquire(hw));
815 820
816 821 return (E1000_SUCCESS);
817 822 }
818 823
819 824 /*
820 825 * e1000_read_kmrn_reg - Reads register using Kumeran interface
821 826 * @hw: pointer to the HW structure
822 827 * @offset: the register to read
823 828 * @data: the location to store the 16-bit value read.
824 829 *
825 830 * Reads a register out of the Kumeran interface. Currently no func pointer
826 831 * exists and all implementations are handled in the generic version of
827 832 * this function.
828 833 */
829 834 s32
830 835 e1000_read_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 *data)
831 836 {
832 837 return (e1000_read_kmrn_reg_generic(hw, offset, data));
833 838 }
834 839
835 840 /*
836 841 * e1000_write_kmrn_reg - Writes register using Kumeran interface
837 842 * @hw: pointer to the HW structure
838 843 * @offset: the register to write
839 844 * @data: the value to write.
840 845 *
841 846 * Writes a register to the Kumeran interface. Currently no func pointer
842 847 * exists and all implementations are handled in the generic version of
843 848 * this function.
844 849 */
845 850 s32
846 851 e1000_write_kmrn_reg(struct e1000_hw *hw, u32 offset, u16 data)
847 852 {
848 853 return (e1000_write_kmrn_reg_generic(hw, offset, data));
849 854 }
850 855
851 856 /*
852 857 * e1000_get_cable_length - Retrieves cable length estimation
853 858 * @hw: pointer to the HW structure
854 859 *
855 860 * This function estimates the cable length and stores them in
856 861 * hw->phy.min_length and hw->phy.max_length. This is a function pointer
857 862 * entry point called by drivers.
858 863 */
859 864 s32
860 865 e1000_get_cable_length(struct e1000_hw *hw)
861 866 {
862 867 if (hw->phy.ops.get_cable_length)
863 868 return (hw->phy.ops.get_cable_length(hw));
864 869
865 870 return (E1000_SUCCESS);
866 871 }
867 872
868 873 /*
869 874 * e1000_get_phy_info - Retrieves PHY information from registers
870 875 * @hw: pointer to the HW structure
871 876 *
872 877 * This function gets some information from various PHY registers and
873 878 * populates hw->phy values with it. This is a function pointer entry
874 879 * point called by drivers.
875 880 */
876 881 s32
877 882 e1000_get_phy_info(struct e1000_hw *hw)
878 883 {
879 884 if (hw->phy.ops.get_info)
880 885 return (hw->phy.ops.get_info(hw));
881 886
882 887 return (E1000_SUCCESS);
883 888 }
884 889
885 890 /*
886 891 * e1000_phy_hw_reset - Hard PHY reset
887 892 * @hw: pointer to the HW structure
888 893 *
889 894 * Performs a hard PHY reset. This is a function pointer entry point called
890 895 * by drivers.
891 896 */
892 897 s32
893 898 e1000_phy_hw_reset(struct e1000_hw *hw)
894 899 {
895 900 if (hw->phy.ops.reset)
896 901 return (hw->phy.ops.reset(hw));
897 902
898 903 return (E1000_SUCCESS);
899 904 }
900 905
901 906 /*
902 907 * e1000_phy_commit - Soft PHY reset
903 908 * @hw: pointer to the HW structure
904 909 *
905 910 * Performs a soft PHY reset on those that apply. This is a function pointer
906 911 * entry point called by drivers.
907 912 */
908 913 s32
909 914 e1000_phy_commit(struct e1000_hw *hw)
910 915 {
911 916 if (hw->phy.ops.commit)
912 917 return (hw->phy.ops.commit(hw));
913 918
914 919 return (E1000_SUCCESS);
915 920 }
916 921
917 922 /*
918 923 * e1000_set_d0_lplu_state - Sets low power link up state for D0
919 924 * @hw: pointer to the HW structure
920 925 * @active: boolean used to enable/disable lplu
921 926 *
922 927 * Success returns 0, Failure returns 1
923 928 *
924 929 * The low power link up (lplu) state is set to the power management level D0
925 930 * and SmartSpeed is disabled when active is true, else clear lplu for D0
926 931 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
927 932 * is used during Dx states where the power conservation is most important.
928 933 * During driver activity, SmartSpeed should be enabled so performance is
929 934 * maintained. This is a function pointer entry point called by drivers.
930 935 */
931 936 s32
932 937 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
933 938 {
934 939 if (hw->phy.ops.set_d0_lplu_state)
935 940 return (hw->phy.ops.set_d0_lplu_state(hw, active));
936 941
937 942 return (E1000_SUCCESS);
938 943 }
939 944
940 945 /*
941 946 * e1000_set_d3_lplu_state - Sets low power link up state for D3
942 947 * @hw: pointer to the HW structure
943 948 * @active: boolean used to enable/disable lplu
944 949 *
945 950 * Success returns 0, Failure returns 1
946 951 *
947 952 * The low power link up (lplu) state is set to the power management level D3
948 953 * and SmartSpeed is disabled when active is true, else clear lplu for D3
949 954 * and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU
950 955 * is used during Dx states where the power conservation is most important.
951 956 * During driver activity, SmartSpeed should be enabled so performance is
952 957 * maintained. This is a function pointer entry point called by drivers.
953 958 */
954 959 s32
955 960 e1000_set_d3_lplu_state(struct e1000_hw *hw, bool active)
956 961 {
957 962 if (hw->phy.ops.set_d3_lplu_state)
958 963 return (hw->phy.ops.set_d3_lplu_state(hw, active));
959 964
960 965 return (E1000_SUCCESS);
961 966 }
962 967
963 968 /*
964 969 * e1000_read_mac_addr - Reads MAC address
965 970 * @hw: pointer to the HW structure
966 971 *
967 972 * Reads the MAC address out of the adapter and stores it in the HW structure.
968 973 * Currently no func pointer exists and all implementations are handled in the
969 974 * generic version of this function.
970 975 */
971 976 s32
972 977 e1000_read_mac_addr(struct e1000_hw *hw)
973 978 {
974 979 if (hw->mac.ops.read_mac_addr)
975 980 return (hw->mac.ops.read_mac_addr(hw));
976 981
977 982 return (e1000_read_mac_addr_generic(hw));
978 983 }
979 984
980 985 /*
981 986 * e1000_read_pba_num - Read device part number
982 987 * @hw: pointer to the HW structure
983 988 * @pba_num: pointer to device part number
984 989 *
985 990 * Reads the product board assembly (PBA) number from the EEPROM and stores
986 991 * the value in pba_num.
987 992 * Currently no func pointer exists and all implementations are handled in the
988 993 * generic version of this function.
989 994 */
990 995 s32
991 996 e1000_read_pba_num(struct e1000_hw *hw, u32 *pba_num)
992 997 {
993 998 return (e1000_read_pba_num_generic(hw, pba_num));
994 999 }
995 1000
996 1001 /*
997 1002 * e1000_validate_nvm_checksum - Verifies NVM (EEPROM) checksum
998 1003 * @hw: pointer to the HW structure
999 1004 *
1000 1005 * Validates the NVM checksum is correct. This is a function pointer entry
1001 1006 * point called by drivers.
1002 1007 */
1003 1008 s32
1004 1009 e1000_validate_nvm_checksum(struct e1000_hw *hw)
1005 1010 {
1006 1011 if (hw->nvm.ops.validate)
1007 1012 return (hw->nvm.ops.validate(hw));
1008 1013
1009 1014 return (-E1000_ERR_CONFIG);
1010 1015 }
1011 1016
1012 1017 /*
1013 1018 * e1000_update_nvm_checksum - Updates NVM (EEPROM) checksum
1014 1019 * @hw: pointer to the HW structure
1015 1020 *
1016 1021 * Updates the NVM checksum. Currently no func pointer exists and all
1017 1022 * implementations are handled in the generic version of this function.
1018 1023 */
1019 1024 s32
1020 1025 e1000_update_nvm_checksum(struct e1000_hw *hw)
1021 1026 {
1022 1027 if (hw->nvm.ops.update)
1023 1028 return (hw->nvm.ops.update(hw));
1024 1029
1025 1030 return (-E1000_ERR_CONFIG);
1026 1031 }
1027 1032
1028 1033 /*
1029 1034 * e1000_reload_nvm - Reloads EEPROM
1030 1035 * @hw: pointer to the HW structure
1031 1036 *
1032 1037 * Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the
1033 1038 * extended control register.
1034 1039 */
1035 1040 void
1036 1041 e1000_reload_nvm(struct e1000_hw *hw)
1037 1042 {
1038 1043 if (hw->nvm.ops.reload)
1039 1044 hw->nvm.ops.reload(hw);
1040 1045 }
1041 1046
1042 1047 /*
1043 1048 * e1000_read_nvm - Reads NVM (EEPROM)
1044 1049 * @hw: pointer to the HW structure
1045 1050 * @offset: the word offset to read
1046 1051 * @words: number of 16-bit words to read
1047 1052 * @data: pointer to the properly sized buffer for the data.
1048 1053 *
1049 1054 * Reads 16-bit chunks of data from the NVM (EEPROM). This is a function
1050 1055 * pointer entry point called by drivers.
1051 1056 */
1052 1057 s32
1053 1058 e1000_read_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1054 1059 {
1055 1060 if (hw->nvm.ops.read)
1056 1061 return (hw->nvm.ops.read(hw, offset, words, data));
1057 1062
1058 1063 return (-E1000_ERR_CONFIG);
1059 1064 }
1060 1065
1061 1066 /*
1062 1067 * e1000_write_nvm - Writes to NVM (EEPROM)
1063 1068 * @hw: pointer to the HW structure
1064 1069 * @offset: the word offset to read
1065 1070 * @words: number of 16-bit words to write
1066 1071 * @data: pointer to the properly sized buffer for the data.
1067 1072 *
1068 1073 * Writes 16-bit chunks of data to the NVM (EEPROM). This is a function
1069 1074 * pointer entry point called by drivers.
1070 1075 */
1071 1076 s32
1072 1077 e1000_write_nvm(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
1073 1078 {
1074 1079 if (hw->nvm.ops.write)
1075 1080 return (hw->nvm.ops.write(hw, offset, words, data));
1076 1081
1077 1082 return (E1000_SUCCESS);
1078 1083 }
1079 1084
1080 1085 /*
1081 1086 * e1000_write_8bit_ctrl_reg - Writes 8bit Control register
1082 1087 * @hw: pointer to the HW structure
1083 1088 * @reg: 32bit register offset
1084 1089 * @offset: the register to write
1085 1090 * @data: the value to write.
1086 1091 *
1087 1092 * Writes the PHY register at offset with the value in data.
1088 1093 * This is a function pointer entry point called by drivers.
1089 1094 */
1090 1095 s32
1091 1096 e1000_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg, u32 offset, u8 data)
1092 1097 {
1093 1098 return (e1000_write_8bit_ctrl_reg_generic(hw, reg, offset, data));
1094 1099 }
1095 1100
1096 1101 /*
1097 1102 * e1000_power_up_phy - Restores link in case of PHY power down
1098 1103 * @hw: pointer to the HW structure
1099 1104 *
1100 1105 * The phy may be powered down to save power, to turn off link when the
1101 1106 * driver is unloaded, or wake on lan is not enabled (among others).
1102 1107 */
1103 1108 void
1104 1109 e1000_power_up_phy(struct e1000_hw *hw)
1105 1110 {
1106 1111 if (hw->phy.ops.power_up)
1107 1112 hw->phy.ops.power_up(hw);
1108 1113
1109 1114 (void) e1000_setup_link(hw);
1110 1115 }
1111 1116
1112 1117 /*
1113 1118 * e1000_power_down_phy - Power down PHY
1114 1119 * @hw: pointer to the HW structure
1115 1120 *
1116 1121 * The phy may be powered down to save power, to turn off link when the
1117 1122 * driver is unloaded, or wake on lan is not enabled (among others).
1118 1123 */
1119 1124 void
1120 1125 e1000_power_down_phy(struct e1000_hw *hw)
1121 1126 {
1122 1127 if (hw->phy.ops.power_down)
1123 1128 hw->phy.ops.power_down(hw);
1124 1129 }
1125 1130
1126 1131 /*
1127 1132 * e1000_shutdown_fiber_serdes_link - Remove link during power down
1128 1133 * @hw: pointer to the HW structure
1129 1134 *
1130 1135 * Shutdown the optics and PCS on driver unload.
1131 1136 */
1132 1137 void
1133 1138 e1000_shutdown_fiber_serdes_link(struct e1000_hw *hw)
1134 1139 {
1135 1140 if (hw->mac.ops.shutdown_serdes)
1136 1141 hw->mac.ops.shutdown_serdes(hw);
1137 1142 }
|
↓ open down ↓ |
918 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX