LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] H8/300 module fix
@ 2004-05-23 12:40 Yoshinori Sato
  2004-05-23 13:57 ` [PATCH] H8/300 ne driver " Yoshinori Sato
  0 siblings, 1 reply; 2+ messages in thread
From: Yoshinori Sato @ 2004-05-23 12:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux kernel Mailing List

- fix relocation
- define SYMBOL_PREFIX

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

diff -ur linux-2.6.6-bk9/arch/h8300/kernel/h8300_ksyms.c linux-2.6.6-h8300/arch/h8300/kernel/h8300_ksyms.c
--- linux-2.6.6-bk9/arch/h8300/kernel/h8300_ksyms.c	2004-05-23 21:11:56.000000000 +0900
+++ linux-2.6.6-h8300/arch/h8300/kernel/h8300_ksyms.c	2004-05-23 21:01:50.000000000 +0900
@@ -40,6 +40,8 @@
 EXPORT_SYMBOL(ip_fast_csum);
 
 EXPORT_SYMBOL(kernel_thread);
+EXPORT_SYMBOL(enable_irq);
+EXPORT_SYMBOL(disable_irq);
 
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy);
diff -ur linux-2.6.6-bk9/arch/h8300/kernel/module.c linux-2.6.6-h8300/arch/h8300/kernel/module.c
--- linux-2.6.6-bk9/arch/h8300/kernel/module.c	2004-05-23 21:11:56.000000000 +0900
+++ linux-2.6.6-h8300/arch/h8300/kernel/module.c	2004-05-23 21:01:50.000000000 +0900
@@ -67,7 +67,6 @@
 		Elf32_Sym *sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
 			+ ELF32_R_SYM(rela[i].r_info);
 		uint32_t v = sym->st_value + rela[i].r_addend;
-		uint32_t dot = sechdrs[symindex].sh_addr + rela[i].r_offset;
 
 		switch (ELF32_R_TYPE(rela[i].r_info)) {
 		case R_H8_DIR24R8:
@@ -75,14 +74,15 @@
 			*loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v);
 			break;
 		case R_H8_DIR24A8:
-			*loc += v;
+			if (ELF32_R_SYM(rela[i].r_info))
+				*loc += v;
 			break;
 		case R_H8_DIR32:
 		case R_H8_DIR32A16:
 			*loc += v;
 			break;
 		case R_H8_PCREL16:
-			v -= dot + 2;
+			v -= (unsigned long)loc + 2;
 			if ((Elf32_Sword)v > 0x7fff || 
 			    (Elf32_Sword)v < -(Elf32_Sword)0x8000)
 				goto overflow;
@@ -90,7 +90,7 @@
 				*(unsigned short *)loc = v;
 			break;
 		case R_H8_PCREL8:
-			v -= dot + 1;
+			v -= (unsigned long)loc + 1;
 			if ((Elf32_Sword)v > 0x7f || 
 			    (Elf32_Sword)v < -(Elf32_Sword)0x80)
 				goto overflow;
@@ -105,7 +105,7 @@
 	}
 	return 0;
  overflow:
-	printk(KERN_ERR "module %s: relocation offset overflow: %p\n",
+	printk(KERN_ERR "module %s: relocation offset overflow: %08x\n",
 	       me->name, rela[i].r_offset);
 	return -ENOEXEC;
 }
diff -ur linux-2.6.6-bk9/include/asm-h8300/module.h linux-2.6.6-h8300/include/asm-h8300/module.h
--- linux-2.6.6-bk9/include/asm-h8300/module.h	2004-05-23 21:12:07.000000000 +0900
+++ linux-2.6.6-h8300/include/asm-h8300/module.h	2004-05-23 21:00:28.000000000 +0900
@@ -8,4 +8,6 @@
 #define Elf_Sym Elf32_Sym
 #define Elf_Ehdr Elf32_Ehdr
 
+#define MODULE_SYMBOL_PREFIX "_"
+
 #endif /* _ASM_H8/300_MODULE_H */
diff -ur linux-2.6.6-bk9/scripts/mk_elfconfig.c linux-2.6.6-h8300/scripts/mk_elfconfig.c
--- linux-2.6.6-bk9/scripts/mk_elfconfig.c	2004-01-09 16:00:04.000000000 +0900
+++ linux-2.6.6-h8300/scripts/mk_elfconfig.c	2004-05-23 21:01:08.000000000 +0900
@@ -55,7 +55,7 @@
 	else
 		abort();
 
-	if (strcmp(argv[1], "v850") == 0)
+	if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0))
 		printf("#define MODULE_SYMBOL_PREFIX \"_\"\n");
 	else 
 		printf("#define MODULE_SYMBOL_PREFIX \"\"\n");

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] H8/300 ne driver module fix
  2004-05-23 12:40 [PATCH] H8/300 module fix Yoshinori Sato
@ 2004-05-23 13:57 ` Yoshinori Sato
  0 siblings, 0 replies; 2+ messages in thread
From: Yoshinori Sato @ 2004-05-23 13:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux kernel Mailing List

- module suppot fix

-- 
Yoshinori Sato
<ysato@users.sourceforge.jp>

