Search for a proper ucode image to use by incrementing the minor

release number up to the max.  This should eliminate the need to
tweak the default imageid define for later releases that are found
on the Intel web site.

MFC after:	1 month
This commit is contained in:
Sam Leffler 2007-05-24 16:31:22 +00:00
parent c1fd78f884
commit 56b5a9c2a7
3 changed files with 43 additions and 8 deletions

View File

@ -550,11 +550,27 @@ npe_activate(device_t dev)
struct npe_softc * sc = device_get_softc(dev);
int unit = device_get_unit(dev);
int error, i;
uint32_t imageid;
/* load NPE firmware and start it running */
error = ixpnpe_init(sc->sc_npe, "npe_fw", npeconfig[unit].imageid);
if (error != 0)
return error;
/*
* Load NPE firmware and start it running. We assume
* that minor version bumps remain compatible so probe
* the firmware image starting with the expected version
* and then bump the minor version up to the max.
*/
imageid = npeconfig[unit].imageid;
for (;;) {
error = ixpnpe_init(sc->sc_npe, "npe_fw", imageid);
if (error == 0)
break;
/* ESRCH is returned when the requested image is not present */
if (error != ESRCH)
return error;
/* bump the minor version up to the max possible */
if (NPEIMAGE_MINOR(imageid) == 0xff)
return error;
imageid++;
}
if (bus_space_map(sc->sc_iot, npeconfig[unit].regbase,
npeconfig[unit].regsize, 0, &sc->sc_ioh)) {

View File

@ -407,14 +407,14 @@ npe_findimage(struct ixpnpe_softc *sc,
}
/* 2 consecutive NPE_IMAGE_MARKER's indicates end of library */
if (image->id == NPE_IMAGE_MARKER) {
device_printf(sc->sc_dev,
DPRINTF(sc->sc_dev,
"imageId 0x%08x not found in image library header\n", imageId);
/* reached end of library, image not found */
return EIO;
return ESRCH;
}
offset += image->size;
}
return EIO;
return ESRCH;
}
int

View File

@ -32,7 +32,17 @@
*
* Firmware Id's for current firmware image. These are typed by
* NPE ID and the feature set. Not all features are available
* on all NPE's.
* on all NPE's. The Image ID has the following structure:
*
* Field [Bit Location]
* -----------------------------------
* Device ID [28..31]
* NPE ID [24..27]
* NPE Functionality ID [16..23]
* Major Release Number [8..15]
* Minor Release Number [0..7]
*
* The following "feature sets" are known to exist:
*
* HSS-0: supports 32 channelized and 4 packetized.
* HSS-0 + ATM + SPHY:
@ -56,6 +66,15 @@
* ETH+VLAN+HDR: Ethernet Rx/Tx which includes:
* SPANNING_TREE, FIREWALL, VLAN_QOS, HEADER_CONVERSION
*/
#define NPEIMAGE_DEVID(id) (((id) >> 28) & 0xf)
#define NPEIMAGE_NPEID(id) (((id) >> 24) & 0xf)
#define NPEIMAGE_FUNCID(id) (((id) >> 16) & 0xff)
#define NPEIMAGE_MAJOR(id) (((id) >> 8) & 0xff)
#define NPEIMAGE_MINOR(id) (((id) >> 0) & 0xff)
#define NPEIMAGE_MAKEID(dev, npe, func, maj, min) \
((((dev) & 0xf) << 28) | (((npe) & 0xf) << 24) | \
(((func) & 0xff) << 16) (((maj) & 0xff) << 8) | (((min) & 0xff) << 0))
/* XXX not right, revise */
/* NPE A Firmware Image Id's */
#define NPEFW_A_HSS0 0x00010000 /* HSS-0: 32 chan+4 packet */