return 0;
}
+
+/**
+ * Find PHY address
+ *
+ * @v mii MII device
+ * @ret rc Return status code
+ */
+int mii_find ( struct mii_device *mii ) {
+ unsigned int address;
+ int id;
+
+ /* Try all possible PHY addresses */
+ for ( address = 0 ; address <= MII_MAX_PHY_ADDRESS ; address++ ) {
+ mii->address = address;
+ id = mii_read ( mii, MII_PHYSID1 );
+ if ( ( id > 0x0000 ) && ( id < 0xffff ) ) {
+ DBGC ( mii, "MII %p found PHY at address %d\n",
+ mii, address );
+ return 0;
+ }
+ }
+
+ DBGC ( mii, "MII %p failed to find an address\n", mii );
+ return -ENOENT;
+}
/** Maximum time to wait for a reset, in milliseconds */
#define MII_RESET_MAX_WAIT_MS 500
+/** Maximum PHY address */
+#define MII_MAX_PHY_ADDRESS 31
+
extern int mii_restart ( struct mii_device *mii );
extern int mii_reset ( struct mii_device *mii );
extern int mii_check_link ( struct mii_device *mii,
struct net_device *netdev );
+extern int mii_find ( struct mii_device *mii );
#endif /* _IPXE_MII_H */