|
From: NIIBE Y. <gn...@ch...> - 2000-05-08 23:40:48
|
Toshinobu Sugioka found that checksum routine is broken in case of
bigendian. I got the patch from him, still investigating. Partly,
it is merged. More will follows this week.
And I'll add Kaz' network driver to CVS repository. I import it
almost "as is", to avoid confusion. But I think that it's better
to follow the coding standard of Linux community here. Specifically,
indentation and such.
It's just a matter of taste, I don't care much, but this is the
co-operation, where some compromise is needed, I think.
I don't have strong opinion about coding standard. When I wrote for
GNU Project, I follow the one of GNU, while I follow the Linux one,
when write to the kernel.
I'll commit this and stnic.c soon.
--------------------------
2000-05-08 NIIBE Yutaka <gn...@m1...>
* drivers/net/stnic.c: New file by Kazmoto Kojima.
(stnic_probe): Changed the prototype.
(stnic_probe): Use new style probing API.
* include/asm-sh/hitachi_se.h (IRQ_STNIC): Added.
* arch/sh/kernel/time.c (time_init): New variable `bus_clock'.
2000-05-08 Toshinobu Sugioka <su...@it...>
* include/asm-sh/checksum.h (csum_fold): Change the implementation
for readability and in case it is used with no cast to ushort.
* arch/sh/lib/checksum.S: Shift 8-bit when it's big endian.
Index: arch/sh/kernel/time.c
===================================================================
RCS file: /cvsroot/linuxsh/kernel/arch/sh/kernel/time.c,v
retrieving revision 1.7
diff -u -r1.7 time.c
--- arch/sh/kernel/time.c 2000/05/03 01:34:46 1.7
+++ arch/sh/kernel/time.c 2000/05/08 23:29:25
@@ -383,14 +383,16 @@
void __init time_init(void)
{
- unsigned int cpu_clock, master_clock, module_clock;
- unsigned short ifc, pfc;
+ unsigned int cpu_clock, master_clock, bus_clock, module_clock;
+ unsigned short frqcr, ifc, pfc;
unsigned long interval;
#if defined(__sh3__)
static int ifc_table[] = { 1, 2, 4, 1, 3, 1, 1, 1 };
static int pfc_table[] = { 1, 2, 4, 1, 3, 6, 1, 1 };
+ static int sfc_table[] = { 1, 2, 3, 4, 6, 8, 1, 1 };
#elif defined(__SH4__)
static int ifc_table[] = { 1, 2, 3, 4, 6, 8, 1, 1 };
+#define bfc_table ifc_table /* Same */
static int pfc_table[] = { 2, 3, 4, 6, 8, 2, 2, 2 };
#endif
@@ -408,19 +410,33 @@
(cpu_clock / 1000000), (cpu_clock % 1000000)/10000);
#if defined(__sh3__)
{
- unsigned short tmp;
- tmp = (ctrl_inw(FRQCR) & 0x000c) >> 2;
- tmp |= (ctrl_inw(FRQCR) & 0x4000) >> 12;
- ifc = ifc_table[tmp & 0x0007];
- tmp = ctrl_inw(FRQCR) & 0x0003;
- tmp |= (ctrl_inw(FRQCR) & 0x2000) >> 11;
- pfc = pfc_table[ctrl_inw(FRQCR) & 0x0007];
+ unsigned short tmp, stc;
+ frqcr = ctrl_inw(FRQCR);
+ tmp = (frqcr & 0x8000) >> 13;
+ tmp |= (frqcr & 0x0030) >> 4;
+ stc = stc_table[tmp];
+ tmp = (frqcr & 0x4000) >> 12;
+ tmp |= (frqcr & 0x000c) >> 2;
+ ifc = ifc_table[tmp];
+ tmp = (frqcr & 0x2000) >> 11;
+ tmp |= frqcr & 0x0003;
+ pfc = pfc_table[tmp];
+ master_clock = cpu_clock * ifc;
+ bus_clock = master_clock/sfc;
}
#elif defined(__SH4__)
- ifc = ifc_table[(ctrl_inw(FRQCR)>> 6) & 0x0007];
- pfc = pfc_table[ctrl_inw(FRQCR) & 0x0007];
+ {
+ unsigned short bfc;
+ frqcr = ctrl_inw(FRQCR);
+ ifc = ifc_table[(frqcr>> 6) & 0x0007];
+ bfc = bfc_table[(frqcr>> 3) & 0x0007];
+ pfc = pfc_table[frqcr & 0x0007];
+ master_clock = cpu_clock * ifc;
+ bus_clock = master_clock/bfc;
+ }
#endif
- master_clock = cpu_clock * ifc;
+ printk("Bus clock: %d.%02dMHz\n",
+ (bus_clock/1000000), (bus_clock % 1000000)/10000);
module_clock = master_clock/pfc;
printk("Module clock: %d.%02dMHz\n",
(module_clock/1000000), (module_clock % 1000000)/10000);
Index: arch/sh/lib/checksum.S
===================================================================
RCS file: /cvsroot/linuxsh/kernel/arch/sh/lib/checksum.S,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 checksum.S
--- arch/sh/lib/checksum.S 2000/04/14 16:49:01 1.1.1.1
+++ arch/sh/lib/checksum.S 2000/05/08 23:29:25
@@ -131,6 +131,9 @@
7:
mov.b @r4+,r0
extu.b r0,r0
+#ifndef __LITTLE_ENDIAN__
+ shll8 r0
+#endif
8:
addc r0,r6
mov #0,r0
@@ -167,6 +170,16 @@
.long 9999b, 6002f ; \
.previous
+!
+! r4: const char *SRC
+! r5: char *DST
+! r6: int LEN
+! r7: int SUM
+!
+! on stack:
+! int *SRC_ERR_PTR
+! int *DST_ERR_PTR
+!
ENTRY(csum_partial_copy_generic)
mov.l r5,@-r15
mov.l r6,@-r15
@@ -179,7 +192,7 @@
bt/s 1f
clrt
bra 4f
- add #2,r6 ! ecx was < 2. Deal with it.
+ add #2,r6 ! $r6 was < 2. Deal with it.
SRC(1: mov.w @r4+,r0 )
DST( mov.w r0,@r5 )
add #2,r5
Index: drivers/net/Config.in
===================================================================
RCS file: /cvsroot/linuxsh/kernel/drivers/net/Config.in,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Config.in
--- drivers/net/Config.in 2000/04/14 17:36:02 1.1.1.2
+++ drivers/net/Config.in 2000/05/08 23:29:26
@@ -51,6 +51,9 @@
if [ "$CONFIG_SGI_IP27" = "y" ]; then
bool ' SGI IOC3 Ethernet' CONFIG_SGI_IOC3_ETH
fi
+ if [ "$CONFIG_SUPERH" = "y" -a "$CONFIG_SH_SOLUTION_ENGINE" = "y" ]; then
+ tristate ' National DP83902AV support' CONFIG_STNIC
+ fi
bool ' 3COM cards' CONFIG_NET_VENDOR_3COM
if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
tristate ' 3c501 support' CONFIG_EL1
Index: drivers/net/Makefile
===================================================================
RCS file: /cvsroot/linuxsh/kernel/drivers/net/Makefile,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Makefile
--- drivers/net/Makefile 2000/04/14 17:36:01 1.1.1.2
+++ drivers/net/Makefile 2000/05/08 23:29:26
@@ -146,6 +146,8 @@
obj-$(CONFIG_YELLOWFIN) += yellowfin.o
obj-$(CONFIG_ACENIC) += acenic.o
+obj-$(CONFIG_STNIC) += stnic.o 8390.o
+
ifeq ($(CONFIG_SK98LIN),y)
SUB_DIRS += sk98lin
obj-y += sk98lin/sk98lin.o
Index: include/asm-sh/checksum.h
===================================================================
RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/checksum.h,v
retrieving revision 1.2
diff -u -r1.2 checksum.h
--- include/asm-sh/checksum.h 2000/04/14 17:25:44 1.2
+++ include/asm-sh/checksum.h 2000/05/08 23:29:26
@@ -72,16 +72,17 @@
static __inline__ unsigned int csum_fold(unsigned int sum)
{
unsigned int __dummy;
- __asm__("clrt\n\t"
- "mov %0, %1\n\t"
- "shll16 %0\n\t"
- "addc %0, %1\n\t"
- "movt %0\n\t"
- "shlr16 %1\n\t"
- "add %1, %0"
+ __asm__("swap.w %0, %1\n\t"
+ "extu.w %0, %0\n\t"
+ "extu.w %1, %1\n\t"
+ "add %1, %0\n\t"
+ "swap.w %0, %1\n\t"
+ "add %1, %0\n\t"
+ "not %0, %0\n\t"
+ "extu.w %0, %0"
: "=r" (sum), "=&r" (__dummy)
: "0" (sum));
- return ~sum;
+ return sum;
}
/*
Index: include/asm-sh/hitachi_se.h
===================================================================
RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/hitachi_se.h,v
retrieving revision 1.1
diff -u -r1.1 hitachi_se.h
--- include/asm-sh/hitachi_se.h 2000/05/03 02:24:42 1.1
+++ include/asm-sh/hitachi_se.h 2000/05/08 23:29:27
@@ -48,4 +48,6 @@
#define BCR_ILCRF (PA_BCR + 10)
#define BCR_ILCRG (PA_BCR + 12)
+#define IRQ_STNIC 10
+
#endif /* __ASM_SH_HITACHI_SE_H */
|