diff -u linux-2.6.6-bk9/drivers/net/8390.h linux-2.6.6-h8300/drivers/net/8390.h
--- linux-2.6.6-bk9/drivers/net/8390.h	2004-05-23 21:11:58.000000000 +0900
+++ linux-2.6.6-h8300/drivers/net/8390.h	2004-05-23 22:49:24.000000000 +0900
@@ -143,7 +143,7 @@
 #define inb_p(_p)	inb(_p)
 #define outb_p(_v,_p)	outb(_v,_p)
 
-#elif defined(CONFIG_NET_CBUS) || defined(CONFIG_NE_H8300)
+#elif defined(CONFIG_NET_CBUS) || defined(CONFIG_NE_H8300) || defined(CONFIG_NE_H8300_MODULE)
 #define EI_SHIFT(x)	(ei_local->reg_offset[x])
 #else
 #define EI_SHIFT(x)	(x)
diff -u linux-2.6.6-bk9/drivers/net/Kconfig linux-2.6.6-h8300/drivers/net/Kconfig
--- linux-2.6.6-bk9/drivers/net/Kconfig	2004-05-23 21:11:58.000000000 +0900
+++ linux-2.6.6-h8300/drivers/net/Kconfig	2004-05-23 22:47:06.000000000 +0900
@@ -1829,7 +1829,7 @@
 	  controller on the Motorola ColdFire 5272 processor.
 
 config NE_H8300
-	bool "NE2000 compatible support for H8/300"
+	tristate "NE2000 compatible support for H8/300"
 	depends on H8300 && NET_ETHERNET
 	help
 	  Say Y here if you want to use the NE2000 compatible
diff -u linux-2.6.6-bk9/drivers/net/ne-h8300.c linux-2.6.6-h8300/drivers/net/ne-h8300.c
--- linux-2.6.6-bk9/drivers/net/ne-h8300.c	2004-05-23 21:11:58.000000000 +0900
+++ linux-2.6.6-h8300/drivers/net/ne-h8300.c	2004-05-23 22:40:01.000000000 +0900
@@ -260,8 +260,8 @@
 	bus_width &= 1 << ((ioaddr >> 21) & 7);
 	ei_status.word16 = (bus_width == 0); /* temporary setting */
 	for(i = 0; i < 16 /*sizeof(SA_prom)*/; i++) {
-		SA_prom[i] = inb(ioaddr + NE_DATAPORT);
-		inb(ioaddr + NE_DATAPORT); /* dummy read */
+		SA_prom[i] = inb_p(ioaddr + NE_DATAPORT);
+		inb_p(ioaddr + NE_DATAPORT); /* dummy read */
 	}
 
 	start_page = NESM_START_PG;
@@ -590,7 +590,7 @@
 
 \f
 #ifdef MODULE
-#define MAX_NE_CARDS	4	/* Max number of NE cards per module */
+#define MAX_NE_CARDS	1	/* Max number of NE cards per module */
 static struct net_device *dev_ne[MAX_NE_CARDS];
 static int io[MAX_NE_CARDS];
 static int irq[MAX_NE_CARDS];
@@ -599,7 +599,7 @@
 MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
 MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
 MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM_DESC(io, "I/O base address(es),required");
+MODULE_PARM_DESC(io, "I/O base address(es)");
 MODULE_PARM_DESC(irq, "IRQ number(s)");
 MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver");
 MODULE_LICENSE("GPL");
@@ -612,26 +612,35 @@
 int init_module(void)
 {
 	int this_dev, found = 0;
+	int err;
 
 	for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
 		struct net_device *dev = alloc_ei_netdev();
 		if (!dev)
 			break;
-		dev->irq = irq[this_dev];
-		dev->mem_end = bad[this_dev];
-		dev->base_addr = io[this_dev];
-		if (do_ne_probe(dev) == 0) {
-			if (register_netdev(dev) == 0) {
-				dev_ne[found++] = dev;
-				continue;
+		if (io[this_dev]) {
+			dev->irq = irq[this_dev];
+			dev->mem_end = bad[this_dev];
+			dev->base_addr = io[this_dev];
+		} else {
+			dev->base_addr = h8300_ne_base[this_dev];
+			dev->irq = h8300_ne_irq[this_dev];
+		}
+		err = init_reg_offset(dev, dev->base_addr);
+		if (!err) {
+			if (do_ne_probe(dev) == 0) {
+				if (register_netdev(dev) == 0) {
+					dev_ne[found++] = dev;
+					continue;
+				}
+				cleanup_card(dev);
 			}
-			cleanup_card(dev);
 		}
 		free_netdev(dev);
 		if (found)
 			break;
 		if (io[this_dev] != 0)
-			printk(KERN_WARNING "ne.c: No NE*000 card found at i/o = %#x\n", io[this_dev]);
+			printk(KERN_WARNING "ne.c: No NE*000 card found at i/o = %#x\n", dev->base_addr);
 		else
 			printk(KERN_NOTICE "ne.c: You must supply \"io=0xNNN\" value(s) for ISA cards.\n");
 		return -ENXIO;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-05-23 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-23 12:40 [PATCH] H8/300 module fix Yoshinori Sato
2004-05-23 13:57 ` [PATCH] H8/300 ne driver " Yoshinori Sato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).