net: ne2000: Divided a function of NE2000 driver
PATCH v2 1/1 net: ne2000: Divided a function of NE2000 driver
get_prom function was used __attriute__ , but it is not enable. ax88796.o does not do link besides ne2000.o. When ld is carried out, get_prom function of ax88796.c is ignored.
This problem is a thing by specifications of ld.
I checked and test this patch on SuperH and MIPS.
---
I forgot attach drivers/net/ne2000_base.c
drivers/net/Makefile | 6 +- drivers/net/ax88796.c | 2 +- drivers/net/ne2000.c | 719 +------------------------------------------ drivers/net/ne2000_base.c | 757 +++++++++++++++++++++++++++++++++++++++++++++ drivers/net/ne2000_base.h | 36 ++- 5 files changed, 797 insertions(+), 723 deletions(-) create mode 100644 drivers/net/ne2000_base.c
drivers/net/Makefile +2 -4
@@ -44,10 +44,8 @@ COBJS-$(CONFIG_MCFFEC) += mcffec.o COBJS-$(CONFIG_MPC5xxx_FEC) += mpc5xxx_fec.o COBJS-$(CONFIG_MPC512x_FEC) += mpc512x_fec.o COBJS-$(CONFIG_NATSEMI) += natsemi.o -ifeq ($(CONFIG_DRIVER_NE2000),y) -COBJS-y += ne2000.o -COBJS-$(CONFIG_DRIVER_AX88796L) += ax88796.o -endif +COBJS-$(CONFIG_DRIVER_NE2000) += ne2000.o ne2000_base.o +COBJS-$(CONFIG_DRIVER_AX88796L) += ax88796.o ne2000_base.o COBJS-$(CONFIG_DRIVER_NETARMETH) += netarm_eth.o COBJS-$(CONFIG_NETCONSOLE) += netconsole.o COBJS-$(CONFIG_DRIVER_NS7520_ETHERNET) += ns7520_eth.o
drivers/net/ax88796.c +1 -1
@@ -143,7 +143,7 @@ static void ax88796_mac_read(u8 *buff) } } -int get_prom (u8 * mac_addr) +int get_prom (u8 * mac_addr,u8 * base_addr) {u8 prom[32 ];int i;
drivers/net/ne2000.c +7 -712
756 lines not on this page · raw message
drivers/net/ne2000_base.c new file +757 -0
757 lines not on this page · raw message
drivers/net/ne2000_base.h +30 -6
@@ -80,10 +80,35 @@ are GPL, so this is, of course, GPL.#define __NE2000_BASE_H__#define bool int -#define false 0#define true 1 +/* +* Debugging details +* +* Set to perms of: +* 0 disables all debug output +* 1 for process debug output +* 2 for added data IO output: get_reg, put_reg +* 4 for packet allocation/free output +* 8 for only startup status, so we can tell we're installed OK +*/ +#if 0 +#define DEBUG 0xf +#else +#define DEBUG 0 +#endif + +#if DEBUG &1 +#define DEBUG_FUNCTION () do { printf("%s\n", __FUNCTION__); } while (0) +#define DEBUG_LINE () do { printf("%d\n", __LINE__); } while (0) +#define PRINTK(args...) printf(args) +#else +#define DEBUG_FUNCTION () do {} while(0) +#define DEBUG_LINE () do {} while(0) +#define PRINTK(args...) +#endif +/* timeout for tx/rx in s */ #define TOUT 5/* Ether MAC address size */
@@ -119,11 +144,6 @@ typedef struct dp83902a_priv_data {int rx_buf_start, rx_buf_end; } dp83902a_priv_data_t; -/* -* Some forward declarations -*/ -static void dp83902a_poll (void ); -/* ------------------------------------------------------------------------ */ /* Register offsets */
@@ -281,4 +301,8 @@ static void dp83902a_poll(void);#define IEEE_8023_MAX_FRAME 1518/* Largest possible ethernet frame */ #define IEEE_8023_MIN_FRAME 64/* Smallest possible ethernet frame */ + +/* Functions */ +int get_prom (u8 * mac_addr,u8 * base_addr); +#endif /* __NE2000_BASE_H__ */
Signature · 1 line
1.5.6.3
PATCH v2 1/1 net: ne2000: Divided a function of NE2000 driver
Hi Nobuhiro-san,
Quoted 6 lines · Nobuhiro Iwamatsu
get_promfunction was used__attriute__, but it is not enable. ax88796.o does not do link besides ne2000.o. When ld is carried out,get_promfunction ofax88796.cis ignored.
This problem is a thing by specifications of ld.
I checked and test this patch on SuperH and MIPS.
You're seeing a common problem with weak functions - namely that they don't always get overridden. If there was a single function in ax88796.c that had strong static linkage there wouldn't be a problem. Using the weak attribute for get_prom() is an elegant solution that improves code re-use, so I'm wondering if there's a way it can be made to work.
If nobody has any suggestions over the next couple of days, I'll pull in this patch.
This get_prom() function was set as weak in commit 2ef7503a593c77a80c2a054011970227c4b62774, labeled " NE2000: Fix regresssion introduced by e710185aae90 on non AX88796" by Jean-Christophe PLAGNIOL-VILLARD. It's a shame that this was done without testing...
regards,
Ben
PATCH v2 1/1 net: ne2000: Divided a function of NE2000 driver
Quoted 15 lines · Ben Warren
Hi Nobuhiro-san,
Quoted 6 lines · Nobuhiro Iwamatsu
get_promfunction was used__attriute__, but it is not enable. ax88796.o does not do link besides ne2000.o. When ld is carried out,get_promfunction ofax88796.cis ignored.
This problem is a thing by specifications of ld.
I checked and test this patch on SuperH and MIPS.You're seeing a common problem with weak functions - namely that they don't always get overridden. If there was a single function in
ax88796.cthat had strong static linkage there wouldn't be a problem. Using the weak attribute forget_prom()is an elegant solution that improves code re-use, so I'm wondering if there's a way it can be made to work.
Quoted 8 lines
If nobody has any suggestions over the next couple of days, I'll pull in this patch.
This
get_prom()function was set as weak in commit2ef7503a593c77a80c2a054011970227c4b62774, labeled " NE2000: Fix regresssion introduced bye710185aae90on non AX88796" by Jean-Christophe PLAGNIOL-VILLARD. It's a shame that this was done without testing...
The NE2000 is tested every modification and Release on qemu_mips by myself
And I've no problem on this board.
Best Regards,
J.
PATCH v2 1/1 net: ne2000: Divided a function of NE2000 driver
Quoted 28 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Ben Warren
Hi Nobuhiro-san,
Quoted 7 lines · Nobuhiro Iwamatsu
get_promfunction was used__attriute__, but it is not enable. ax88796.o does not do link besides ne2000.o. When ld is carried out,get_promfunction ofax88796.cis ignored.
This problem is a thing by specifications of ld.
I checked and test this patch on SuperH and MIPS.You're seeing a common problem with weak functions - namely that they don't always get overridden. If there was a single function in
ax88796.cthat had strong static linkage there wouldn't be a problem. Using the weak attribute forget_prom()is an elegant solution that improves code re-use, so I'm wondering if there's a way it can be made to work.Quoted 9 lines
If nobody has any suggestions over the next couple of days, I'll pull in this patch.
This
get_prom()function was set as weak in commit2ef7503a593c77a80c2a054011970227c4b62774, labeled " NE2000: Fix regresssion introduced bye710185aae90on non AX88796" by Jean-Christophe PLAGNIOL-VILLARD. It's a shame that this was done without testing...
Quoted 4 lines
The NE2000 is tested every modification and Release on
qemu_mipsby myselfAnd I've no problem on this board.
Sorry, I have a hard time believing that this works if you enable CONFIG_DRIVER_AX88796L. Are you sure that the weak get_prom() is overridden?
regards,
Ben
PATCH v2 1/1 net: ne2000: Divided a function of NE2000 driver
Hi, all
2008/10/3 Ben Warren <[email protected]>:
Quoted 29 lines
Quoted 28 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 26 lines · Ben Warren
Hi Nobuhiro-san,
Quoted 7 lines · Nobuhiro Iwamatsu
get_promfunction was used__attriute__, but it is not enable. ax88796.o does not do link besides ne2000.o. When ld is carried out,get_promfunction ofax88796.cis ignored.
This problem is a thing by specifications of ld.
I checked and test this patch on SuperH and MIPS.You're seeing a common problem with weak functions - namely that they don't always get overridden. If there was a single function in
ax88796.cthat had strong static linkage there wouldn't be a problem. Using the weak attribute forget_prom()is an elegant solution that improves code re-use, so I'm wondering if there's a way it can be made to work.If nobody has any suggestions over the next couple of days, I'll pull in this patch.
This
get_prom()function was set as weak in commit2ef7503a593c77a80c2a054011970227c4b62774, labeled " NE2000: Fix regresssion introduced bye710185aae90on non AX88796" by Jean-Christophe PLAGNIOL-VILLARD. It's a shame that this was done without testing...
Quoted 7 lines
Quoted 4 lines
The NE2000 is tested every modification and Release on
qemu_mipsby myselfAnd I've no problem on this board.
Sorry, I have a hard time believing that this works if you enable
CONFIG_DRIVER_AX88796L. Are you sure that the weakget_prom()is overridden?
Thank you for your check.
When I enabled CONFIG_DRIVER_AX88796L on SH and MIPS, and checked ne2000.o by nm,get_prom is set in WEAK. But get_prom is not linked, and __get_prom is linked in u-boot.
With the current code, get_prom of AX88796L is not linked.
If need nm and objdump output , I can attach.
Best regards,
Nobuhiro
Signature · 1 line
Nobuhiro Iwamatsu
PATCH v2 1/1 net: ne2000: Divided a function of NE2000 driver
Quoted 42 lines · Nobuhiro Iwamatsu
Hi, all
2008/10/3 Ben Warren <[email protected]>:
Quoted 29 lines
Quoted 28 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 26 lines · Ben Warren
Hi Nobuhiro-san,
Quoted 7 lines · Nobuhiro Iwamatsu
get_promfunction was used__attriute__, but it is not enable. ax88796.o does not do link besides ne2000.o. When ld is carried out,get_promfunction ofax88796.cis ignored.
This problem is a thing by specifications of ld.
I checked and test this patch on SuperH and MIPS.You're seeing a common problem with weak functions - namely that they don't always get overridden. If there was a single function in
ax88796.cthat had strong static linkage there wouldn't be a problem. Using the weak attribute forget_prom()is an elegant solution that improves code re-use, so I'm wondering if there's a way it can be made to work.If nobody has any suggestions over the next couple of days, I'll pull in this patch.
This
get_prom()function was set as weak in commit2ef7503a593c77a80c2a054011970227c4b62774, labeled " NE2000: Fix regresssion introduced bye710185aae90on non AX88796" by Jean-Christophe PLAGNIOL-VILLARD. It's a shame that this was done without testing...Quoted 7 lines
Quoted 4 lines
The NE2000 is tested every modification and Release on
qemu_mipsby myselfAnd I've no problem on this board.
Sorry, I have a hard time believing that this works if you enable
CONFIG_DRIVER_AX88796L. Are you sure that the weakget_prom()is overridden?Thank you for your check.
Quoted 8 lines
When I enabled
CONFIG_DRIVER_AX88796Lon SH and MIPS, and checked ne2000.o by nm,get_promis set in WEAK. Butget_promis not linked, and__get_promis linked in u-boot.
With the current code,get_promof AX88796L is not linked.If need nm and objdump output , I can attach.
I believe you. An even easier way to see this is by looking at System.map.
regards,
Ben