From 1651d4f6d7f764ff5bfafc12bd058a88e49b0ff5 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 30 Nov 2010 01:10:38 +0000 Subject: [nvo] Remove the non-volatile options fragment list Since its implementation several years ago, no driver has used a fragment list containing more than a single fragment. Simplify the NVO core and the drivers that use it by removing the whole concept of the fragment list, and using a simple (address,length) pair instead. Signed-off-by: Michael Brown --- src/drivers/net/etherfabric.c | 11 +++-------- src/drivers/net/myri10ge.c | 16 ++++------------ src/drivers/net/natsemi.c | 18 +++++++----------- src/drivers/net/rtl8139.c | 20 +++++++------------- 4 files changed, 21 insertions(+), 44 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/net/etherfabric.c b/src/drivers/net/etherfabric.c index 352cdd99c..77d21247d 100644 --- a/src/drivers/net/etherfabric.c +++ b/src/drivers/net/etherfabric.c @@ -1492,12 +1492,6 @@ fail1: return rc; } -/** Portion of EEPROM available for non-volatile options */ -static struct nvo_fragment falcon_nvo_fragments[] = { - { 0x100, 0xf0 }, - { 0, 0 } -}; - /******************************************************************************* * * @@ -3277,9 +3271,10 @@ falcon_probe_spi ( struct efab_nic *efab ) } /* If the device has EEPROM attached, then advertise NVO space */ - if ( has_eeprom ) - nvo_init ( &efab->nvo, &efab->spi_eeprom.nvs, falcon_nvo_fragments, + if ( has_eeprom ) { + nvo_init ( &efab->nvo, &efab->spi_eeprom.nvs, 0x100, 0xf0, &efab->netdev->refcnt ); + } return 0; } diff --git a/src/drivers/net/myri10ge.c b/src/drivers/net/myri10ge.c index cea2758f4..bc730ea98 100644 --- a/src/drivers/net/myri10ge.c +++ b/src/drivers/net/myri10ge.c @@ -183,8 +183,8 @@ struct myri10ge_private */ struct nvs_device nvs; - struct nvo_fragment nvo_fragment[2]; struct nvo_block nvo; + unsigned int nvo_registered; /* Cached PCI capability locations. */ @@ -727,28 +727,20 @@ static int myri10ge_nv_init ( struct myri10ge_private *priv ) priv->nvs.read = myri10ge_nvs_read; priv->nvs.write = myri10ge_nvs_write; - /* Build the NonVolatile storage fragment list. We would like - to use the whole last EEPROM block for this, but we must - reduce the block size lest malloc fail in - src/core/nvo.o. */ - - priv->nvo_fragment[0].address = nvo_fragment_pos; - priv->nvo_fragment[0].len = 0x200; - /* Register the NonVolatile Options storage. */ nvo_init ( &priv->nvo, &priv->nvs, - priv->nvo_fragment, + nvo_fragment_pos, 0x200, & myri10ge_netdev (priv) -> refcnt ); rc = register_nvo ( &priv->nvo, netdev_settings ( myri10ge_netdev ( priv ) ) ); if ( rc ) { DBG ("register_nvo failed"); - priv->nvo_fragment[0].len = 0; return rc; } + priv->nvo_registered = 1; DBG2 ( "NVO supported\n" ); return 0; } @@ -758,7 +750,7 @@ myri10ge_nv_fini ( struct myri10ge_private *priv ) { /* Simply return if nonvolatile access is not supported. */ - if ( 0 == priv->nvo_fragment[0].len ) + if ( 0 == priv->nvo_registered ) return; unregister_nvo ( &priv->nvo ); diff --git a/src/drivers/net/natsemi.c b/src/drivers/net/natsemi.c index 19c20edd7..61073b59b 100644 --- a/src/drivers/net/natsemi.c +++ b/src/drivers/net/natsemi.c @@ -130,15 +130,6 @@ static struct bit_basher_operations natsemi_basher_ops = { .write = natsemi_spi_write_bit, }; -/* It looks that this portion of EEPROM can be used for - * non-volatile stored options. Data sheet does not talk about this region. - * Currently it is not working. But with some efforts it can. - */ -static struct nvo_fragment natsemi_nvo_fragments[] = { - { 0x0c, 0x68 }, - { 0, 0 } -}; - /* * Set up for EEPROM access * @@ -157,8 +148,13 @@ static void natsemi_init_eeprom ( struct natsemi_private *np ) { */ init_at93c46 ( &np->eeprom, 16 ); np->eeprom.bus = &np->spibit.bus; - np->nvo.nvs = &np->eeprom.nvs; - np->nvo.fragments = natsemi_nvo_fragments; + + /* It looks that this portion of EEPROM can be used for + * non-volatile stored options. Data sheet does not talk about + * this region. Currently it is not working. But with some + * efforts it can. + */ + nvo_init ( &np->nvo, &np->eeprom.nvs, 0x0c, 0x68, NULL ); } /** diff --git a/src/drivers/net/rtl8139.c b/src/drivers/net/rtl8139.c index 1ce1344eb..e97829f06 100644 --- a/src/drivers/net/rtl8139.c +++ b/src/drivers/net/rtl8139.c @@ -251,17 +251,6 @@ static struct bit_basher_operations rtl_basher_ops = { .write = rtl_spi_write_bit, }; -/** Portion of EEPROM available for non-volatile stored options - * - * We use offset 0x40 (i.e. address 0x20), length 0x40. This block is - * marked as VPD in the rtl8139 datasheets, so we use it only if we - * detect that the card is not supporting VPD. - */ -static struct nvo_fragment rtl_nvo_fragments[] = { - { 0x20, 0x40 }, - { 0, 0 } -}; - /** * Set up for EEPROM access * @@ -288,13 +277,18 @@ static void rtl_init_eeprom ( struct net_device *netdev ) { } rtl->eeprom.bus = &rtl->spibit.bus; - /* Initialise space for non-volatile options, if available */ + /* Initialise space for non-volatile options, if available + * + * We use offset 0x40 (i.e. address 0x20), length 0x40. This + * block is marked as VPD in the rtl8139 datasheets, so we use + * it only if we detect that the card is not supporting VPD. + */ vpd = ( inw ( rtl->ioaddr + Config1 ) & VPDEnable ); if ( vpd ) { DBGC ( rtl, "rtl8139 %p EEPROM in use for VPD; cannot use " "for options\n", rtl ); } else { - nvo_init ( &rtl->nvo, &rtl->eeprom.nvs, rtl_nvo_fragments, + nvo_init ( &rtl->nvo, &rtl->eeprom.nvs, 0x20, 0x40, &netdev->refcnt ); } } -- cgit v1.2.3-55-g7522