The patch set in the following messages is revised after useful feedback 
from Stefan Hajnoczi:
  Patches 1 and 4 now use "PCI_CAP_ID_VNDR" to match Linux naming.
  Patch 4 now uses ntohl() instead of bswap32() for endian-independence.
The net effect of the revisions is shown in the following diff.

I retested after the changes, but only lightly, since the changes have no
effect on my little-endian hardware, outside of the source code itself.

--Glenn

diff --git a/src/drivers/net/myri10ge.c b/src/drivers/net/myri10ge.c
index 99bc272..218d56f 100644
--- a/src/drivers/net/myri10ge.c
+++ b/src/drivers/net/myri10ge.c
@@ -690,10 +690,10 @@ static int myri10ge_nv_init ( struct myri10ge_private 
*priv )
                DBG ( "EEPROM header unreadable\n" );
                return rc;
        }
-       hdr.eeprom_len         = bswap_32 ( hdr.eeprom_len );
-       hdr.eeprom_segment_len = bswap_32 ( hdr.eeprom_segment_len );
-       hdr.mcp2_offset        = bswap_32 ( hdr.mcp2_offset );
-       hdr.version            = bswap_32 ( hdr.version );
+       hdr.eeprom_len         = ntohl ( hdr.eeprom_len );
+       hdr.eeprom_segment_len = ntohl ( hdr.eeprom_segment_len );
+       hdr.mcp2_offset        = ntohl ( hdr.mcp2_offset );
+       hdr.version            = ntohl ( hdr.version );
        DBG2 ( "eelen:%xh seglen:%xh m...@%xh ver%d\n", hdr.eeprom_len,
               hdr.eeprom_segment_len, hdr.mcp2_offset, hdr.version );
 
@@ -707,7 +707,7 @@ static int myri10ge_nv_init ( struct myri10ge_private *priv 
)
        /* Read the length of MCP2. */
 
        rc = myri10ge_nvs_read ( &priv->nvs, hdr.mcp2_offset, &mcp2_len, 4 );
-       mcp2_len = bswap_32 ( mcp2_len );
+       mcp2_len = ntohl ( mcp2_len );
        DBG2 ( "mcp2len:%xh\n", mcp2_len );
 
        /* Determine the position of the NonVolatile Options fragment and
@@ -815,7 +815,7 @@ static int myri10ge_pci_probe ( struct pci_device *pci,
 
        /* Find the PCI Vendor-Specific capability. */
 
-       priv->pci_cap_vs = pci_find_capability ( pci , PCI_CAP_ID_VS );
+       priv->pci_cap_vs = pci_find_capability ( pci , PCI_CAP_ID_VNDR );
        if ( 0 == priv->pci_cap_vs ) {
                rc = -ENOTSUP;
                dbg = "no_vs";
diff --git a/src/include/gpxe/pci.h b/src/include/gpxe/pci.h
index d8c693d..0684375 100644
--- a/src/include/gpxe/pci.h
+++ b/src/include/gpxe/pci.h
@@ -159,7 +159,7 @@ FILE_LICENCE ( GPL2_ONLY );
 #define  PCI_CAP_ID_SLOTID     0x04    /* Slot Identification */
 #define  PCI_CAP_ID_MSI                0x05    /* Message Signalled Interrupts 
*/
 #define  PCI_CAP_ID_CHSWP      0x06    /* CompactPCI HotSwap */
-#define  PCI_CAP_ID_VS         0x09    /* Vendor Specific */
+#define  PCI_CAP_ID_VNDR       0x09    /* Vendor specific */
 #define  PCI_CAP_ID_EXP                0x10    /* PCI Express */
 #define PCI_CAP_LIST_NEXT      1       /* Next capability in the list */
 #define PCI_CAP_FLAGS          2       /* Capability defined flags (16 bits) */

_______________________________________________
gPXE-devel mailing list
gPXE-devel@etherboot.org
http://etherboot.org/mailman/listinfo/gpxe-devel

Reply via email to