Selaa lähdekoodia

[realtek] Use read-modify-write to check for C+ Command register

Some bits in the C+ Command register are always one.  Testing for the
presence of the register must allow for this.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 11 vuotta sitten
vanhempi
commit
0e61beb26f
1 muutettua tiedostoa jossa 4 lisäystä ja 3 poistoa
  1. 4
    3
      src/drivers/net/realtek.c

+ 4
- 3
src/drivers/net/realtek.c Näytä tiedosto

@@ -879,8 +879,9 @@ static void realtek_detect ( struct realtek_nic *rtl ) {
879 879
 	 * Try to enable C+ mode and PCI Dual Address Cycle (for
880 880
 	 * 64-bit systems), if supported.
881 881
 	 */
882
-	cpcr = ( RTL_CPCR_DAC | RTL_CPCR_MULRW | RTL_CPCR_CPRX |
883
-		 RTL_CPCR_CPTX );
882
+	cpcr = readw ( rtl->regs + RTL_CPCR );
883
+	cpcr |= ( RTL_CPCR_DAC | RTL_CPCR_MULRW | RTL_CPCR_CPRX |
884
+		  RTL_CPCR_CPTX );
884 885
 	writew ( cpcr, rtl->regs + RTL_CPCR );
885 886
 	check_cpcr = readw ( rtl->regs + RTL_CPCR );
886 887
 
@@ -890,7 +891,7 @@ static void realtek_detect ( struct realtek_nic *rtl ) {
890 891
 		rtl->have_phy_regs = 1;
891 892
 		rtl->tppoll = RTL_TPPOLL_8169;
892 893
 	} else {
893
-		if ( check_cpcr == cpcr ) {
894
+		if ( ( check_cpcr == cpcr ) && ( cpcr != 0xffff ) ) {
894 895
 			DBGC ( rtl, "REALTEK %p appears to be an RTL8139C+\n",
895 896
 			       rtl );
896 897
 			rtl->tppoll = RTL_TPPOLL_8139CP;

Loading…
Peruuta
Tallenna