You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
(9) |
Apr
(27) |
May
(5) |
Jun
(8) |
Jul
(50) |
Aug
(286) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(79) |
Feb
(102) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(41) |
Jul
(11) |
Aug
(28) |
Sep
(58) |
Oct
(4) |
Nov
(18) |
Dec
(8) |
2002 |
Jan
(2) |
Feb
(2) |
Mar
(1) |
Apr
(478) |
May
(469) |
Jun
(78) |
Jul
(16) |
Aug
(2) |
Sep
(7) |
Oct
(47) |
Nov
(5) |
Dec
(227) |
2003 |
Jan
(155) |
Feb
(188) |
Mar
(160) |
Apr
(172) |
May
(41) |
Jun
(205) |
Jul
(104) |
Aug
(289) |
Sep
(31) |
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Kenn H. <ke...@us...> - 2003-06-15 23:24:58
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/i386/kernel In directory sc8-pr-cvs1:/tmp/cvs-serv24338/arch/i386/kernel Removed Files: bluesmoke.c Log Message: Merge with 2.5.47 --- bluesmoke.c DELETED --- |
From: Kenn H. <ke...@us...> - 2003-06-15 23:24:58
|
Update of /cvsroot/linux-vax/kernel-2.5/Documentation/kbuild In directory sc8-pr-cvs1:/tmp/cvs-serv24338/Documentation/kbuild Removed Files: config-language.txt Log Message: Merge with 2.5.47 --- config-language.txt DELETED --- |
From: Kenn H. <ke...@us...> - 2003-06-15 22:33:59
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel In directory sc8-pr-cvs1:/tmp/cvs-serv14457/arch/vax/kernel Modified Files: cpu_generic.c cpu_ka55.c entry.S process.c regdump.c syscall.c Log Message: Switch over to % prefix on register names (required for newer toolchain) Index: cpu_generic.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/cpu_generic.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- cpu_generic.c 24 Jan 2003 00:28:31 -0000 1.4 +++ cpu_generic.c 15 Jun 2003 22:33:56 -0000 1.5 @@ -76,7 +76,7 @@ void ka46_48_49_prom_putchar(int c) { asm (" - movzbl %0, r2 # zero-extended byte convert. + movzbl %0, %%r2 # zero-extended byte convert. jsb 0x20040068 " : /* nothing */ @@ -95,7 +95,7 @@ void ka4x_prom_putchar(int c) { asm (" - movzbl %0, r2 # zero-extended byte convert. + movzbl %0, %%r2 # zero-extended byte convert. jsb 0x20040058 " : /* nothing */ Index: cpu_ka55.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/cpu_ka55.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- cpu_ka55.c 5 Jun 2002 21:55:03 -0000 1.6 +++ cpu_ka55.c 15 Jun 2003 22:33:56 -0000 1.7 @@ -65,12 +65,12 @@ void ka55_prom_putchar(int c) { asm (" - movl $0x2014044b, r11 # console page addr + movl $0x2014044b, %%r11 # console page addr 1: - jsb *0x20(r11) # ready to TX? - blbc r0, 1b - movl %0, r1 - jsb *0x24(r11) # TX char in R11 + jsb *0x20(%%r11) # ready to TX? + blbc %%r0, 1b + movl %0, %%r1 + jsb *0x24(%%r11) # TX char in R11 " : /* no outputs */ : "g"(c) : "r0", "r1", "r11" ); Index: entry.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/entry.S,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- entry.S 11 May 2003 17:43:36 -0000 1.8 +++ entry.S 15 Jun 2003 22:33:56 -0000 1.9 @@ -48,26 +48,26 @@ of longwords of this exception info is available in the irqvector structure (at our "return address") */ - pushl r0 /* Need to use R0 as a working register */ + pushl %r0 /* Need to use R0 as a working register */ /* Get number of exception info longwords into R0. Remember that this value is stored immediately after the JSB instruction in the irqvector, so the "return address" points to it */ - movl *4(sp), r0 + movl *4(%sp), %r0 - addl2 $3, r0 /* R0 now contains number of longwords between - top of stack and saved PSL */ + addl2 $3, %r0 /* R0 now contains number of longwords between + top of stack and saved PSL */ - pushl (sp)[r0] /* Push saved PSL again */ - pushl (sp)[r0] /* Push saved PC again */ - extzv $22, $2, 4(sp), -(sp) /* Extract PREVMODE field from saved + pushl (%sp)[%r0] /* Push saved PSL again */ + pushl (%sp)[%r0] /* Push saved PC again */ + extzv $22, $2, 4(%sp), -(%sp) /* Extract PREVMODE field from saved PSL and save on stack (because we don't have any spare registers yet) */ - cmpzv $24, $2, 8(sp), (sp) /* Is PREVMODE == CURMODE? */ + cmpzv $24, $2, 8(%sp), (%sp) /* Is PREVMODE == CURMODE? */ beql same_mode - mfpr (sp),(sp) /* HACK ALERT! The processor modes are 0..3 + mfpr (%sp),(%sp) /* HACK ALERT! The processor modes are 0..3 for kernel..user mode. The stack pointer internal processor registers are also 0..3 for kernel..user mode. So, using the @@ -78,12 +78,12 @@ processor mode before the exception occurred */ brb sp_saved same_mode: - moval 16(sp)[r0],(sp) /* Exception is not changing modes. Therefore - we calculate how far up the stack the SP - was pointing when the exception occurred. */ + moval 16(%sp)[%r0],(%sp) /* Exception is not changing modes. Therefore + we calculate how far up the stack the SP + was pointing when the exception occurred. */ sp_saved: pushr $0x3ffe /* Push FP to R1 */ - pushl 64(sp) /* Duplicate saved R0 */ + pushl 64(%sp) /* Duplicate saved R0 */ /* The stack now looks like: @@ -105,9 +105,9 @@ when you modify this code, we're counting stack locations to get the right offsets here... */ - pushal 76(sp) /* address of exception info */ - pushl 76(sp) /* handler_PC */ - pushal 8(sp) /* start of pt_regs */ + pushal 76(%sp) /* address of exception info */ + pushl 76(%sp) /* handler_PC */ + pushal 8(%sp) /* start of pt_regs */ calls $3, do_irq_excep @@ -125,7 +125,7 @@ 68 as you'd expect from the stack layout shown above. This is because the SP is incremented by 4 while evaluating the first operand */ - movl (sp)+, 64(sp) + movl (%sp)+, 64(%sp) /* Restore registers R1 up to FP */ popr $0x3ffe @@ -147,19 +147,19 @@ handlers to change the PC of the code that triggered the exception. This is tricky because of the exception info that may be present on the stack. First get the size of the exception info into R0 */ - movl *16(sp), r0 + movl *16(%sp), %r0 /* Now move the saved PC down over the original (the 20-byte offset takes care of skipping over the top 5 items on the stack, and then the R0 index skips over the exception info */ - movl 4(sp), 20(sp)[r0] + movl 4(%sp), 20(%sp)[%r0] /* * D.A. May 2001 - we need to copy the PSL down, to * get to usermode originally as we make up a new PSL * in start_thread and we need the CPU to believe it */ - movl 8(sp), 24(sp)[r0] + movl 8(%sp), 24(%sp)[%r0] /* The stack now looks like: SP: saved SP for previous mode @@ -175,11 +175,11 @@ /* Now move the saved R0 (r0+1) longwords down the stack, leaving it just before the saved PC, overwriting either the saved handler_PC or the end of the exception info ... */ - movl 12(sp), 16(sp)[r0] + movl 12(%sp), 16(%sp)[%r0] /* ... and clear stack down to this point */ - moval 16(sp)[r0], sp + moval 16(%sp)[%r0], %sp /* Stack now looks like @@ -189,7 +189,7 @@ /* Restore R0 and dismiss exception */ - movl (sp)+, r0 + movl (%sp)+, %r0 mtpr $31, $PR_IPL rei @@ -209,7 +209,7 @@ saved PSL */ pushr $0x3fff /* Save FP to R0 */ - pushl 56(sp) /* copy return address (handler_PC) */ + pushl 56(%sp) /* copy return address (handler_PC) */ calls $1, unhandled_exception /* If unhandled_exception() returns, then we must be @@ -219,7 +219,7 @@ continue */ popr $0x3fff /* restore R0 to FP */ - moval 4(sp), sp /* Remove handler_PC */ + moval 4(%sp), %sp /* Remove handler_PC */ rei /* mcheck_handler is the handler for machine check exceptions. @@ -243,10 +243,10 @@ * PSL */ pushr $0x3f /* push all registers in case we can restart */ - pushab 24(sp) /* address of stack slot which holds byte count */ + pushab 24(%sp) /* address of stack slot which holds byte count */ calls $1, machine_check /* in reboot.c */ popr $0x3f /* spring them off */ - addl2 (sp)+,sp /* get rid of the machine check frame */ + addl2 (%sp)+,%sp /* get rid of the machine check frame */ rei /* dismiss */ Index: process.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/process.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- process.c 17 Apr 2003 02:18:24 -0000 1.15 +++ process.c 15 Jun 2003 22:33:56 -0000 1.16 @@ -62,7 +62,7 @@ /* svpctx should deal with writing the stuff into *prev */ - asm(" movpsl -(sp) \n + asm(" movpsl -(%%sp) \n pushab 1f \n mtpr %3, %4 \n svpctx \n @@ -163,12 +163,12 @@ pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { - asm(" clrl -(sp) \n - movl %0, -(sp) \n + asm(" clrl -(%%sp) \n + movl %0, -(%%sp) \n pushl $0x2 \n - movl sp, ap \n + movl %%sp, %%ap \n chmk %1 \n - tstl r0 \n + tstl %%r0 \n beql child \n ret \n child:" Index: regdump.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/regdump.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- regdump.c 16 Feb 2003 23:58:41 -0000 1.5 +++ regdump.c 15 Jun 2003 22:33:56 -0000 1.6 @@ -156,8 +156,8 @@ /* Why doesn't asm("fp") on the declaration work as advertised? */ - asm("movl fp, %0" : "=g"(fp) : ); - asm("movl ap, %0" : "=g"(ap) : ); + asm("movl %%fp, %0" : "=g"(fp) : ); + asm("movl %%ap, %0" : "=g"(ap) : ); /* First frame we look at is our own */ target_fp = fp; @@ -203,17 +203,17 @@ unsigned int raw_psl; /* Grab the current registers */ - asm ("movq r0, %0" : "=g"(regs.r0) : ); - asm ("movq r2, %0" : "=g"(regs.r2) : ); - asm ("movq r4, %0" : "=g"(regs.r4) : ); - asm ("movq r6, %0" : "=g"(regs.r6) : ); - asm ("movq r8, %0" : "=g"(regs.r8) : ); - asm ("movq r10, %0" : "=g"(regs.r10) : ); - asm ("movq ap, %0" : "=g"(regs.ap) : ); - asm ("movq sp, %0" : "=g"(regs.sp) : ); + asm ("movq %%r0, %0" : "=g"(regs.r0) : ); + asm ("movq %%r2, %0" : "=g"(regs.r2) : ); + asm ("movq %%r4, %0" : "=g"(regs.r4) : ); + asm ("movq %%r6, %0" : "=g"(regs.r6) : ); + asm ("movq %%r8, %0" : "=g"(regs.r8) : ); + asm ("movq %%r10, %0" : "=g"(regs.r10) : ); + asm ("movq %%ap, %0" : "=g"(regs.ap) : ); + asm ("movq %%sp, %0" : "=g"(regs.sp) : ); asm ("movpsl %0" : "=g"(regs.psl) : ); - asm("movl fp, %0" : "=g"(fp) : ); + asm("movl %%fp, %0" : "=g"(fp) : ); /* We always pull saved registers from our own stack frame */ Index: syscall.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/syscall.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- syscall.c 27 Jan 2003 09:04:25 -0000 1.5 +++ syscall.c 15 Jun 2003 22:33:56 -0000 1.6 @@ -99,16 +99,16 @@ We'll sort this out later... - KPH 2000-10-16 */ /* atp aug 2001, FIXME: ptrace/strace syscall stuff */ - __asm__(" pushl %1 \n - subl2 %2,sp \n - 1: movc3 %2,4(%4),(sp) \n - calls %3, %5 \n - brb 3f \n - 2: movl %6, r0 \n - 3: movl r0, %0 \n - .section ex_table,\"a\" \n - .align 2 \n - .long 1b, 2b \n + __asm__(" pushl %1 \n + subl2 %2,%%sp \n + 1: movc3 %2,4(%4),(%%sp) \n + calls %3, %5 \n + brb 3f \n + 2: movl %6, %%r0 \n + 3: movl %%r0, %0 \n + .section ex_table,\"a\" \n + .align 2 \n + .long 1b, 2b \n .text" : "=g"(regs->r0) : "g"(regs), |
From: Kenn H. <ke...@us...> - 2003-06-15 22:33:59
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax In directory sc8-pr-cvs1:/tmp/cvs-serv14457/arch/vax Modified Files: Makefile Log Message: Switch over to % prefix on register names (required for newer toolchain) Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/Makefile,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- Makefile 14 Jun 2003 18:22:52 -0000 1.20 +++ Makefile 15 Jun 2003 22:33:55 -0000 1.21 @@ -12,7 +12,7 @@ # Copyright (C) 1994 by Linus Torvalds # -LDFLAGS=-m elf_vax +#LDFLAGS=-m elf_vax OBJCOPYFLAGS=-O binary -R .note -R .comment -S |
From: Kenn H. <ke...@us...> - 2003-06-15 22:33:59
|
Update of /cvsroot/linux-vax/kernel-2.5/include/asm-vax In directory sc8-pr-cvs1:/tmp/cvs-serv14457/include/asm-vax Modified Files: byteorder.h cacheflush.h unistd.h Log Message: Switch over to % prefix on register names (required for newer toolchain) Index: byteorder.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/include/asm-vax/byteorder.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- byteorder.h 20 May 2002 00:33:39 -0000 1.3 +++ byteorder.h 15 Jun 2003 22:33:56 -0000 1.4 @@ -16,11 +16,11 @@ { __u32 t1; /* assume input is aabbccdd in x*/ - __asm__ volatile ("rotl $8, %1, r1\n\t" /* r1 = bbccddaa */ - "bicl3 $0xff00ff00, r1, %0\n\t" /* %0 = 00cc00aa */ - "rotl $-8, %1, r1\n\t" /* r1 = ddaabbcc */ - "bicl2 $0xff00ff, r1\n\t" /* r1 = dd00bb00 */ - "bisl2 r1, %0\n\t" /* %0 = ddccbbaa */ + __asm__ volatile ("rotl $8, %1, %%r1\n\t" /* r1 = bbccddaa */ + "bicl3 $0xff00ff00, %%r1, %0\n\t" /* %0 = 00cc00aa */ + "rotl $-8, %1, %%r1\n\t" /* r1 = ddaabbcc */ + "bicl2 $0xff00ff, %%r1\n\t" /* r1 = dd00bb00 */ + "bisl2 %%r1, %0\n\t" /* %0 = ddccbbaa */ : "=&g" (t1) : "r" (x) : "r1" ); return t1; } Index: cacheflush.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/include/asm-vax/cacheflush.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- cacheflush.h 27 Jan 2003 00:23:45 -0000 1.2 +++ cacheflush.h 15 Jun 2003 22:33:56 -0000 1.3 @@ -28,10 +28,10 @@ /* Push a PC/PSL onto the stack so it looks like we got an interrupt, and then REI */ __asm__ ( - " movpsl -(sp) \n" - " pushab 1f \n" - " rei \n" - "1: " : : ); + " movpsl -(%%sp) \n" + " pushab 1f \n" + " rei \n" + "1: " : : ); } Index: unistd.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/include/asm-vax/unistd.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- unistd.h 10 Feb 2003 01:02:22 -0000 1.5 +++ unistd.h 15 Jun 2003 22:33:56 -0000 1.6 @@ -280,8 +280,8 @@ register long _sc_0 __asm__("r0"); \ _sc_0 = __NR_##name; \ __asm__ __volatile__ ("pushl $0x0\n\t" \ - "movl sp, ap\n\t" \ - "chmk r0 # %0 %1\n\t" \ + "movl %%sp, %%ap\n\t" \ + "chmk %%r0 # %0 %1\n\t" \ : "=r"(_sc_0) \ : "0"(_sc_0) \ : _syscall_clobbers); \ @@ -299,8 +299,8 @@ _sc_0 = __NR_##name; \ __asm__ __volatile__ ("pushl %2\n\t" \ "pushl $0x1\n\t" \ - "movl sp, ap\n\t" \ - "chmk r0 # %0 %1 %2\n\t" \ + "movl %%sp, %%ap\n\t" \ + "chmk %%r0 # %0 %1 %2\n\t" \ : "=r"(_sc_0) \ : "0"(_sc_0), "m"((long)arg1) \ : _syscall_clobbers); \ @@ -319,8 +319,8 @@ __asm__ __volatile__ ("pushl %3\n\t" \ "pushl %2\n\t" \ "pushl $0x2\n\t" \ - "movl sp, ap\n\t" \ - "chmk r0 # %0 %1 %2 %3\n\t" \ + "movl %%sp, %%ap\n\t" \ + "chmk %%r0 # %0 %1 %2 %3\n\t" \ : "=r"(_sc_0) \ : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2) \ : _syscall_clobbers); \ @@ -342,8 +342,8 @@ "pushl %3\n\t" \ "pushl %2\n\t" \ "pushl $0x3\n\t" \ - "movl sp, ap\n\t" \ - "chmk r0 # %0 %1 %2 %3 %4\n\t" \ + "movl %%sp, %%ap\n\t" \ + "chmk %%r0 # %0 %1 %2 %3 %4\n\t" \ : "=r"(_sc_0) \ : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ "m"((long)arg3) \ @@ -365,8 +365,8 @@ "pushl %3\n\t" \ "pushl %2\n\t" \ "pushl $0x4\n\t" \ - "movl sp, ap\n\t" \ - "chmk r0 # %0 %1 %2 %3 %4 %5\n\t" \ + "movl %%sp, %%ap\n\t" \ + "chmk %%r0 # %0 %1 %2 %3 %4 %5\n\t" \ : "=r"(_sc_0) \ : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ "m"((long) arg3), "m"((long) arg4) \ @@ -390,8 +390,8 @@ "pushl %3\n\t" \ "pushl %2\n\t" \ "pushl $0x5\n\t" \ - "movl sp, ap\n\t" \ - "chmk r0 # %0 %1 %2 %3 %4 %5 %6\n\t" \ + "movl %%sp, %%ap\n\t" \ + "chmk %%r0 # %0 %1 %2 %3 %4 %5 %6\n\t" \ : "=r"(_sc_0) \ : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ "m"((long)arg3), "m"((long)arg4), \ @@ -417,8 +417,8 @@ "pushl %3\n\t" \ "pushl %2\n\t" \ "pushl $0x6\n\t" \ - "movl sp, ap\n\t" \ - "chmk r0 # %0 %1 %2 %3 %4 %5 %6 %7\n\t" \ + "movl %%sp, %%ap\n\t" \ + "chmk %%r0 # %0 %1 %2 %3 %4 %5 %6 %7\n\t" \ : "=r"(_sc_0) \ : "0"(_sc_0), "m"((long)arg1), "m"((long)arg2), \ "m"((long)arg3), "m"((long)arg4), \ |
From: Kenn H. <ke...@us...> - 2003-06-15 22:33:59
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/boot In directory sc8-pr-cvs1:/tmp/cvs-serv14457/arch/vax/boot Modified Files: head.S hexdump.S lib.S mmstart.S Log Message: Switch over to % prefix on register names (required for newer toolchain) Index: head.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/head.S,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- head.S 17 Apr 2003 02:14:41 -0000 1.6 +++ head.S 15 Jun 2003 22:33:56 -0000 1.7 @@ -30,69 +30,69 @@ mtpr $0, $PR_MAPEN mtpr $31, $PR_IPL # save r11, ap and scbb and location of command line - movl ap, boot_ap - movl r11, boot_r11 + movl %ap, boot_ap + movl %r11, boot_r11 mfpr $PR_SCBB, boot_scb - movab bootparam, r5 - addl2 $PAGE_OFFSET,r5 # we will only access this when mapen=1 - movl r5,kernel_cmd_line + movab bootparam, %r5 + addl2 $PAGE_OFFSET,%r5 # we will only access this when mapen=1 + movl %r5,kernel_cmd_line # put the sp somewhere safe, over our bootblock in fact - moval start, r5 - subl2 $0x200, r5 - movl r5,sp + moval start, %r5 + subl2 $0x200, %r5 + movl %r5,%sp # movzbl $0x42,r2 # jsb 0x20040058 calls $0, idcpu - movl r0, mv + movl %r0, mv # now fix up the machine vector entries. (They currently contain # pointers to virtual addresses in S0 space. We need to change # the pointers to the functions we use before VM init to point # into the newly-loaded kernel image.) - movl mv, r2 - moval start, r3 + movl mv, %r2 + moval start, %r3 - subl2 $PAGE_OFFSET+KERNEL_START_PHYS, r3 - addl2 r3, MV_PRE_VM_PUTCHAR(r2) - addl2 r3, MV_PRE_VM_GETCHAR(r2) - addl2 r3, MV_CPU_TYPE_STR(r2) + subl2 $PAGE_OFFSET+KERNEL_START_PHYS, %r3 + addl2 %r3, MV_PRE_VM_PUTCHAR(%r2) + addl2 %r3, MV_PRE_VM_GETCHAR(%r2) + addl2 %r3, MV_CPU_TYPE_STR(%r2) # pre_vm_init is called after we relocate - subl2 $PAGE_OFFSET, MV_PRE_VM_INIT(r2) + subl2 $PAGE_OFFSET, MV_PRE_VM_INIT(%r2) # print the cpu type jsb crlf - movab msg_cpu_type, r10 + movab msg_cpu_type, %r10 jsb printstr - movl mv, r10 - calls $0, *MV_CPU_TYPE_STR(r10) - movl r0, r10 + movl mv, %r10 + calls $0, *MV_CPU_TYPE_STR(%r10) + movl %r0, %r10 jsb printstr jsb crlf # print first line of debug diagnostics - movab msg_loaded, r10 # ascii string + movab msg_loaded, %r10 # ascii string jsb printstr - moval start, r10 # where we were loaded + moval start, %r10 # where we were loaded jsb printint jsb crlf - movab msg_registers, r10 # ascii string + movab msg_registers, %r10 # ascii string jsb printstr jsb space - movl boot_r11, r11 - movl r11,r10 # r11 (holds the rpb base address, usually 0x0 ) + movl boot_r11, %r11 + movl %r11,%r10 # r11 (holds the rpb base address, usually 0x0 ) jsb printint jsb space - movl 48(r11), r10 # saved r5 in RPB (argument to BOOT command) + movl 48(%r11), %r10 # saved r5 in RPB (argument to BOOT command) jsb printint jsb space - movl ap, r10 # argument pointer (struct arglist) + movl %ap, %r10 # argument pointer (struct arglist) jsb printint jsb space - movl sp, r10 # stack pointer + movl %sp, %r10 # stack pointer jsb printint jsb crlf @@ -110,27 +110,27 @@ #inside one chunk the data is moved bottom-to-top. #Assumed that 1MB - load_address > 65535B otherwise #it will break. - movl $__bss_start,r6 - subl2 $start,r6 # byte count to r6 - movab __bss_start,r1 - subl2 $0xffff, r1 # r1 points to top chunk of source - movl $KERNEL_START_PHYS, r3 # dest address to r3 - addl2 r6,r3 - subl2 $0xffff,r3 #r3 points to top chunk of dest + movl $__bss_start,%r6 + subl2 $start,%r6 # byte count to r6 + movab __bss_start,%r1 + subl2 $0xffff, %r1 # r1 points to top chunk of source + movl $KERNEL_START_PHYS, %r3 # dest address to r3 + addl2 %r6,%r3 + subl2 $0xffff,%r3 #r3 points to top chunk of dest # copy_chunk: - cmpl $0xffff,r6 + cmpl $0xffff,%r6 bgeq last_chunk - movc3 $0xffff,(r1),(r3) - subl2 $0x1fffe,r1 #place r1 to bottom of new src. chunk - subl2 $0x1fffe,r3 #place r3 to bottom of new dest. chunk - subl2 $0xffff,r6 + movc3 $0xffff,(%r1),(%r3) + subl2 $0x1fffe,%r1 #place r1 to bottom of new src. chunk + subl2 $0x1fffe,%r3 #place r3 to bottom of new dest. chunk + subl2 $0xffff,%r6 beql copy_done #this instruction is probably not needed brb copy_chunk last_chunk: - movab start,r1 - movl $KERNEL_START_PHYS,r3 - movc3 r6,(r1),(r3) + movab start,%r1 + movl $KERNEL_START_PHYS,%r3 + movc3 %r6,(%r1),(%r3) copy_done: # @@ -138,37 +138,37 @@ # instead of when we are preparing the loadable image because it # makes the image smaller - subl3 $__bss_start, $_end, r6 # length of .bss to r6 + subl3 $__bss_start, $_end, %r6 # length of .bss to r6 - subl3 $start, $__bss_start, r3 # offset of .bss to r3 - addl2 $KERNEL_START_PHYS, r3 # phys address of .bss start now in r3 + subl3 $start, $__bss_start, %r3 # offset of .bss to r3 + addl2 $KERNEL_START_PHYS, %r3 # phys address of .bss start now in r3 fill_chunk: - cmpl $0xffff, r6 + cmpl $0xffff, %r6 bgeq last_fill - movc5 $0, (r3), $0, $0xffff, (r3) + movc5 $0, (%r3), $0, $0xffff, (%r3) # After movc5, r3 points to next dest addr - subl2 $0xffff, r6 + subl2 $0xffff, %r6 beql fill_done brb fill_chunk last_fill: - movc5 $0, (r3), $0, r6, (r3) + movc5 $0, (%r3), $0, %r6, (%r3) # After movc5, r3 points to just after # end of kernel fill_done: - decl r3 # - movl r3, r9 # save phys addr of last byte of kernel + decl %r3 # + movl %r3, %r9 # save phys addr of last byte of kernel # in R9. We will need this later # Need to know the distance we have moved the kernel, so that we can # fix up the machine vector pointer after we jump - moval start, r2 - subl3 r2, $KERNEL_START_PHYS, r2 # r2 = START_PHYS - load_address + moval start, %r2 + subl3 %r2, $KERNEL_START_PHYS, %r2 # r2 = START_PHYS - load_address # calculate the position after jump to reloc - movl $KERNEL_START_PHYS, r3 - addl2 $reloc, r3 - subl2 $start,r3 - jmp (r3) + movl $KERNEL_START_PHYS, %r3 + addl2 $reloc, %r3 + subl2 $start, %r3 + jmp (%r3) halt reloc: @@ -177,17 +177,17 @@ # fix up the machine vector pointer (by restoring it from boot_mv and # adding in the distance that the kernel was re-located) - addl3 r2, boot_mv, mv - movl mv, r3 + addl3 %r2, boot_mv, mv + movl mv, %r3 #and the pre-vm i/o functions - addl2 r2, MV_PRE_VM_PUTCHAR(r3) - addl2 r2, MV_PRE_VM_GETCHAR(r3) - addl2 r2, MV_CPU_TYPE_STR(r3) + addl2 %r2, MV_PRE_VM_PUTCHAR(%r3) + addl2 %r2, MV_PRE_VM_GETCHAR(%r3) + addl2 %r2, MV_CPU_TYPE_STR(%r3) - movab msg_relocated, r10 # debugging line no 2 + movab msg_relocated, %r10 # debugging line no 2 jsb printstr - moval reloc, r10 # where we are now (physical) + moval reloc, %r10 # where we are now (physical) jsb printint jsb crlf # @@ -196,10 +196,10 @@ jsb cpu_id # save RPB before it gets obliterated - movl boot_r11, r11 - movc3 rpb_size, (r11), boot_rpb - movl mv, r3 - calls $0, *MV_PRE_VM_INIT(r3) + movl boot_r11, %r11 + movc3 rpb_size, (%r11), boot_rpb + movl mv, %r3 + calls $0, *MV_PRE_VM_INIT(%r3) # set up the system page table for all of physical memory. # for the i386, the first page only is setup. For us, as the @@ -220,21 +220,21 @@ # # Correction, for 3100/85 it needs to be page aligned. - addl3 $0x200, r9, r5 # R9 holds kernel end - bicl2 $0x1ff, r5 # R5 is R9 rounded up to page aligned - moval swapper_pg_dir, r0 + addl3 $0x200, %r9, %r5 # R9 holds kernel end + bicl2 $0x1ff, %r5 # R5 is R9 rounded up to page aligned + moval swapper_pg_dir, %r0 # This is (pgd_t)swapper_pg_dir[2].br - movl r5, ASM_SBR_OFFSET(r0) # save address of base of system page table + movl %r5, ASM_SBR_OFFSET(%r0) # save address of base of system page table # Fill in the main part of the SPT (the entries that map physical # memory) - movl $0, r6 # pfn number - movl 76(r11), r7 # pfncnt from vmb. + movl $0, %r6 # pfn number + movl 76(%r11), %r7 # pfncnt from vmb. sysfill: - bisl3 $_PAGE_VALID + _PAGE_UW, r6, (r5)+ + bisl3 $_PAGE_VALID + _PAGE_UW, %r6, (%r5)+ # set PFN, VALID bit and protection UW in PTE - incl r6 # next PFN - cmpl r6, r7 # one page of PTE Table -> 128 Pages of PTES + incl %r6 # next PFN + cmpl %r6, %r7 # one page of PTE Table -> 128 Pages of PTES blssu sysfill # We need to align the IOMAP/VMALLOC tables (well at least the VMALLOC @@ -244,61 +244,61 @@ # is, so round up r7 to the next page, add 7 then and with 7, # check with r6 if the same we are aligned if not put zeros into the # PTE until we are aligned. - D.A. June 2001 (this stuff is bitchin..) - addl2 $0x7, r7 - bicl2 $7, r7 - cmpl r6, r7 + addl2 $0x7, %r7 + bicl2 $7, %r7 + cmpl %r6, %r7 beql nozerofl zerofl: - movl $0x00000000, (r5)+ - incl r6 # next PFN - cmpl r6, r7 # one page of PTE Table -> 128 Pages of PTES + movl $0x00000000, (%r5)+ + incl %r6 # next PFN + cmpl %r6, %r7 # one page of PTE Table -> 128 Pages of PTES blssu zerofl nozerofl: # Zero out the spare part of the SPT (the entries that will be used # to map I/O space and provide virtual addrs for vmalloc() later) - movl r5, iomap_base - addl2 $SPT_HWPTES_IOMAP+0, r7 + movl %r5, iomap_base + addl2 $SPT_HWPTES_IOMAP+0, %r7 sparef1: - movl $0x00000000, (r5)+ - incl r6 # next PFN - cmpl r6, r7 # one page of PTE Table -> 128 Pages of PTES + movl $0x00000000, (%r5)+ + incl %r6 # next PFN + cmpl %r6, %r7 # one page of PTE Table -> 128 Pages of PTES blssu sparef1 - movl r5, vmallocmap_base - addl2 $SPT_HWPTES_VMALLOC, r7 + movl %r5, vmallocmap_base + addl2 $SPT_HWPTES_VMALLOC, %r7 sparefill2: - movl $0x00000000, (r5)+ - incl r6 # next PFN - cmpl r6, r7 # one page of PTE Table -> 128 Pages of PTES + movl $0x00000000, (%r5)+ + incl %r6 # next PFN + cmpl %r6, %r7 # one page of PTE Table -> 128 Pages of PTES blssu sparefill2 # system page table is setup. Save SPT length and zap processor registers - moval swapper_pg_dir, r0 - movl r7, ASM_SLR_OFFSET(r0) - mtpr ASM_SBR_OFFSET(r0), $PR_SBR # set SBR - mtpr r7, $PR_SLR # set SLR + moval swapper_pg_dir, %r0 + movl %r7, ASM_SLR_OFFSET(%r0) + mtpr ASM_SBR_OFFSET(%r0), $PR_SBR # set SBR + mtpr %r7, $PR_SLR # set SLR # PCBB # set up the process control block. Some machines need a valid PCB for # mm to work properly. # We should use the pcb for the init task for this, but Since this bit # should be done in C, rather than hardwiring offsets, I have put a fake # PCB in a throwaway .init section below. - moval fake_pcb,r9 - movl $PAGE_OFFSET,88(r9) # p1br - mtpr r9, $PR_PCBB + moval fake_pcb,%r9 + movl $PAGE_OFFSET,88(%r9) # p1br + mtpr %r9, $PR_PCBB # no need to TBIA - memory mapping not enabled # ready to turn on VM - moval msg_starting_vm, r10 + moval msg_starting_vm, %r10 jsb printstr jsb crlf calls $0, VAX_start_mm # do that ole black magic # made it - moval swapper_pg_dir, r0 - addl2 $PAGE_OFFSET, ASM_SBR_OFFSET(r0) # fix up our reference to the system page tbl. + moval swapper_pg_dir, %r0 + addl2 $PAGE_OFFSET, ASM_SBR_OFFSET(%r0) # fix up our reference to the system page tbl. addl2 $PAGE_OFFSET, iomap_base # ... and the IOMAP PTEs addl2 $PAGE_OFFSET, vmallocmap_base # ... and the IOMAP PTEs addl2 $PAGE_OFFSET, mv # fix up machine vector pointer - movl mv, r3 - addl2 $PAGE_OFFSET, MV_CPU_TYPE_STR(r3) + movl mv, %r3 + addl2 $PAGE_OFFSET, MV_CPU_TYPE_STR(%r3) # relocate the interrupt stack. The C code will turn the # last page of the interrupt stack into a read-only guard @@ -307,18 +307,18 @@ # FIXME SMP: This needs to select the right stack for this CPU # rather than hard-coding the first one. Looks like we need to # determine our CPU_ID before this point... - moval interrupt_stack, r0 - addl2 $INT_STACK_SIZE, r0 - movl r0, sp + moval interrupt_stack, %r0 + addl2 $INT_STACK_SIZE, %r0 + movl %r0, %sp # Now that we have ISP (the interrupt stack pointer) sorted, # we need to move over to working on the kernel stack. We do this # my loading KSP with the top of the kernel stack for the 'init task' # and faking a saved PC/PSL on the interrupt stack which we then # 'return' to - moval init_thread_union, r0 - addl2 $8192, r0 # taken from <linux/sched.h> - mtpr r0,$PR_KSP + moval init_thread_union, %r0 + addl2 $8192, %r0 # taken from <linux/sched.h> + mtpr %r0,$PR_KSP pushl $0x001f0000 # IS=0, accmode=prevmode=K, IPL=31 pushab now_on_kstack @@ -349,21 +349,21 @@ clrl prom_sidex clrl cpu_type mfpr $PR_SID, cpu_type - movab msg_cpu_type, r10 + movab msg_cpu_type, %r10 jsb printstr - movl cpu_type, r10 + movl cpu_type, %r10 jsb printint jsb space - movl cpu_type, r7 - extv $24, $8, r7, r6 - cmpl r6, $0x0A + movl cpu_type, %r7 + extv $24, $8, %r7, %r6 + cmpl %r6, $0x0A blss no_sidex # note - we may not need to do this here. Is the board type used # before we remap prom ? movl 0x20040004, prom_sidex - movab msg_sidex, r10 + movab msg_sidex, %r10 jsb printstr - movl prom_sidex, r10 + movl prom_sidex, %r10 jsb printint no_sidex: jsb crlf Index: hexdump.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/hexdump.S,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- hexdump.S 20 May 2002 00:33:33 -0000 1.3 +++ hexdump.S 15 Jun 2003 22:33:56 -0000 1.4 @@ -11,66 +11,66 @@ # movl $0xffa800,r4 # movl ap,r4 # movl $0x0, r4 - movl r10,r4 - movl r9,r11 + movl %r10,%r4 + movl %r9,%r11 jsb printint jsb space - movl (r4),r10 + movl (%r4),%r10 jsb printint jsb space - movl r11,r10 + movl %r11,%r10 jsb printint jsb crlf - clrl r3 - clrl r9 + clrl %r3 + clrl %r9 LOOP: - movl r11, r10 + movl %r11, %r10 jsb printint jsb space - movl r3, r10 + movl %r3, %r10 jsb printint jsb space - movl r4, r10 + movl %r4, %r10 jsb printint jsb space - movl (r4), r10 + movl (%r4), %r10 jsb printint jsb space jmp PASC LRET: jsb crlf - incl r3 - incl r9 + incl %r3 + incl %r9 # page length on my uvax is about 0x1f lines - cmpl r9, $0x1F + cmpl %r9, $0x1F beql pause #c 0x80 is one page 0x200 is 4 pages -LRET2: addl2 $4, r4 - cmpl r3, r11 +LRET2: addl2 $4, %r4 + cmpl %r3, %r11 bleq LOOP rsb -PASC: movl r4 , r6 - movl r6, r10 +PASC: movl %r4, %r6 + movl %r6, %r10 jsb printchar - incl r6 - movl r6, r10 + incl %r6 + movl %r6, %r10 jsb printchar - incl r6 - movl r6, r10 + incl %r6 + movl %r6, %r10 jsb printchar - incl r6 - movl r6, r10 + incl %r6 + movl %r6, %r10 jsb printchar jmp LRET pause: - movab more, r10 + movab more, %r10 jsb printstr GCLOOP: jsb 0x20040044 - tstl r0 + tstl %r0 beql GCLOOP - clrl r9 + clrl %r9 jsb crlf jmp LRET2 Index: lib.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/lib.S,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- lib.S 20 May 2002 00:33:33 -0000 1.3 +++ lib.S 15 Jun 2003 22:33:56 -0000 1.4 @@ -8,32 +8,32 @@ # r2 contains ASCII code of character to print to console, .globl boot_putchar boot_putchar: - movl mv, r0 - pushl r2 - calls $1, *MV_PRE_VM_PUTCHAR(r0) + movl mv, %r0 + pushl %r2 + calls $1, *MV_PRE_VM_PUTCHAR(%r0) rsb # print a long integer in hex. integer is in r10, uses r2 and r8 # .globl printint printint: - clrl r8 - clrl r2 - movzbl $0x1C, r2 - subl2 r2, r8 + clrl %r8 + clrl %r2 + movzbl $0x1C, %r2 + subl2 %r2, %r8 L1: - clrl r2 - ashl r8, r10, r2 - bicl2 $0xfffffff0, r2 -; bicl2 $-64, r2 - cmpl r2,$0x09 + clrl %r2 + ashl %r8, %r10, %r2 + bicl2 $0xfffffff0, %r2 +; bicl2 $-64, %r2 + cmpl %r2,$0x09 bleq H1 - addl2 $0x07, r2 + addl2 $0x07, %r2 H1: - addl2 $0x30, r2 + addl2 $0x30, %r2 jsb boot_putchar - addl2 $0x04, r8 - cmpl r8,$0x04 + addl2 $0x04, %r8 + cmpl %r8,$0x04 bneq L1 rsb # @@ -41,10 +41,10 @@ # .globl crlf crlf: - clrl r2 - movzbl $0x0A, r2 + clrl %r2 + movzbl $0x0A, %r2 jsb boot_putchar - movzbl $0x0D, r2 + movzbl $0x0D, %r2 jsb boot_putchar rsb # @@ -53,27 +53,27 @@ # .globl printstr printstr: - clrl r8 - movl r10 ,r5 -L2: clrl r2 - movzbl (r5),r2 + clrl %r8 + movl %r10, %r5 +L2: clrl %r2 + movzbl (%r5),%r2 jsb boot_putchar - incl r5 - cmpb (r5), $0x0 + incl %r5 + cmpb (%r5), $0x0 bneq L2 rsb .global printchar printchar: - movzbl (r10), r7 - cmpl r7, $0x7d + movzbl (%r10), %r7 + cmpl %r7, $0x7d bleq PASC2 - movzbl $0x2e, r7 -PASC2: cmpl r7, $0x41 + movzbl $0x2e, %r7 +PASC2: cmpl %r7, $0x41 bgeq PASC3 - movzbl $0x2e, r7 + movzbl $0x2e, %r7 PASC3: - movl r7,r2 + movl %r7,%r2 jsb boot_putchar rsb @@ -81,7 +81,7 @@ .globl space space: - movzbl $0x20, r2 + movzbl $0x20, %r2 jsb boot_putchar rsb Index: mmstart.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/mmstart.S,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- mmstart.S 20 May 2002 00:33:33 -0000 1.3 +++ mmstart.S 15 Jun 2003 22:33:56 -0000 1.4 @@ -16,52 +16,52 @@ .balign 0x200 VAX_start_mm: .word 0xffc # protect registers r2->r11 - movl sp,r8 # save the stack pointer - movl fp,r9 # save the frame pointer - clrl r4 # clear the decks - clrl r5 - clrl r6 - clrl r10 - movab VAX_start_mm, r10 # This is where we start mapping - ashl $-9, r10, r4 # calculate the pfn of the start of this fn - movab P0_table,r3 # Phys address of our P0 table - addl2 $PAGE_OFFSET,r3 # virtual address of our P0 table - ashl $0x02, r4, r5 # P0 PTE offset in bytes - subl2 r5, r3 # fake P0BR in bytes - ashl $-2, r5, r6 # fake P0LR in PTEs - addl2 $0x08, r6 # add in length of table - mtpr r3, $PR_P0BR # load P0BR - mtpr r6, $PR_P0LR # load P0LR + movl %sp,%r8 # save the stack pointer + movl %fp,%r9 # save the frame pointer + clrl %r4 # clear the decks + clrl %r5 + clrl %r6 + clrl %r10 + movab VAX_start_mm, %r10 # This is where we start mapping + ashl $-9, %r10, %r4 # calculate the pfn of the start of this fn + movab P0_table,%r3 # Phys address of our P0 table + addl2 $PAGE_OFFSET,%r3 # virtual address of our P0 table + ashl $0x02, %r4, %r5 # P0 PTE offset in bytes + subl2 %r5, %r3 # fake P0BR in bytes + ashl $-2, %r5, %r6 # fake P0LR in PTEs + addl2 $0x08, %r6 # add in length of table + mtpr %r3, $PR_P0BR # load P0BR + mtpr %r6, $PR_P0LR # load P0LR mtpr $PAGE_OFFSET,$PR_P1BR # make sure P1BR is sensible mtpr $0, $PR_P1LR # and zero length - movab P0_table,r3 # Phys address of P0table. - movl 0x08,r2 -P0fill: movl (r3), r1 # fill the P0table with the right pfns - addl2 r4, r1 - movl r1, (r3)+ - sobgtr r2, P0fill + movab P0_table,%r3 # Phys address of P0table. + movl 0x08,%r2 +P0fill: movl (%r3), %r1 # fill the P0table with the right pfns + addl2 %r4, %r1 + movl %r1, (%r3)+ + sobgtr %r2, P0fill # # fixup stack # - addl2 $PAGE_OFFSET, 8(sp) # saved ap. - addl2 $PAGE_OFFSET, 12(sp)# fixup saved fp - addl2 $PAGE_OFFSET, 16(sp)# fixup saved pc + addl2 $PAGE_OFFSET, 8(%sp) # saved ap. + addl2 $PAGE_OFFSET, 12(%sp)# fixup saved fp + addl2 $PAGE_OFFSET, 16(%sp)# fixup saved pc # active stack -# movl sp, r10 -# subl2 $0x80, r10 -# movl $0x40, r9 +# movl %sp, %r10 +# subl2 $0x80, %r10 +# movl $0x40, %r9 # jsb hexdump # halt - addl2 $PAGE_OFFSET, sp # fixup sp to virtual address - addl2 $PAGE_OFFSET, fp # fixup fp to virtual address - movab vreloc, r6 # where we want to end up (phys) - addl2 $PAGE_OFFSET, r6 # & virt + addl2 $PAGE_OFFSET, %sp # fixup sp to virtual address + addl2 $PAGE_OFFSET, %fp # fixup fp to virtual address + movab vreloc, %r6 # where we want to end up (phys) + addl2 $PAGE_OFFSET, %r6 # & virt # According to ARM, we should invalidate the whole TB here mtpr $0, $PR_TBIA # clear translation buffer mtpr $1, $PR_MAPEN # switch on mm. - jmp (r6) + jmp (%r6) halt vreloc: # made it. now fixup sp fp and stack frame # cant use prom routines now. |
From: Kenn H. <ke...@us...> - 2003-06-15 22:33:59
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14457/arch/vax/lib Modified Files: checksum.S clear_user.S copy_tofrom_user.S string.c strncpy_user.S strnlen_user.S Log Message: Switch over to % prefix on register names (required for newer toolchain) Index: checksum.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/lib/checksum.S,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- checksum.S 20 May 2002 00:33:33 -0000 1.4 +++ checksum.S 15 Jun 2003 22:33:56 -0000 1.5 @@ -46,9 +46,9 @@ .text ENTRY(csum_partial) .word 0x3e - movl 4(ap), r2 /* r2 now has buf */ - movl 8(ap), r3 /* r3 has len */ - movl 12(ap), r0 /* r4 has sum */ + movl 4(%ap), %r2 /* r2 now has buf */ + movl 8(%ap), %r3 /* r3 has len */ + movl 12(%ap), %r0 /* r4 has sum */ /* test stuff */ # Check Alignment @@ -56,54 +56,54 @@ # Alignment uses up two bytes # Jump if we have two bytes # something < 2 deal with it - bbc $1, r2, 2f # Check is bit 1 , jump if clear - subl2 $2, r3 # Alignment uses up 2 bytes - bgequ 1f # Jump if we have at least two bytes - addl2 $2, r3 # Deal with it if we have not already + bbc $1, %r2, 2f # Check is bit 1 , jump if clear + subl2 $2, %r3 # Alignment uses up 2 bytes + bgequ 1f # Jump if we have at least two bytes + addl2 $2, %r3 # Deal with it if we have not already jmp 6f 1: /* If here copy halfword, and checksum it, */ - addw2 (r2), r0 # Add the half double-word to r0 - adwc $0, r0 # Carry - addl2 $2, r2 # move pointer on two bytes + addw2 (%r2), %r0 # Add the half double-word to r0 + adwc $0, %r0 # Carry + addl2 $2, %r2 # move pointer on two bytes 2: /* Get 32-bit word count and do 3 checksum on it */ /* if 0 count jump over it */ -# divl3 $32, r3, r5 - ashl $-5, r3, r5 +# divl3 $32, %r3, %r5 + ashl $-5, %r3, %r5 beqlu 4f -3: addl2 (r2), r0 # Checksum 32 bytes - adwc 4(r2), r0 - adwc 8(r2), r0 - adwc 12(r2), r0 - adwc 16(r2), r0 - adwc 20(r2), r0 - adwc 24(r2), r0 - adwc 28(r2), r0 - adwc $0, r0 - addl2 $32, r2 - sobgtr r5,3b +3: addl2 (%r2), %r0 # Checksum 32 bytes + adwc 4(%r2), %r0 + adwc 8(%r2), %r0 + adwc 12(%r2), %r0 + adwc 16(%r2), %r0 + adwc 20(%r2), %r0 + adwc 24(%r2), %r0 + adwc 28(%r2), %r0 + adwc $0, %r0 + addl2 $32, %r2 + sobgtr %r5,3b /* jump not equal back to 3b*/ -4: bicl3 $0xFFFFFFE3, r3, r5 /* D.A. My method for an AND, AND r3 with 0x1C (00011100) */ +4: bicl3 $0xFFFFFFE3, %r3, %r5 /* D.A. My method for an AND, AND r3 with 0x1C (00011100) */ /* this put in r5 a value of 4, 8, 12, 16, 20, 24, 28 bytes */ beqlu 6f /* rotate r5 by -2 gives 1, 2, 3, 4, 5, 6, 7 */ - rotl $-2, r5, r5 -5: addl2 (r2), r0 /* Add in long from R2 */ - adwc $0, r0 /* Add in carry */ - addl2 $4, r2 /* move r2 pointer along 4 bytes */ - sobgtr r5, 5b /* jump to 5: if r5 is > 0 */ -6: bicl3 $0xFFFFFFFC, r3, r5 /* AND either 1 or 2 into r5 */ + rotl $-2, %r5, %r5 +5: addl2 (%r2), %r0 /* Add in long from R2 */ + adwc $0, %r0 /* Add in carry */ + addl2 $4, %r2 /* move r2 pointer along 4 bytes */ + sobgtr %r5, 5b /* jump to 5: if r5 is > 0 */ +6: bicl3 $0xFFFFFFFC, %r3, %r5 /* AND either 1 or 2 into r5 */ beqlu 9f /* if no further bytes we are finished */ - cmpl $2, r5 /* compare what we have left with 2 */ + cmpl $2, %r5 /* compare what we have left with 2 */ blssu 7f /* if 2 or greater go to 7f */ - movw (r2), r3 /* move a word into r3 */ - addl2 $2, r2 /* move r2 on two bytes */ - cmpl $2, r5 + movw (%r2), %r3 /* move a word into r3 */ + addl2 $2, %r2 /* move r2 on two bytes */ + cmpl $2, %r5 beqlu 8f /* if what are we checking here?? */ - rotl $16, r3, r3 /* rotate r3 by a half word. */ - bicl2 $0xFFFF, r3 /* AND off bottom half */ -7: addb2 (r2), r3 /* ADD Byte from R2 to R3 */ -8: addl2 r3, r0 /* Add Long R3 */ - adwc $0, r0 /* Add in any carry */ -9: ret \ No newline at end of file + rotl $16, %r3, %r3 /* rotate r3 by a half word. */ + bicl2 $0xFFFF, %r3 /* AND off bottom half */ +7: addb2 (%r2), %r3 /* ADD Byte from R2 to R3 */ +8: addl2 %r3, %r0 /* Add Long R3 */ + adwc $0, %r0 /* Add in any carry */ +9: ret Index: clear_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/lib/clear_user.S,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- clear_user.S 16 Feb 2003 13:17:20 -0000 1.5 +++ clear_user.S 15 Jun 2003 22:33:56 -0000 1.6 @@ -23,11 +23,11 @@ .text ENTRY(__clear_user) .word 0x3e - movl 4(ap), r1 /* r1 now has addr */ - movl 8(ap), r0 /* r0 has size */ + movl 4(%ap), %r1 /* r1 now has addr */ + movl 8(%ap), %r0 /* r0 has size */ beql 2f -1: EX(movb, $0, (r1)+, fault) - sobgtr r0, 1b +1: EX(movb, $0, (%r1)+, fault) + sobgtr %r0, 1b 2: ret .section .fixup, "ax" Index: copy_tofrom_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/lib/copy_tofrom_user.S,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- copy_tofrom_user.S 16 Feb 2003 13:17:20 -0000 1.5 +++ copy_tofrom_user.S 15 Jun 2003 22:33:56 -0000 1.6 @@ -22,13 +22,13 @@ .text ENTRY(__copy_tofrom_user) .word 0x3e - movl 4(ap), r2 /* to in r2 */ - movl 8(ap), r3 /* from in r3 */ - movl 12(ap), r0 /* size in r0 */ + movl 4(%ap), %r2 /* to in r2 */ + movl 8(%ap), %r3 /* from in r3 */ + movl 12(%ap), %r0 /* size in r0 */ -1: EX(movb, (r3)+, r4, l_fixup) - EX(movb, r4, (r2)+, s_fixup) - sobgtr r0, 1b +1: EX(movb, (%r3)+, %r4, l_fixup) + EX(movb, %r4, (%r2)+, s_fixup) + sobgtr %r0, 1b ret .section .fixup,"ax" .align 4 Index: string.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/lib/string.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- string.c 20 May 2002 00:33:33 -0000 1.4 +++ string.c 15 Jun 2003 22:33:56 -0000 1.5 @@ -207,17 +207,17 @@ void * memset(void * s, int c , __kernel_size_t count) { asm ( - " movl %2, r6 \n" /* R6 holds bytes left */ - " movl %0, r3 \n" /* dest in R3 */ - " movl $0xffff, r7 \n" /* R7 always holds 65535 */ + " movl %2, %%r6 \n" /* R6 holds bytes left */ + " movl %0, %%r3 \n" /* dest in R3 */ + " movl $0xffff, %%r7 \n" /* R7 always holds 65535 */ " next_chunk: \n" - " cmpl r6, r7 \n" + " cmpl %%r6, %%r7 \n" " blequ last_chunk \n" /* < 65535 bytes left */ - " movc5 $0, 0, %1, r7, (r3) \n" /* MOVC5 updates R3 for us */ - " subl2 r7, r6 \n" + " movc5 $0, 0, %1, %%r7, (%%r3) \n" /* MOVC5 updates R3 for us */ + " subl2 %%r7, %%r6 \n" " brb next_chunk \n" "last_chunk: \n" - " movc5 $0, 0, %1, r6, (r3) " + " movc5 $0, 0, %1, %%r6, (%%r3) " : /* no outputs */ : "g" (s), "g" (c), "g" (count) : "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7"); Index: strncpy_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/lib/strncpy_user.S,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- strncpy_user.S 3 Mar 2003 00:48:53 -0000 1.6 +++ strncpy_user.S 15 Jun 2003 22:33:56 -0000 1.7 @@ -23,19 +23,19 @@ .text ENTRY(__strncpy_from_user) .word 0x3e - movl 4(ap), r2 /* r2 now has dst */ - movl 8(ap), r3 /* r3 now has src */ - movl 12(ap), r0 /* r0 has count */ - movl r0, r1 /* keep count in r1 */ + movl 4(%ap), %r2 /* r2 now has dst */ + movl 8(%ap), %r3 /* r3 now has src */ + movl 12(%ap), %r0 /* r0 has count */ + movl %r0, %r1 /* keep count in r1 */ beql 2f -1: EX(movb, (r3)+, r4, fault) - movb r4, (r2)+ - cmpb $0, r4 +1: EX(movb, (%r3)+, %r4, fault) + movb %r4, (%r2)+ + cmpb $0, %r4 beql 2f - sobgtr r1, 1b -2: subl2 r1, r0 + sobgtr %r1, 1b +2: subl2 %r1, %r0 ret .section .fixup, "ax" -fault: movl $-EFAULT, r0 +fault: movl $-EFAULT, %r0 ret .previous Index: strnlen_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/lib/strnlen_user.S,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- strnlen_user.S 16 Feb 2003 13:17:20 -0000 1.5 +++ strnlen_user.S 15 Jun 2003 22:33:56 -0000 1.6 @@ -22,18 +22,18 @@ .text ENTRY(__strnlen_user) .word 0x3e - movl 4(ap), r0 - movl 8(ap), r1 - movl r0, r2 + movl 4(%ap), %r0 + movl 8(%ap), %r1 + movl %r0, %r2 -1: EX(movb, (r0)+, r3, fault) - cmpb $0, r3 +1: EX(movb, (%r0)+, %r3, fault) + cmpb $0, %r3 beql 2f - sobgtr r1, 1b - incl r0 -2: subl2 r2, r0 + sobgtr %r1, 1b + incl %r0 +2: subl2 %r2, %r0 ret .section .fixup,"ax" -fault: movl $0, r0 +fault: movl $0, %r0 ret |
From: Kenn H. <ke...@us...> - 2003-06-14 18:22:55
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax In directory sc8-pr-cvs1:/tmp/cvs-serv7863 Modified Files: Makefile Log Message: Allow DEFAULT_CMDLINE to be passed from make command line Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/Makefile,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Makefile 11 May 2003 17:35:15 -0000 1.19 +++ Makefile 14 Jun 2003 18:22:52 -0000 1.20 @@ -37,7 +37,7 @@ TOOLSDIR := $(TOPDIR)/arch/vax/boot/tools MKBOOTBLK := $(TOOLSDIR)/mkbootblk -DEFAULT_CMDLINE := "root=/dev/nfs nfsroot=/home/disk_vax/vaxroot ip=bootp rw debug" +DEFAULT_CMDLINE := root=/dev/nfs nfsroot=/home/disk_vax/vaxroot ip=bootp rw debug SETCMDLINE := $(TOOLSDIR)/setcmdline SHOWCMDLINE := $(TOOLSDIR)/showcmdline @@ -72,7 +72,7 @@ vmlinux.SYS: vmlinux.bin TOOLS dd if=/dev/zero bs=512 count=1 of=$@ 2>/dev/null cat $< >> $@ - $(SETCMDLINE) $@ $(DEFAULT_CMDLINE) + $(SETCMDLINE) $@ "$(DEFAULT_CMDLINE)" vmlinux.dsk: vmlinux.bin TOOLS $(MKBOOTBLK) $< > $@ |
From: Dave A. <ai...@us...> - 2003-06-10 03:13:30
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/scsi/aacraid In directory sc8-pr-cvs1:/tmp/cvs-serv13727/aacraid Log Message: Directory /cvsroot/linux-vax/kernel-2.4/drivers/scsi/aacraid added to the repository |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipv6/netfilter In directory sc8-pr-cvs1:/tmp/cvs-serv14646/net/ipv6/netfilter Added Files: ip6_queue.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * This is a module which is used for queueing IPv6 packets and * communicating with userspace via netlink. * * (C) 2001 Fernando Anton, this code is GPL. * IPv64 Project - Work based in IPv64 draft by Arturo Azcorra. * Universidad Carlos III de Madrid - Leganes (Madrid) - Spain * Universidad Politecnica de Alcala de Henares - Alcala de H. (Madrid) - Spain * email: fa...@it... * * 2001-11-06: First try. Working with ip_queue.c for IPv4 and trying * to adapt it to IPv6 * HEAVILY based in ipqueue.c by James Morris. It's just * a little modified version of it, so he's nearly the * real coder of this. * Few changes needed, mainly the hard_routing code and * the netlink socket protocol (we're NETLINK_IP6_FW). * */ #include <linux/module.h> #include <linux/skbuff.h> #include <linux/init.h> #include <linux/ipv6.h> #include <linux/notifier.h> #include <linux/netdevice.h> #include <linux/netfilter.h> #include <linux/netlink.h> #include <linux/spinlock.h> #include <linux/rtnetlink.h> #include <linux/sysctl.h> #include <linux/proc_fs.h> #include <net/sock.h> #include <net/ipv6.h> #include <net/ip6_route.h> /* We're still usign the following structs. No need to change them: */ /* ipq_packet_msg */ /* ipq_mode_msg */ /* ipq_verdict_msg */ /* ipq_peer_msg */ #include <linux/netfilter_ipv4/ip_queue.h> #include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv6/ip6_tables.h> #define IPQ_QMAX_DEFAULT 1024 #define IPQ_PROC_FS_NAME "ip6_queue" #define NET_IPQ_QMAX 2088 #define NET_IPQ_QMAX_NAME "ip6_queue_maxlen" typedef struct ip6q_rt_info { struct in6_addr daddr; struct in6_addr saddr; } ip6q_rt_info_t; typedef struct ip6q_queue_element { struct list_head list; /* Links element into queue */ int verdict; /* Current verdict */ struct nf_info *info; /* Extra info from netfilter */ struct sk_buff *skb; /* Packet inside */ ip6q_rt_info_t rt_info; /* May need post-mangle routing */ } ip6q_queue_element_t; typedef int (*ip6q_send_cb_t)(ip6q_queue_element_t *e); typedef struct ip6q_peer { pid_t pid; /* PID of userland peer */ unsigned char died; /* We think the peer died */ unsigned char copy_mode; /* Copy packet as well as metadata? */ size_t copy_range; /* Range past metadata to copy */ ip6q_send_cb_t send; /* Callback for sending data to peer */ } ip6q_peer_t; typedef struct ip6q_queue { int len; /* Current queue len */ int *maxlen; /* Maximum queue len, via sysctl */ unsigned char flushing; /* If queue is being flushed */ unsigned char terminate; /* If the queue is being terminated */ struct list_head list; /* Head of packet queue */ spinlock_t lock; /* Queue spinlock */ ip6q_peer_t peer; /* Userland peer */ } ip6q_queue_t; /**************************************************************************** * * Packet queue * ****************************************************************************/ /* Dequeue a packet if matched by cmp, or the next available if cmp is NULL */ static ip6q_queue_element_t * ip6q_dequeue(ip6q_queue_t *q, int (*cmp)(ip6q_queue_element_t *, unsigned long), unsigned long data) { struct list_head *i; spin_lock_bh(&q->lock); for (i = q->list.prev; i != &q->list; i = i->prev) { ip6q_queue_element_t *e = (ip6q_queue_element_t *)i; if (!cmp || cmp(e, data)) { list_del(&e->list); q->len--; spin_unlock_bh(&q->lock); return e; } } spin_unlock_bh(&q->lock); return NULL; } /* Flush all packets */ static void ip6q_flush(ip6q_queue_t *q) { ip6q_queue_element_t *e; spin_lock_bh(&q->lock); q->flushing = 1; spin_unlock_bh(&q->lock); while ((e = ip6q_dequeue(q, NULL, 0))) { e->verdict = NF_DROP; nf_reinject(e->skb, e->info, e->verdict); kfree(e); } spin_lock_bh(&q->lock); q->flushing = 0; spin_unlock_bh(&q->lock); } static ip6q_queue_t *ip6q_create_queue(nf_queue_outfn_t outfn, ip6q_send_cb_t send_cb, int *errp, int *sysctl_qmax) { int status; ip6q_queue_t *q; *errp = 0; q = kmalloc(sizeof(ip6q_queue_t), GFP_KERNEL); if (q == NULL) { *errp = -ENOMEM; return NULL; } q->peer.pid = 0; q->peer.died = 0; q->peer.copy_mode = IPQ_COPY_NONE; q->peer.copy_range = 0; q->peer.send = send_cb; q->len = 0; q->maxlen = sysctl_qmax; q->flushing = 0; q->terminate = 0; INIT_LIST_HEAD(&q->list); spin_lock_init(&q->lock); status = nf_register_queue_handler(PF_INET6, outfn, q); if (status < 0) { *errp = -EBUSY; kfree(q); return NULL; } return q; } static int ip6q_enqueue(ip6q_queue_t *q, struct sk_buff *skb, struct nf_info *info) { ip6q_queue_element_t *e; int status; e = kmalloc(sizeof(*e), GFP_ATOMIC); if (e == NULL) { printk(KERN_ERR "ip6_queue: OOM in enqueue\n"); return -ENOMEM; } e->verdict = NF_DROP; e->info = info; e->skb = skb; if (e->info->hook == NF_IP_LOCAL_OUT) { struct ipv6hdr *iph = skb->nh.ipv6h; e->rt_info.daddr = iph->daddr; e->rt_info.saddr = iph->saddr; } spin_lock_bh(&q->lock); if (q->len >= *q->maxlen) { spin_unlock_bh(&q->lock); if (net_ratelimit()) printk(KERN_WARNING "ip6_queue: full at %d entries, " "dropping packet(s).\n", q->len); goto free_drop; } if (q->flushing || q->peer.copy_mode == IPQ_COPY_NONE || q->peer.pid == 0 || q->peer.died || q->terminate) { spin_unlock_bh(&q->lock); goto free_drop; } status = q->peer.send(e); if (status > 0) { list_add(&e->list, &q->list); q->len++; spin_unlock_bh(&q->lock); return status; } spin_unlock_bh(&q->lock); if (status == -ECONNREFUSED) { printk(KERN_INFO "ip6_queue: peer %d died, " "resetting state and flushing queue\n", q->peer.pid); q->peer.died = 1; q->peer.pid = 0; q->peer.copy_mode = IPQ_COPY_NONE; q->peer.copy_range = 0; ip6q_flush(q); } free_drop: kfree(e); return -EBUSY; } static void ip6q_destroy_queue(ip6q_queue_t *q) { nf_unregister_queue_handler(PF_INET6); spin_lock_bh(&q->lock); q->terminate = 1; spin_unlock_bh(&q->lock); ip6q_flush(q); kfree(q); } /* * Taken from net/ipv6/ip6_output.c * * We should use the one there, but is defined static * so we put this just here and let the things as * they are now. * * If that one is modified, this one should be modified too. */ static int route6_me_harder(struct sk_buff *skb) { struct ipv6hdr *iph = skb->nh.ipv6h; struct dst_entry *dst; struct flowi fl; fl.proto = iph->nexthdr; fl.fl6_dst = &iph->daddr; fl.fl6_src = &iph->saddr; fl.oif = skb->sk ? skb->sk->bound_dev_if : 0; fl.fl6_flowlabel = 0; fl.uli_u.ports.dport = 0; fl.uli_u.ports.sport = 0; dst = ip6_route_output(skb->sk, &fl); if (dst->error) { if (net_ratelimit()) printk(KERN_DEBUG "route6_me_harder: No more route.\n"); return -EINVAL; } /* Drop old route. */ dst_release(skb->dst); skb->dst = dst; return 0; } static int ip6q_mangle_ipv6(ipq_verdict_msg_t *v, ip6q_queue_element_t *e) { int diff; struct ipv6hdr *user_iph = (struct ipv6hdr *)v->payload; if (v->data_len < sizeof(*user_iph)) return 0; diff = v->data_len - e->skb->len; if (diff < 0) skb_trim(e->skb, v->data_len); else if (diff > 0) { if (v->data_len > 0xFFFF) return -EINVAL; if (diff > skb_tailroom(e->skb)) { struct sk_buff *newskb; newskb = skb_copy_expand(e->skb, skb_headroom(e->skb), diff, GFP_ATOMIC); if (newskb == NULL) { printk(KERN_WARNING "ip6_queue: OOM " "in mangle, dropping packet\n"); return -ENOMEM; } if (e->skb->sk) skb_set_owner_w(newskb, e->skb->sk); kfree_skb(e->skb); e->skb = newskb; } skb_put(e->skb, diff); } memcpy(e->skb->data, v->payload, v->data_len); e->skb->nfcache |= NFC_ALTERED; /* * Extra routing may needed on local out, as the QUEUE target never * returns control to the table. * Not a nice way to cmp, but works */ if (e->info->hook == NF_IP_LOCAL_OUT) { struct ipv6hdr *iph = e->skb->nh.ipv6h; if (!( iph->daddr.in6_u.u6_addr32[0] == e->rt_info.daddr.in6_u.u6_addr32[0] && iph->daddr.in6_u.u6_addr32[1] == e->rt_info.daddr.in6_u.u6_addr32[1] && iph->daddr.in6_u.u6_addr32[2] == e->rt_info.daddr.in6_u.u6_addr32[2] && iph->daddr.in6_u.u6_addr32[3] == e->rt_info.daddr.in6_u.u6_addr32[3] && iph->saddr.in6_u.u6_addr32[0] == e->rt_info.saddr.in6_u.u6_addr32[0] && iph->saddr.in6_u.u6_addr32[1] == e->rt_info.saddr.in6_u.u6_addr32[1] && iph->saddr.in6_u.u6_addr32[2] == e->rt_info.saddr.in6_u.u6_addr32[2] && iph->saddr.in6_u.u6_addr32[3] == e->rt_info.saddr.in6_u.u6_addr32[3])) return route6_me_harder(e->skb); } return 0; } static inline int id_cmp(ip6q_queue_element_t *e, unsigned long id) { return (id == (unsigned long )e); } static int ip6q_set_verdict(ip6q_queue_t *q, ipq_verdict_msg_t *v, unsigned int len) { ip6q_queue_element_t *e; if (v->value > NF_MAX_VERDICT) return -EINVAL; e = ip6q_dequeue(q, id_cmp, v->id); if (e == NULL) return -ENOENT; else { e->verdict = v->value; if (v->data_len && v->data_len == len) if (ip6q_mangle_ipv6(v, e) < 0) e->verdict = NF_DROP; nf_reinject(e->skb, e->info, e->verdict); kfree(e); return 0; } } static int ip6q_receive_peer(ip6q_queue_t* q, ipq_peer_msg_t *m, unsigned char type, unsigned int len) { int status = 0; int busy; spin_lock_bh(&q->lock); busy = (q->terminate || q->flushing); spin_unlock_bh(&q->lock); if (busy) return -EBUSY; if (len < sizeof(ipq_peer_msg_t)) return -EINVAL; switch (type) { case IPQM_MODE: switch (m->msg.mode.value) { case IPQ_COPY_META: q->peer.copy_mode = IPQ_COPY_META; q->peer.copy_range = 0; break; case IPQ_COPY_PACKET: q->peer.copy_mode = IPQ_COPY_PACKET; q->peer.copy_range = m->msg.mode.range; if (q->peer.copy_range > 0xFFFF) q->peer.copy_range = 0xFFFF; break; default: status = -EINVAL; } break; case IPQM_VERDICT: if (m->msg.verdict.value > NF_MAX_VERDICT) status = -EINVAL; else status = ip6q_set_verdict(q, &m->msg.verdict, len - sizeof(*m)); break; default: status = -EINVAL; } return status; } static inline int dev_cmp(ip6q_queue_element_t *e, unsigned long ifindex) { if (e->info->indev) if (e->info->indev->ifindex == ifindex) return 1; if (e->info->outdev) if (e->info->outdev->ifindex == ifindex) return 1; return 0; } /* Drop any queued packets associated with device ifindex */ static void ip6q_dev_drop(ip6q_queue_t *q, int ifindex) { ip6q_queue_element_t *e; while ((e = ip6q_dequeue(q, dev_cmp, ifindex))) { e->verdict = NF_DROP; nf_reinject(e->skb, e->info, e->verdict); kfree(e); } } /**************************************************************************** * * Netfilter interface * ****************************************************************************/ /* * Packets arrive here from netfilter for queuing to userspace. * All of them must be fed back via nf_reinject() or Alexey will kill Rusty. */ static int netfilter6_receive(struct sk_buff *skb, struct nf_info *info, void *data) { return ip6q_enqueue((ip6q_queue_t *)data, skb, info); } /**************************************************************************** * * Netlink interface. * ****************************************************************************/ static struct sock *nfnl = NULL; /* This is not a static one, so we should not repeat its name */ ip6q_queue_t *nlq6 = NULL; static struct sk_buff *netlink_build_message(ip6q_queue_element_t *e, int *errp) { unsigned char *old_tail; size_t size = 0; size_t data_len = 0; struct sk_buff *skb; ipq_packet_msg_t *pm; struct nlmsghdr *nlh; switch (nlq6->peer.copy_mode) { size_t copy_range; case IPQ_COPY_META: size = NLMSG_SPACE(sizeof(*pm)); data_len = 0; break; case IPQ_COPY_PACKET: copy_range = nlq6->peer.copy_range; if (copy_range == 0 || copy_range > e->skb->len) data_len = e->skb->len; else data_len = copy_range; size = NLMSG_SPACE(sizeof(*pm) + data_len); break; case IPQ_COPY_NONE: default: *errp = -EINVAL; return NULL; } skb = alloc_skb(size, GFP_ATOMIC); if (!skb) goto nlmsg_failure; old_tail = skb->tail; nlh = NLMSG_PUT(skb, 0, 0, IPQM_PACKET, size - sizeof(*nlh)); pm = NLMSG_DATA(nlh); memset(pm, 0, sizeof(*pm)); pm->packet_id = (unsigned long )e; pm->data_len = data_len; pm->timestamp_sec = e->skb->stamp.tv_sec; pm->timestamp_usec = e->skb->stamp.tv_usec; pm->mark = e->skb->nfmark; pm->hook = e->info->hook; if (e->info->indev) strcpy(pm->indev_name, e->info->indev->name); else pm->indev_name[0] = '\0'; if (e->info->outdev) strcpy(pm->outdev_name, e->info->outdev->name); else pm->outdev_name[0] = '\0'; pm->hw_protocol = e->skb->protocol; if (e->info->indev && e->skb->dev) { pm->hw_type = e->skb->dev->type; if (e->skb->dev->hard_header_parse) pm->hw_addrlen = e->skb->dev->hard_header_parse(e->skb, pm->hw_addr); } if (data_len) memcpy(pm->payload, e->skb->data, data_len); nlh->nlmsg_len = skb->tail - old_tail; NETLINK_CB(skb).dst_groups = 0; return skb; nlmsg_failure: if (skb) kfree_skb(skb); *errp = 0; printk(KERN_ERR "ip6_queue: error creating netlink message\n"); return NULL; } static int netlink_send_peer(ip6q_queue_element_t *e) { int status = 0; struct sk_buff *skb; skb = netlink_build_message(e, &status); if (skb == NULL) return status; return netlink_unicast(nfnl, skb, nlq6->peer.pid, MSG_DONTWAIT); } #define RCV_SKB_FAIL(err) do { netlink_ack(skb, nlh, (err)); return; } while (0); static __inline__ void netlink_receive_user_skb(struct sk_buff *skb) { int status, type; struct nlmsghdr *nlh; if (skb->len < sizeof(struct nlmsghdr)) return; nlh = (struct nlmsghdr *)skb->data; if (nlh->nlmsg_len < sizeof(struct nlmsghdr) || skb->len < nlh->nlmsg_len) return; if(nlh->nlmsg_pid <= 0 || !(nlh->nlmsg_flags & NLM_F_REQUEST) || nlh->nlmsg_flags & NLM_F_MULTI) RCV_SKB_FAIL(-EINVAL); if (nlh->nlmsg_flags & MSG_TRUNC) RCV_SKB_FAIL(-ECOMM); type = nlh->nlmsg_type; if (type < NLMSG_NOOP || type >= IPQM_MAX) RCV_SKB_FAIL(-EINVAL); if (type <= IPQM_BASE) return; if(!cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) RCV_SKB_FAIL(-EPERM); if (nlq6->peer.pid && !nlq6->peer.died && (nlq6->peer.pid != nlh->nlmsg_pid)) { printk(KERN_WARNING "ip6_queue: peer pid changed from %d to " "%d, flushing queue\n", nlq6->peer.pid, nlh->nlmsg_pid); ip6q_flush(nlq6); } nlq6->peer.pid = nlh->nlmsg_pid; nlq6->peer.died = 0; status = ip6q_receive_peer(nlq6, NLMSG_DATA(nlh), type, skb->len - NLMSG_LENGTH(0)); if (status < 0) RCV_SKB_FAIL(status); if (nlh->nlmsg_flags & NLM_F_ACK) netlink_ack(skb, nlh, 0); return; } /* Note: we are only dealing with single part messages at the moment. */ static void netlink_receive_user_sk(struct sock *sk, int len) { do { struct sk_buff *skb; if (rtnl_shlock_nowait()) return; while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) { netlink_receive_user_skb(skb); kfree_skb(skb); } up(&rtnl_sem); } while (nfnl && nfnl->receive_queue.qlen); } /**************************************************************************** * * System events * ****************************************************************************/ static int receive_event(struct notifier_block *this, unsigned long event, void *ptr) { struct net_device *dev = ptr; /* Drop any packets associated with the downed device */ if (event == NETDEV_DOWN) ip6q_dev_drop(nlq6, dev->ifindex); return NOTIFY_DONE; } struct notifier_block ip6q_dev_notifier = { receive_event, NULL, 0 }; /**************************************************************************** * * Sysctl - queue tuning. * ****************************************************************************/ static int sysctl_maxlen = IPQ_QMAX_DEFAULT; static struct ctl_table_header *ip6q_sysctl_header; static ctl_table ip6q_table[] = { { NET_IPQ_QMAX, NET_IPQ_QMAX_NAME, &sysctl_maxlen, sizeof(sysctl_maxlen), 0644, NULL, proc_dointvec }, { 0 } }; static ctl_table ip6q_dir_table[] = { {NET_IPV6, "ipv6", NULL, 0, 0555, ip6q_table, 0, 0, 0, 0, 0}, { 0 } }; static ctl_table ip6q_root_table[] = { {CTL_NET, "net", NULL, 0, 0555, ip6q_dir_table, 0, 0, 0, 0, 0}, { 0 } }; /**************************************************************************** * * Procfs - debugging info. * ****************************************************************************/ static int ip6q_get_info(char *buffer, char **start, off_t offset, int length) { int len; spin_lock_bh(&nlq6->lock); len = sprintf(buffer, "Peer pid : %d\n" "Peer died : %d\n" "Peer copy mode : %d\n" "Peer copy range : %Zu\n" "Queue length : %d\n" "Queue max. length : %d\n" "Queue flushing : %d\n" "Queue terminate : %d\n", nlq6->peer.pid, nlq6->peer.died, nlq6->peer.copy_mode, nlq6->peer.copy_range, nlq6->len, *nlq6->maxlen, nlq6->flushing, nlq6->terminate); spin_unlock_bh(&nlq6->lock); *start = buffer + offset; len -= offset; if (len > length) len = length; else if (len < 0) len = 0; return len; } /**************************************************************************** * * Module stuff. * ****************************************************************************/ static int __init init(void) { int status = 0; struct proc_dir_entry *proc; /* We must create the NETLINK_IP6_FW protocol service */ nfnl = netlink_kernel_create(NETLINK_IP6_FW, netlink_receive_user_sk); if (nfnl == NULL) { printk(KERN_ERR "ip6_queue: initialisation failed: unable to " "create kernel netlink socket\n"); return -ENOMEM; } nlq6 = ip6q_create_queue(netfilter6_receive, netlink_send_peer, &status, &sysctl_maxlen); if (nlq6 == NULL) { printk(KERN_ERR "ip6_queue: initialisation failed: unable to " "create queue\n"); sock_release(nfnl->socket); return status; } /* The file will be /proc/net/ip6_queue */ proc = proc_net_create(IPQ_PROC_FS_NAME, 0, ip6q_get_info); if (proc) proc->owner = THIS_MODULE; else { ip6q_destroy_queue(nlq6); sock_release(nfnl->socket); return -ENOMEM; } register_netdevice_notifier(&ip6q_dev_notifier); ip6q_sysctl_header = register_sysctl_table(ip6q_root_table, 0); return status; } static void __exit fini(void) { unregister_sysctl_table(ip6q_sysctl_header); proc_net_remove(IPQ_PROC_FS_NAME); unregister_netdevice_notifier(&ip6q_dev_notifier); ip6q_destroy_queue(nlq6); sock_release(nfnl->socket); } MODULE_DESCRIPTION("IPv6 packet queue handler"); MODULE_LICENSE("GPL"); module_init(init); module_exit(fini); |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipv4/netfilter In directory sc8-pr-cvs1:/tmp/cvs-serv14646/net/ipv4/netfilter Added Files: ipt_ULOG.c ipt_ah.c ipt_esp.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * netfilter module for userspace packet logging daemons * * (C) 2000-2002 by Harald Welte <la...@gn...> * * 2000/09/22 ulog-cprange feature added * 2001/01/04 in-kernel queue as proposed by Sebastian Zander * <za...@fo...> * 2001/01/30 per-rule nlgroup conflicts with global queue. * nlgroup now global (sysctl) * 2001/04/19 ulog-queue reworked, now fixed buffer size specified at * module loadtime -HW * * Released under the terms of the GPL * * This module accepts two parameters: * * nlbufsiz: * The parameter specifies how big the buffer for each netlink multicast * group is. e.g. If you say nlbufsiz=8192, up to eight kb of packets will * get accumulated in the kernel until they are sent to userspace. It is * NOT possible to allocate more than 128kB, and it is strongly discouraged, * because atomically allocating 128kB inside the network rx softirq is not * reliable. Please also keep in mind that this buffer size is allocated for * each nlgroup you are using, so the total kernel memory usage increases * by that factor. * * flushtimeout: * Specify, after how many clock ticks (intel: 100 per second) the queue * should be flushed even if it is not full yet. * * ipt_ULOG.c,v 1.15 2002/01/18 21:33:19 laforge Exp */ #include <linux/module.h> #include <linux/version.h> #include <linux/config.h> #include <linux/spinlock.h> #include <linux/socket.h> #include <linux/skbuff.h> #include <linux/kernel.h> #include <linux/timer.h> #include <linux/netlink.h> #include <linux/netdevice.h> #include <linux/mm.h> #include <linux/socket.h> #include <linux/netfilter_ipv4/ip_tables.h> #include <linux/netfilter_ipv4/ipt_ULOG.h> #include <linux/netfilter_ipv4/lockhelp.h> #include <net/sock.h> MODULE_LICENSE("GPL"); #define ULOG_NL_EVENT 111 /* Harald's favorite number */ #define ULOG_MAXNLGROUPS 32 /* numer of nlgroups */ #if 0 #define DEBUGP(format, args...) printk(__FILE__ ":" __FUNCTION__ ":" \ format, ## args) #else #define DEBUGP(format, args...) #endif #define PRINTR(format, args...) do { if (net_ratelimit()) printk(format, ## args); } while (0); MODULE_AUTHOR("Harald Welte <la...@gn...>"); MODULE_DESCRIPTION("IP tables userspace logging module"); static unsigned int nlbufsiz = 4096; MODULE_PARM(nlbufsiz, "i"); MODULE_PARM_DESC(nlbufsiz, "netlink buffer size"); static unsigned int flushtimeout = 10 * HZ; MODULE_PARM(flushtimeout, "i"); MODULE_PARM_DESC(flushtimeout, "buffer flush timeout"); /* global data structures */ typedef struct { unsigned int qlen; /* number of nlmsgs' in the skb */ struct nlmsghdr *lastnlh; /* netlink header of last msg in skb */ struct sk_buff *skb; /* the pre-allocated skb */ struct timer_list timer; /* the timer function */ } ulog_buff_t; static ulog_buff_t ulog_buffers[ULOG_MAXNLGROUPS]; /* array of buffers */ static struct sock *nflognl; /* our socket */ static size_t qlen; /* current length of multipart-nlmsg */ DECLARE_LOCK(ulog_lock); /* spinlock */ /* send one ulog_buff_t to userspace */ static void ulog_send(unsigned int nlgroup) { ulog_buff_t *ub = &ulog_buffers[nlgroup]; if (timer_pending(&ub->timer)) { DEBUGP("ipt_ULOG: ulog_send: timer was pending, deleting\n"); del_timer(&ub->timer); } /* last nlmsg needs NLMSG_DONE */ if (ub->qlen > 1) ub->lastnlh->nlmsg_type = NLMSG_DONE; NETLINK_CB(ub->skb).dst_groups = nlgroup; DEBUGP("ipt_ULOG: throwing %d packets to netlink mask %u\n", ub->qlen, nlgroup); netlink_broadcast(nflognl, ub->skb, 0, nlgroup, GFP_ATOMIC); ub->qlen = 0; ub->skb = NULL; ub->lastnlh = NULL; } /* timer function to flush queue in ULOG_FLUSH_INTERVAL time */ static void ulog_timer(unsigned long data) { DEBUGP("ipt_ULOG: timer function called, calling ulog_send\n"); /* lock to protect against somebody modifying our structure * from ipt_ulog_target at the same time */ LOCK_BH(&ulog_lock); ulog_send(data); UNLOCK_BH(&ulog_lock); } static void nflog_rcv(struct sock *sk, int len) { printk("ipt_ULOG:nflog_rcv() did receive netlink message ?!?\n"); } struct sk_buff *ulog_alloc_skb(unsigned int size) { struct sk_buff *skb; /* alloc skb which should be big enough for a whole * multipart message. WARNING: has to be <= 131000 * due to slab allocator restrictions */ skb = alloc_skb(nlbufsiz, GFP_ATOMIC); if (!skb) { PRINTR("ipt_ULOG: can't alloc whole buffer %ub!\n", nlbufsiz); /* try to allocate only as much as we need for * current packet */ skb = alloc_skb(size, GFP_ATOMIC); if (!skb) PRINTR("ipt_ULOG: can't even allocate %ub\n", size); } return skb; } static unsigned int ipt_ulog_target(struct sk_buff **pskb, unsigned int hooknum, const struct net_device *in, const struct net_device *out, const void *targinfo, void *userinfo) { ulog_buff_t *ub; ulog_packet_msg_t *pm; size_t size, copy_len; struct nlmsghdr *nlh; struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo; /* calculate the size of the skb needed */ if ((loginfo->copy_range == 0) || (loginfo->copy_range > (*pskb)->len)) { copy_len = (*pskb)->len; } else { copy_len = loginfo->copy_range; } size = NLMSG_SPACE(sizeof(*pm) + copy_len); ub = &ulog_buffers[loginfo->nl_group]; LOCK_BH(&ulog_lock); if (!ub->skb) { if (!(ub->skb = ulog_alloc_skb(size))) goto alloc_failure; } else if (ub->qlen >= loginfo->qthreshold || size > skb_tailroom(ub->skb)) { /* either the queue len is too high or we don't have * enough room in nlskb left. send it to userspace. */ ulog_send(loginfo->nl_group); if (!(ub->skb = ulog_alloc_skb(size))) goto alloc_failure; } DEBUGP("ipt_ULOG: qlen %d, qthreshold %d\n", ub->qlen, loginfo->qthreshold); /* NLMSG_PUT contains a hidden goto nlmsg_failure !!! */ nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, ULOG_NL_EVENT, size - sizeof(*nlh)); ub->qlen++; pm = NLMSG_DATA(nlh); /* copy hook, prefix, timestamp, payload, etc. */ pm->data_len = copy_len; pm->timestamp_sec = (*pskb)->stamp.tv_sec; pm->timestamp_usec = (*pskb)->stamp.tv_usec; pm->mark = (*pskb)->nfmark; pm->hook = hooknum; if (loginfo->prefix[0] != '\0') strncpy(pm->prefix, loginfo->prefix, sizeof(pm->prefix)); else *(pm->prefix) = '\0'; if (in && in->hard_header_len > 0 && (*pskb)->mac.raw != (void *) (*pskb)->nh.iph && in->hard_header_len <= ULOG_MAC_LEN) { memcpy(pm->mac, (*pskb)->mac.raw, in->hard_header_len); pm->mac_len = in->hard_header_len; } if (in) strncpy(pm->indev_name, in->name, sizeof(pm->indev_name)); else pm->indev_name[0] = '\0'; if (out) strncpy(pm->outdev_name, out->name, sizeof(pm->outdev_name)); else pm->outdev_name[0] = '\0'; if (copy_len) memcpy(pm->payload, (*pskb)->data, copy_len); /* check if we are building multi-part messages */ if (ub->qlen > 1) { ub->lastnlh->nlmsg_flags |= NLM_F_MULTI; } /* if threshold is reached, send message to userspace */ if (qlen >= loginfo->qthreshold) { if (loginfo->qthreshold > 1) nlh->nlmsg_type = NLMSG_DONE; } ub->lastnlh = nlh; /* if timer isn't already running, start it */ if (!timer_pending(&ub->timer)) { ub->timer.expires = jiffies + flushtimeout; add_timer(&ub->timer); } UNLOCK_BH(&ulog_lock); return IPT_CONTINUE; nlmsg_failure: PRINTR("ipt_ULOG: error during NLMSG_PUT\n"); alloc_failure: PRINTR("ipt_ULOG: Error building netlink message\n"); UNLOCK_BH(&ulog_lock); return IPT_CONTINUE; } static int ipt_ulog_checkentry(const char *tablename, const struct ipt_entry *e, void *targinfo, unsigned int targinfosize, unsigned int hookmask) { struct ipt_ulog_info *loginfo = (struct ipt_ulog_info *) targinfo; if (targinfosize != IPT_ALIGN(sizeof(struct ipt_ulog_info))) { DEBUGP("ipt_ULOG: targinfosize %u != 0\n", targinfosize); return 0; } if (loginfo->prefix[sizeof(loginfo->prefix) - 1] != '\0') { DEBUGP("ipt_ULOG: prefix term %i\n", loginfo->prefix[sizeof(loginfo->prefix) - 1]); return 0; } if (loginfo->qthreshold > ULOG_MAX_QLEN) { DEBUGP("ipt_ULOG: queue threshold %i > MAX_QLEN\n", loginfo->qthreshold); return 0; } return 1; } static struct ipt_target ipt_ulog_reg = { {NULL, NULL}, "ULOG", ipt_ulog_target, ipt_ulog_checkentry, NULL, THIS_MODULE }; static int __init init(void) { int i; DEBUGP("ipt_ULOG: init module\n"); if (nlbufsiz >= 128*1024) { printk("Netlink buffer has to be <= 128kB\n"); return -EINVAL; } /* initialize ulog_buffers */ for (i = 0; i < ULOG_MAXNLGROUPS; i++) { memset(&ulog_buffers[i], 0, sizeof(ulog_buff_t)); init_timer(&ulog_buffers[i].timer); ulog_buffers[i].timer.function = ulog_timer; ulog_buffers[i].timer.data = i; } nflognl = netlink_kernel_create(NETLINK_NFLOG, nflog_rcv); if (!nflognl) return -ENOMEM; if (ipt_register_target(&ipt_ulog_reg) != 0) { sock_release(nflognl->socket); return -EINVAL; } return 0; } static void __exit fini(void) { DEBUGP("ipt_ULOG: cleanup_module\n"); ipt_unregister_target(&ipt_ulog_reg); sock_release(nflognl->socket); } module_init(init); module_exit(fini); --- NEW FILE --- /* Kernel module to match AH parameters. */ #include <linux/module.h> #include <linux/skbuff.h> #include <linux/netfilter_ipv4/ipt_ah.h> #include <linux/netfilter_ipv4/ip_tables.h> EXPORT_NO_SYMBOLS; MODULE_LICENSE("GPL"); #ifdef DEBUG_CONNTRACK #define duprintf(format, args...) printk(format , ## args) #else #define duprintf(format, args...) #endif struct ahhdr { __u32 spi; }; /* Returns 1 if the spi is matched by the range, 0 otherwise */ static inline int spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) { int r=0; duprintf("ah spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', min,spi,max); r=(spi >= min && spi <= max) ^ invert; duprintf(" result %s\n",r? "PASS" : "FAILED"); return r; } static int match(const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, const void *matchinfo, int offset, const void *hdr, u_int16_t datalen, int *hotdrop) { const struct ahhdr *ah = hdr; const struct ipt_ah *ahinfo = matchinfo; if (offset == 0 && datalen < sizeof(struct ahhdr)) { /* We've been asked to examine this packet, and we can't. Hence, no choice but to drop. */ duprintf("Dropping evil AH tinygram.\n"); *hotdrop = 1; return 0; } /* Must not be a fragment. */ return !offset && spi_match(ahinfo->spis[0], ahinfo->spis[1], ntohl(ah->spi), !!(ahinfo->invflags & IPT_AH_INV_SPI)); } /* Called when user tries to insert an entry of this type. */ static int checkentry(const char *tablename, const struct ipt_ip *ip, void *matchinfo, unsigned int matchinfosize, unsigned int hook_mask) { const struct ipt_ah *ahinfo = matchinfo; /* Must specify proto == AH, and no unknown invflags */ if (ip->proto != IPPROTO_AH || (ip->invflags & IPT_INV_PROTO)) { duprintf("ipt_ah: Protocol %u != %u\n", ip->proto, IPPROTO_AH); return 0; } if (matchinfosize != IPT_ALIGN(sizeof(struct ipt_ah))) { duprintf("ipt_ah: matchsize %u != %u\n", matchinfosize, IPT_ALIGN(sizeof(struct ipt_ah))); return 0; } if (ahinfo->invflags & ~IPT_AH_INV_MASK) { duprintf("ipt_ah: unknown flags %X\n", ahinfo->invflags); return 0; } return 1; } static struct ipt_match ah_match = { { NULL, NULL }, "ah", &match, &checkentry, NULL, THIS_MODULE }; int __init init(void) { return ipt_register_match(&ah_match); } void __exit cleanup(void) { ipt_unregister_match(&ah_match); } module_init(init); module_exit(cleanup); --- NEW FILE --- /* Kernel module to match ESP parameters. */ #include <linux/module.h> #include <linux/skbuff.h> #include <linux/netfilter_ipv4/ipt_esp.h> #include <linux/netfilter_ipv4/ip_tables.h> EXPORT_NO_SYMBOLS; MODULE_LICENSE("GPL"); #ifdef DEBUG_CONNTRACK #define duprintf(format, args...) printk(format , ## args) #else #define duprintf(format, args...) #endif struct esphdr { __u32 spi; }; /* Returns 1 if the spi is matched by the range, 0 otherwise */ static inline int spi_match(u_int32_t min, u_int32_t max, u_int32_t spi, int invert) { int r=0; duprintf("esp spi_match:%c 0x%x <= 0x%x <= 0x%x",invert? '!':' ', min,spi,max); r=(spi >= min && spi <= max) ^ invert; duprintf(" result %s\n",r? "PASS" : "FAILED"); return r; } static int match(const struct sk_buff *skb, const struct net_device *in, const struct net_device *out, const void *matchinfo, int offset, const void *hdr, u_int16_t datalen, int *hotdrop) { const struct esphdr *esp = hdr; const struct ipt_esp *espinfo = matchinfo; if (offset == 0 && datalen < sizeof(struct esphdr)) { /* We've been asked to examine this packet, and we can't. Hence, no choice but to drop. */ duprintf("Dropping evil ESP tinygram.\n"); *hotdrop = 1; return 0; } /* Must not be a fragment. */ return !offset && spi_match(espinfo->spis[0], espinfo->spis[1], ntohl(esp->spi), !!(espinfo->invflags & IPT_ESP_INV_SPI)); } /* Called when user tries to insert an entry of this type. */ static int checkentry(const char *tablename, const struct ipt_ip *ip, void *matchinfo, unsigned int matchinfosize, unsigned int hook_mask) { const struct ipt_esp *espinfo = matchinfo; /* Must specify proto == ESP, and no unknown invflags */ if (ip->proto != IPPROTO_ESP || (ip->invflags & IPT_INV_PROTO)) { duprintf("ipt_esp: Protocol %u != %u\n", ip->proto, IPPROTO_ESP); return 0; } if (matchinfosize != IPT_ALIGN(sizeof(struct ipt_esp))) { duprintf("ipt_esp: matchsize %u != %u\n", matchinfosize, IPT_ALIGN(sizeof(struct ipt_esp))); return 0; } if (espinfo->invflags & ~IPT_ESP_INV_MASK) { duprintf("ipt_esp: unknown flags %X\n", espinfo->invflags); return 0; } return 1; } static struct ipt_match esp_match = { { NULL, NULL }, "esp", &match, &checkentry, NULL, THIS_MODULE }; static int __init init(void) { return ipt_register_match(&esp_match); } static void __exit cleanup(void) { ipt_unregister_match(&esp_match); } module_init(init); module_exit(cleanup); |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/include/linux/netfilter_ipv4 In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/linux/netfilter_ipv4 Added Files: ipt_ULOG.h ipt_ah.h ipt_esp.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* Header file for IP tables userspace logging, Version 1.8 * * (C) 2000-2002 by Harald Welte <la...@gn...> * * Distributed under the terms of GNU GPL */ #ifndef _IPT_ULOG_H #define _IPT_ULOG_H #ifndef NETLINK_NFLOG #define NETLINK_NFLOG 5 #endif #define ULOG_MAC_LEN 80 #define ULOG_PREFIX_LEN 32 #define ULOG_MAX_QLEN 50 /* Why 50? Well... there is a limit imposed by the slab cache 131000 * bytes. So the multipart netlink-message has to be < 131000 bytes. * Assuming a standard ethernet-mtu of 1500, we could define this up * to 80... but even 50 seems to be big enough. */ /* private data structure for each rule with a ULOG target */ struct ipt_ulog_info { unsigned int nl_group; size_t copy_range; size_t qthreshold; char prefix[ULOG_PREFIX_LEN]; }; /* Format of the ULOG packets passed through netlink */ typedef struct ulog_packet_msg { unsigned long mark; long timestamp_sec; long timestamp_usec; unsigned int hook; char indev_name[IFNAMSIZ]; char outdev_name[IFNAMSIZ]; size_t data_len; char prefix[ULOG_PREFIX_LEN]; unsigned char mac_len; unsigned char mac[ULOG_MAC_LEN]; unsigned char payload[0]; } ulog_packet_msg_t; #endif /*_IPT_ULOG_H*/ --- NEW FILE --- #ifndef _IPT_AH_H #define _IPT_AH_H struct ipt_ah { u_int32_t spis[2]; /* Security Parameter Index */ u_int8_t invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ipt_ah. */ #define IPT_AH_INV_SPI 0x01 /* Invert the sense of spi. */ #define IPT_AH_INV_MASK 0x01 /* All possible flags. */ #endif /*_IPT_AH_H*/ --- NEW FILE --- #ifndef _IPT_ESP_H #define _IPT_ESP_H struct ipt_esp { u_int32_t spis[2]; /* Security Parameter Index */ u_int8_t invflags; /* Inverse flags */ }; /* Values for "invflags" field in struct ipt_esp. */ #define IPT_ESP_INV_SPI 0x01 /* Invert the sense of spi. */ #define IPT_ESP_INV_MASK 0x01 /* All possible flags. */ #endif /*_IPT_ESP_H*/ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:17
|
Update of /cvsroot/linux-vax/kernel-2.4/net/ipv4 In directory sc8-pr-cvs1:/tmp/cvs-serv14646/net/ipv4 Added Files: tcp_diag.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * tcp_diag.c Module for monitoring TCP sockets. * * Version: $Id: tcp_diag.c,v 1.1 2003/06/10 03:08:13 airlied Exp $ * * Authors: Alexey Kuznetsov, <ku...@ms...> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/fcntl.h> #include <linux/random.h> #include <linux/cache.h> #include <linux/init.h> #include <net/icmp.h> #include <net/tcp.h> #include <net/ipv6.h> #include <net/inet_common.h> #include <linux/inet.h> #include <linux/stddef.h> #include <linux/tcp_diag.h> static struct sock *tcpnl; #define TCPDIAG_PUT(skb, attrtype, attrlen) \ ({ int rtalen = RTA_LENGTH(attrlen); \ struct rtattr *rta; \ if (skb_tailroom(skb) < RTA_ALIGN(rtalen)) goto nlmsg_failure; \ rta = (void*)__skb_put(skb, RTA_ALIGN(rtalen)); \ rta->rta_type = attrtype; \ rta->rta_len = rtalen; \ RTA_DATA(rta); }) static int tcpdiag_fill(struct sk_buff *skb, struct sock *sk, int ext, u32 pid, u32 seq) { struct tcp_opt *tp = &sk->tp_pinfo.af_tcp; struct tcpdiagmsg *r; struct nlmsghdr *nlh; struct tcp_info *info = NULL; struct tcpdiag_meminfo *minfo = NULL; unsigned char *b = skb->tail; nlh = NLMSG_PUT(skb, pid, seq, TCPDIAG_GETSOCK, sizeof(*r)); r = NLMSG_DATA(nlh); if (sk->state != TCP_TIME_WAIT) { if (ext & (1<<(TCPDIAG_MEMINFO-1))) minfo = TCPDIAG_PUT(skb, TCPDIAG_MEMINFO, sizeof(*minfo)); if (ext & (1<<(TCPDIAG_INFO-1))) info = TCPDIAG_PUT(skb, TCPDIAG_INFO, sizeof(*info)); } r->tcpdiag_family = sk->family; r->tcpdiag_state = sk->state; r->tcpdiag_timer = 0; r->tcpdiag_retrans = 0; r->id.tcpdiag_sport = sk->sport; r->id.tcpdiag_dport = sk->dport; r->id.tcpdiag_src[0] = sk->rcv_saddr; r->id.tcpdiag_dst[0] = sk->daddr; r->id.tcpdiag_if = sk->bound_dev_if; *((struct sock **)&r->id.tcpdiag_cookie) = sk; if (r->tcpdiag_state == TCP_TIME_WAIT) { struct tcp_tw_bucket *tw = (struct tcp_tw_bucket*)sk; long tmo = tw->ttd - jiffies; if (tmo < 0) tmo = 0; r->tcpdiag_state = tw->substate; r->tcpdiag_timer = 3; r->tcpdiag_expires = (tmo*1000+HZ-1)/HZ; r->tcpdiag_rqueue = 0; r->tcpdiag_wqueue = 0; r->tcpdiag_uid = 0; r->tcpdiag_inode = 0; #ifdef CONFIG_IPV6 if (r->tcpdiag_family == AF_INET6) { memcpy(r->id.tcpdiag_src, &tw->v6_rcv_saddr, 16); memcpy(r->id.tcpdiag_dst, &tw->v6_daddr, 16); } #endif nlh->nlmsg_len = skb->tail - b; return skb->len; } #ifdef CONFIG_IPV6 if (r->tcpdiag_family == AF_INET6) { memcpy(r->id.tcpdiag_src, &sk->net_pinfo.af_inet6.rcv_saddr, 16); memcpy(r->id.tcpdiag_dst, &sk->net_pinfo.af_inet6.daddr, 16); } #endif #define EXPIRES_IN_MS(tmo) ((tmo-jiffies)*1000+HZ-1)/HZ if (tp->pending == TCP_TIME_RETRANS) { r->tcpdiag_timer = 1; r->tcpdiag_retrans = tp->retransmits; r->tcpdiag_expires = EXPIRES_IN_MS(tp->timeout); } else if (tp->pending == TCP_TIME_PROBE0) { r->tcpdiag_timer = 4; r->tcpdiag_retrans = tp->probes_out; r->tcpdiag_expires = EXPIRES_IN_MS(tp->timeout); } else if (timer_pending(&sk->timer)) { r->tcpdiag_timer = 2; r->tcpdiag_retrans = tp->probes_out; r->tcpdiag_expires = EXPIRES_IN_MS(sk->timer.expires); } else { r->tcpdiag_timer = 0; r->tcpdiag_expires = 0; } #undef EXPIRES_IN_MS r->tcpdiag_rqueue = tp->rcv_nxt - tp->copied_seq; r->tcpdiag_wqueue = tp->write_seq - tp->snd_una; r->tcpdiag_uid = sock_i_uid(sk); r->tcpdiag_inode = sock_i_ino(sk); if (minfo) { minfo->tcpdiag_rmem = atomic_read(&sk->rmem_alloc); minfo->tcpdiag_wmem = sk->wmem_queued; minfo->tcpdiag_fmem = sk->forward_alloc; minfo->tcpdiag_tmem = atomic_read(&sk->wmem_alloc); } if (info) { u32 now = tcp_time_stamp; info->tcpi_state = sk->state; info->tcpi_ca_state = tp->ca_state; info->tcpi_retransmits = tp->retransmits; info->tcpi_probes = tp->probes_out; info->tcpi_backoff = tp->backoff; info->tcpi_options = 0; if (tp->tstamp_ok) info->tcpi_options |= TCPI_OPT_TIMESTAMPS; if (tp->sack_ok) info->tcpi_options |= TCPI_OPT_SACK; if (tp->wscale_ok) { info->tcpi_options |= TCPI_OPT_WSCALE; info->tcpi_snd_wscale = tp->snd_wscale; info->tcpi_rcv_wscale = tp->rcv_wscale; } else { info->tcpi_snd_wscale = 0; info->tcpi_rcv_wscale = 0; } #ifdef CONFIG_INET_ECN if (tp->ecn_flags&TCP_ECN_OK) info->tcpi_options |= TCPI_OPT_ECN; #endif info->tcpi_rto = (1000000*tp->rto)/HZ; info->tcpi_ato = (1000000*tp->ack.ato)/HZ; info->tcpi_snd_mss = tp->mss_cache; info->tcpi_rcv_mss = tp->ack.rcv_mss; info->tcpi_unacked = tp->packets_out; info->tcpi_sacked = tp->sacked_out; info->tcpi_lost = tp->lost_out; info->tcpi_retrans = tp->retrans_out; info->tcpi_fackets = tp->fackets_out; info->tcpi_last_data_sent = ((now - tp->lsndtime)*1000)/HZ; info->tcpi_last_ack_sent = 0; info->tcpi_last_data_recv = ((now - tp->ack.lrcvtime)*1000)/HZ; info->tcpi_last_ack_recv = ((now - tp->rcv_tstamp)*1000)/HZ; info->tcpi_pmtu = tp->pmtu_cookie; info->tcpi_rcv_ssthresh = tp->rcv_ssthresh; info->tcpi_rtt = ((1000000*tp->srtt)/HZ)>>3; info->tcpi_rttvar = ((1000000*tp->mdev)/HZ)>>2; info->tcpi_snd_ssthresh = tp->snd_ssthresh; info->tcpi_snd_cwnd = tp->snd_cwnd; info->tcpi_advmss = tp->advmss; info->tcpi_reordering = tp->reordering; } nlh->nlmsg_len = skb->tail - b; return skb->len; nlmsg_failure: skb_trim(skb, b - skb->data); return -1; } extern struct sock *tcp_v4_lookup(u32 saddr, u16 sport, u32 daddr, u16 dport, int dif); #ifdef CONFIG_IPV6 extern struct sock *tcp_v6_lookup(struct in6_addr *saddr, u16 sport, struct in6_addr *daddr, u16 dport, int dif); #endif static int tcpdiag_get_exact(struct sk_buff *in_skb, struct nlmsghdr *nlh) { int err; struct sock *sk; struct tcpdiagreq *req = NLMSG_DATA(nlh); struct sk_buff *rep; if (req->tcpdiag_family == AF_INET) { sk = tcp_v4_lookup(req->id.tcpdiag_dst[0], req->id.tcpdiag_dport, req->id.tcpdiag_src[0], req->id.tcpdiag_sport, req->id.tcpdiag_if); } #ifdef CONFIG_IPV6 else if (req->tcpdiag_family == AF_INET6) { sk = tcp_v6_lookup((struct in6_addr*)req->id.tcpdiag_dst, req->id.tcpdiag_dport, (struct in6_addr*)req->id.tcpdiag_src, req->id.tcpdiag_sport, req->id.tcpdiag_if); } #endif else { return -EINVAL; } if (sk == NULL) return -ENOENT; err = -ESTALE; if ((req->id.tcpdiag_cookie[0] != TCPDIAG_NOCOOKIE || req->id.tcpdiag_cookie[1] != TCPDIAG_NOCOOKIE) && sk != *((struct sock **)&req->id.tcpdiag_cookie[0])) goto out; err = -ENOMEM; rep = alloc_skb(NLMSG_SPACE(sizeof(struct tcpdiagmsg)+ sizeof(struct tcpdiag_meminfo)+ sizeof(struct tcp_info)+64), GFP_KERNEL); if (!rep) goto out; if (tcpdiag_fill(rep, sk, req->tcpdiag_ext, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq) <= 0) BUG(); err = netlink_unicast(tcpnl, rep, NETLINK_CB(in_skb).pid, MSG_DONTWAIT); if (err > 0) err = 0; out: if (sk) { if (sk->state == TCP_TIME_WAIT) tcp_tw_put((struct tcp_tw_bucket*)sk); else sock_put(sk); } return err; } int bitstring_match(u32 *a1, u32 *a2, int bits) { int words = bits >> 5; bits &= 0x1f; if (words) { if (memcmp(a1, a2, words << 2)) return 0; } if (bits) { __u32 w1, w2; __u32 mask; w1 = a1[words]; w2 = a2[words]; mask = htonl((0xffffffff) << (32 - bits)); if ((w1 ^ w2) & mask) return 0; } return 1; } int tcpdiag_bc_run(char *bc, int len, struct sock *sk) { while (len > 0) { int yes = 1; struct tcpdiag_bc_op *op = (struct tcpdiag_bc_op*)bc; switch (op->code) { case TCPDIAG_BC_NOP: break; case TCPDIAG_BC_JMP: yes = 0; break; case TCPDIAG_BC_S_GE: yes = (sk->num >= op[1].no); break; case TCPDIAG_BC_S_LE: yes = (sk->num <= op[1].no); break; case TCPDIAG_BC_D_GE: yes = (ntohs(sk->dport) >= op[1].no); break; case TCPDIAG_BC_D_LE: yes = (ntohs(sk->dport) <= op[1].no); break; case TCPDIAG_BC_AUTO: yes = !(sk->userlocks&SOCK_BINDPORT_LOCK); break; case TCPDIAG_BC_S_COND: case TCPDIAG_BC_D_COND: { struct tcpdiag_hostcond *cond = (struct tcpdiag_hostcond*)(op+1); u32 *addr; if (cond->port != -1 && cond->port != (op->code == TCPDIAG_BC_S_COND ? sk->num : ntohs(sk->dport))) { yes = 0; break; } if (cond->prefix_len == 0) break; #ifdef CONFIG_IPV6 if (sk->family == AF_INET6) { if (op->code == TCPDIAG_BC_S_COND) addr = (u32*)&sk->net_pinfo.af_inet6.rcv_saddr; else addr = (u32*)&sk->net_pinfo.af_inet6.daddr; } else #endif { if (op->code == TCPDIAG_BC_S_COND) addr = &sk->rcv_saddr; else addr = &sk->daddr; } if (bitstring_match(addr, cond->addr, cond->prefix_len)) break; if (sk->family == AF_INET6 && cond->family == AF_INET) { if (addr[0] == 0 && addr[1] == 0 && addr[2] == __constant_htonl(0xffff) && bitstring_match(addr+3, cond->addr, cond->prefix_len)) break; } yes = 0; break; } } if (yes) { len -= op->yes; bc += op->yes; } else { len -= op->no; bc += op->no; } } return (len == 0); } int valid_cc(char *bc, int len, int cc) { while (len >= 0) { struct tcpdiag_bc_op *op = (struct tcpdiag_bc_op*)bc; if (cc > len) return 0; if (cc == len) return 1; if (op->yes < 4) return 0; len -= op->yes; bc += op->yes; } return 0; } int tcpdiag_bc_audit(char *bytecode, int bytecode_len) { char *bc = bytecode; int len = bytecode_len; while (len > 0) { struct tcpdiag_bc_op *op = (struct tcpdiag_bc_op*)bc; //printk("BC: %d %d %d {%d} / %d\n", op->code, op->yes, op->no, op[1].no, len); switch (op->code) { case TCPDIAG_BC_AUTO: case TCPDIAG_BC_S_COND: case TCPDIAG_BC_D_COND: case TCPDIAG_BC_S_GE: case TCPDIAG_BC_S_LE: case TCPDIAG_BC_D_GE: case TCPDIAG_BC_D_LE: if (op->yes < 4 || op->yes > len+4) return -EINVAL; case TCPDIAG_BC_JMP: if (op->no < 4 || op->no > len+4) return -EINVAL; if (op->no < len && !valid_cc(bytecode, bytecode_len, len-op->no)) return -EINVAL; break; case TCPDIAG_BC_NOP: if (op->yes < 4 || op->yes > len+4) return -EINVAL; break; default: return -EINVAL; } bc += op->yes; len -= op->yes; } return len == 0 ? 0 : -EINVAL; } int tcpdiag_dump(struct sk_buff *skb, struct netlink_callback *cb) { int i, num; int s_i, s_num; struct tcpdiagreq *r = NLMSG_DATA(cb->nlh); struct rtattr *bc = NULL; if (cb->nlh->nlmsg_len > 4+NLMSG_SPACE(sizeof(struct tcpdiagreq))) bc = (struct rtattr*)(r+1); s_i = cb->args[1]; s_num = num = cb->args[2]; if (cb->args[0] == 0) { if (!(r->tcpdiag_states&(TCPF_LISTEN|TCPF_SYN_RECV))) goto skip_listen_ht; tcp_listen_lock(); for (i = s_i; i < TCP_LHTABLE_SIZE; i++) { struct sock *sk = tcp_listening_hash[i]; if (i > s_i) s_num = 0; for (sk = tcp_listening_hash[i], num = 0; sk != NULL; sk = sk->next, num++) { if (num < s_num) continue; if (!(r->tcpdiag_states&TCPF_LISTEN) || r->id.tcpdiag_dport) continue; if (r->id.tcpdiag_sport != sk->sport && r->id.tcpdiag_sport) continue; if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk)) continue; if (tcpdiag_fill(skb, sk, r->tcpdiag_ext, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq) <= 0) { tcp_listen_unlock(); goto done; } } } tcp_listen_unlock(); skip_listen_ht: cb->args[0] = 1; s_i = num = s_num = 0; } if (!(r->tcpdiag_states&~(TCPF_LISTEN|TCPF_SYN_RECV))) return skb->len; for (i = s_i; i < tcp_ehash_size; i++) { struct tcp_ehash_bucket *head = &tcp_ehash[i]; struct sock *sk; if (i > s_i) s_num = 0; read_lock_bh(&head->lock); for (sk = head->chain, num = 0; sk != NULL; sk = sk->next, num++) { if (num < s_num) continue; if (!(r->tcpdiag_states&(1<<sk->state))) continue; if (r->id.tcpdiag_sport != sk->sport && r->id.tcpdiag_sport) continue; if (r->id.tcpdiag_dport != sk->dport && r->id.tcpdiag_dport) continue; if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk)) continue; if (tcpdiag_fill(skb, sk, r->tcpdiag_ext, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq) <= 0) { read_unlock_bh(&head->lock); goto done; } } if (r->tcpdiag_states&TCPF_TIME_WAIT) { for (sk = tcp_ehash[i+tcp_ehash_size].chain; sk != NULL; sk = sk->next, num++) { if (num < s_num) continue; if (!(r->tcpdiag_states&(1<<sk->zapped))) continue; if (r->id.tcpdiag_sport != sk->sport && r->id.tcpdiag_sport) continue; if (r->id.tcpdiag_dport != sk->dport && r->id.tcpdiag_dport) continue; if (bc && !tcpdiag_bc_run(RTA_DATA(bc), RTA_PAYLOAD(bc), sk)) continue; if (tcpdiag_fill(skb, sk, r->tcpdiag_ext, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq) <= 0) { read_unlock_bh(&head->lock); goto done; } } } read_unlock_bh(&head->lock); } done: cb->args[1] = i; cb->args[2] = num; return skb->len; } static int tcpdiag_dump_done(struct netlink_callback *cb) { return 0; } static __inline__ int tcpdiag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) { if (!(nlh->nlmsg_flags&NLM_F_REQUEST)) return 0; if (nlh->nlmsg_type != TCPDIAG_GETSOCK) goto err_inval; if (NLMSG_LENGTH(sizeof(struct tcpdiagreq)) > skb->len) goto err_inval; if (nlh->nlmsg_flags&NLM_F_DUMP) { if (nlh->nlmsg_len > 4 + NLMSG_SPACE(sizeof(struct tcpdiagreq))) { struct rtattr *rta = (struct rtattr*)(NLMSG_DATA(nlh) + sizeof(struct tcpdiagreq)); if (rta->rta_type != TCPDIAG_REQ_BYTECODE || rta->rta_len < 8 || rta->rta_len > nlh->nlmsg_len - NLMSG_SPACE(sizeof(struct tcpdiagreq))) goto err_inval; if (tcpdiag_bc_audit(RTA_DATA(rta), RTA_PAYLOAD(rta))) goto err_inval; } return netlink_dump_start(tcpnl, skb, nlh, tcpdiag_dump, tcpdiag_dump_done); } else { return tcpdiag_get_exact(skb, nlh); } err_inval: return -EINVAL; } extern __inline__ void tcpdiag_rcv_skb(struct sk_buff *skb) { int err; struct nlmsghdr * nlh; if (skb->len >= NLMSG_SPACE(0)) { nlh = (struct nlmsghdr *)skb->data; if (nlh->nlmsg_len < sizeof(*nlh) || skb->len < nlh->nlmsg_len) return; err = tcpdiag_rcv_msg(skb, nlh); if (err) netlink_ack(skb, nlh, err); } } static void tcpdiag_rcv(struct sock *sk, int len) { struct sk_buff *skb; while ((skb = skb_dequeue(&sk->receive_queue)) != NULL) { tcpdiag_rcv_skb(skb); kfree_skb(skb); } } void __init tcpdiag_init(void) { tcpnl = netlink_kernel_create(NETLINK_TCPDIAG, tcpdiag_rcv); if (tcpnl == NULL) panic("tcpdiag_init: Cannot create netlink socket."); } |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:16
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-ppc In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/asm-ppc Added Files: ans-lcd.h pmac_feature.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- #ifndef _PPC_ANS_LCD_H #define _PPC_ANS_LCD_H #define ANSLCD_MINOR 156 #define ANSLCD_CLEAR 0x01 #define ANSLCD_SENDCTRL 0x02 #define ANSLCD_SETSHORTDELAY 0x03 #define ANSLCD_SETLONGDELAY 0x04 #endif --- NEW FILE --- /* * Definition of platform feature hooks for PowerMacs * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1998 Paul Mackerras & * Ben. Herrenschmidt. * * * Note: I removed media-bay details from the feature stuff, I beleive it's * not worth it, the media-bay driver can directly use the mac-io * ASIC registers. * * Implementation note: Currently, none of these functions will block. * However, they may internally protect themselves with a spinlock * for way too long. Be prepared for at least some of these to block * in the future. * * Unless specifically defined, the result code is assumed to be an * error when negative, 0 is the default success result. Some functions * may return additional positive result values. * * To keep implementation simple, all feature calls are assumed to have * the prototype parameters (struct device_node* node, int value). * When either is not used, pass 0. */ #ifdef __KERNEL__ #ifndef __PPC_ASM_PMAC_FEATURE_H #define __PPC_ASM_PMAC_FEATURE_H /* * Known Mac motherboard models * * Please, report any error here to be...@ke..., thanks ! */ /* PowerSurge are the first generation of PCI Pmacs. This include * all of the Grand-Central based machines */ #define PMAC_TYPE_PSURGE 0x10 /* PowerSurge */ /* Here is the infamous serie of OHare based machines */ #define PMAC_TYPE_COMET 0x20 /* Beleived to be PowerBook 2400 */ #define PMAC_TYPE_HOOPER 0x21 /* Beleived to be PowerBook 3400 */ #define PMAC_TYPE_KANGA 0x22 /* PowerBook 3500 (first G3) */ #define PMAC_TYPE_ALCHEMY 0x23 /* Alchemy motherboard base */ #define PMAC_TYPE_GAZELLE 0x24 /* Spartacus, some 5xxx/6xxx */ #define PMAC_TYPE_UNKNOWN_OHARE 0x2f /* Unknown, but OHare based */ /* Here are the Heathrow based machines * FIXME: Differenciate wallstreet,mainstreet,wallstreetII */ #define PMAC_TYPE_GOSSAMER 0x30 /* Gossamer motherboard */ #define PMAC_TYPE_SILK 0x31 /* Desktop PowerMac G3 */ #define PMAC_TYPE_WALLSTREET 0x32 /* Wallstreet/Mainstreet PowerBook*/ #define PMAC_TYPE_UNKNOWN_HEATHROW 0x3f /* Unknown but heathrow based */ /* Here are newworld machines based on Paddington (heathrow derivative) */ #define PMAC_TYPE_101_PBOOK 0x40 /* 101 PowerBook (aka Lombard) */ #define PMAC_TYPE_ORIG_IMAC 0x41 /* First generation iMac */ #define PMAC_TYPE_YOSEMITE 0x42 /* B&W G3 */ #define PMAC_TYPE_YIKES 0x43 /* Yikes G4 (PCI graphics) */ #define PMAC_TYPE_UNKNOWN_PADDINGTON 0x4f /* Unknown but paddington based */ /* Core99 machines based on UniNorth 1.0 and 1.5 * * Note: A single entry here may cover several actual models according * to the device-tree. (Sawtooth is most tower G4s, FW_IMAC is most * FireWire based iMacs, etc...). Those machines are too similar to be * distinguished here, when they need to be differencied, use the * device-tree "model" or "compatible" property. */ #define PMAC_TYPE_ORIG_IBOOK 0x40 /* First iBook model (no firewire) */ #define PMAC_TYPE_SAWTOOTH 0x41 /* Desktop G4s */ #define PMAC_TYPE_FW_IMAC 0x42 /* FireWire iMacs (except Pangea based) */ #define PMAC_TYPE_FW_IBOOK 0x43 /* FireWire iBooks (except iBook2) */ #define PMAC_TYPE_CUBE 0x44 /* Cube PowerMac */ #define PMAC_TYPE_QUICKSILVER 0x45 /* QuickSilver G4s */ #define PMAC_TYPE_PISMO 0x46 /* Pismo PowerBook */ #define PMAC_TYPE_TITANIUM 0x47 /* Titanium PowerBook */ #define PMAC_TYPE_TITANIUM2 0x48 /* Titanium II PowerBook */ #define PMAC_TYPE_UNKNOWN_CORE99 0x5f /* MacRISC2 machines based on the Pangea chipset */ #define PMAC_TYPE_PANGEA_IMAC 0x100 /* Flower Power iMac */ #define PMAC_TYPE_IBOOK2 0x101 /* iBook2 (polycarbonate) */ #define PMAC_TYPE_UNKNOWN_PANGEA 0x10f /* * Motherboard flags */ #define PMAC_MB_CAN_SLEEP 0x00000001 #define PMAC_MB_HAS_FW_POWER 0x00000002 /* * Feature calls supported on pmac * */ /* * Use this inline wrapper */ struct device_node; static inline int pmac_call_feature(int selector, struct device_node* node, int param, int value) { if (!ppc_md.feature_call) return -ENODEV; return ppc_md.feature_call(selector, node, param, value); } /* PMAC_FTR_SERIAL_ENABLE (struct device_node* node, int param, int value) * enable/disable an SCC side. Pass the node corresponding to the * channel side as a parameter. * param is the type of port * if param is ored with PMAC_SCC_FLAG_XMON, then the SCC is locked enabled * for use by xmon. */ #define PMAC_FTR_SCC_ENABLE PMAC_FTR_DEF(0) #define PMAC_SCC_ASYNC 0 #define PMAC_SCC_IRDA 1 #define PMAC_SCC_I2S1 2 #define PMAC_SCC_FLAG_XMON 0x00001000 /* PMAC_FTR_MODEM_ENABLE (struct device_node* node, 0, int value) * enable/disable the internal modem. */ #define PMAC_FTR_MODEM_ENABLE PMAC_FTR_DEF(1) /* PMAC_FTR_SWIM3_ENABLE (struct device_node* node, 0,int value) * enable/disable the swim3 (floppy) cell of a mac-io ASIC */ #define PMAC_FTR_SWIM3_ENABLE PMAC_FTR_DEF(2) /* PMAC_FTR_MESH_ENABLE (struct device_node* node, 0, int value) * enable/disable the mesh (scsi) cell of a mac-io ASIC */ #define PMAC_FTR_MESH_ENABLE PMAC_FTR_DEF(3) /* PMAC_FTR_IDE_ENABLE (struct device_node* node, int busID, int value) * enable/disable an IDE port of a mac-io ASIC * pass the busID parameter */ #define PMAC_FTR_IDE_ENABLE PMAC_FTR_DEF(4) /* PMAC_FTR_IDE_RESET (struct device_node* node, int busID, int value) * assert(1)/release(0) an IDE reset line (mac-io IDE only) */ #define PMAC_FTR_IDE_RESET PMAC_FTR_DEF(5) /* PMAC_FTR_BMAC_ENABLE (struct device_node* node, 0, int value) * enable/disable the bmac (ethernet) cell of a mac-io ASIC, also drive * it's reset line */ #define PMAC_FTR_BMAC_ENABLE PMAC_FTR_DEF(6) /* PMAC_FTR_GMAC_ENABLE (struct device_node* node, 0, int value) * enable/disable the gmac (ethernet) cell of an uninorth ASIC. This * control the cell's clock. */ #define PMAC_FTR_GMAC_ENABLE PMAC_FTR_DEF(7) /* PMAC_FTR_GMAC_PHY_RESET (struct device_node* node, 0, 0) * Perform a HW reset of the PHY connected to a gmac controller. * Pass the gmac device node, not the PHY node. */ #define PMAC_FTR_GMAC_PHY_RESET PMAC_FTR_DEF(8) /* PMAC_FTR_SOUND_CHIP_ENABLE (struct device_node* node, 0, int value) * enable/disable the sound chip, whatever it is and provided it can * acually be controlled */ #define PMAC_FTR_SOUND_CHIP_ENABLE PMAC_FTR_DEF(9) /* -- add various tweaks related to sound routing -- */ /* PMAC_FTR_AIRPORT_ENABLE (struct device_node* node, 0, int value) * enable/disable the airport card */ #define PMAC_FTR_AIRPORT_ENABLE PMAC_FTR_DEF(10) /* PMAC_FTR_RESET_CPU (NULL, int cpu_nr, 0) * toggle the reset line of a CPU on an uninorth-based SMP machine */ #define PMAC_FTR_RESET_CPU PMAC_FTR_DEF(11) /* PMAC_FTR_USB_ENABLE (struct device_node* node, 0, int value) * enable/disable an USB cell, along with the power of the USB "pad" * on keylargo based machines */ #define PMAC_FTR_USB_ENABLE PMAC_FTR_DEF(12) /* PMAC_FTR_1394_ENABLE (struct device_node* node, 0, int value) * enable/disable the firewire cell of an uninorth ASIC. */ #define PMAC_FTR_1394_ENABLE PMAC_FTR_DEF(13) /* PMAC_FTR_1394_CABLE_POWER (struct device_node* node, 0, int value) * enable/disable the firewire cable power supply of the uninorth * firewire cell */ #define PMAC_FTR_1394_CABLE_POWER PMAC_FTR_DEF(14) /* PMAC_FTR_SLEEP_STATE (struct device_node* node, 0, int value) * set the sleep state of the motherboard. * Pass -1 as value to query for sleep capability */ #define PMAC_FTR_SLEEP_STATE PMAC_FTR_DEF(15) /* PMAC_FTR_GET_MB_INFO (NULL, selector, 0) * * returns some motherboard infos. * selector: 0 - model id * 1 - model flags (capabilities) * 2 - model name (cast to const char *) */ #define PMAC_FTR_GET_MB_INFO PMAC_FTR_DEF(16) #define PMAC_MB_INFO_MODEL 0 #define PMAC_MB_INFO_FLAGS 1 #define PMAC_MB_INFO_NAME 2 /* PMAC_FTR_READ_GPIO (NULL, int index, 0) * * read a GPIO from a mac-io controller of type KeyLargo or Pangea. * the value returned is a byte (positive), or a negative error code */ #define PMAC_FTR_READ_GPIO PMAC_FTR_DEF(17) /* PMAC_FTR_WRITE_GPIO (NULL, int index, int value) * * write a GPIO of a mac-io controller of type KeyLargo or Pangea. */ #define PMAC_FTR_WRITE_GPIO PMAC_FTR_DEF(18) /* Don't use those directly, they are for the sake of pmac_setup.c */ extern int pmac_do_feature_call(unsigned int selector, ...); extern void pmac_feature_init(void); extern void pmac_feature_late_init(void); #define PMAC_FTR_DEF(x) ((_MACH_Pmac << 16) | (x)) #endif /* __PPC_ASM_PMAC_FEATURE_H */ #endif /* __KERNEL__ */ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:16
|
Update of /cvsroot/linux-vax/kernel-2.4/include/linux In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/linux Added Files: stringify.h tcp_diag.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- #ifndef __LINUX_STRINGIFY_H #define __LINUX_STRINGIFY_H /* Indirect stringification. Doing two levels allows the parameter to be a * macro itself. For example, compile with -DFOO=bar, __stringify(FOO) * converts to "bar". */ #define __stringify_1(x) #x #define __stringify(x) __stringify_1(x) #endif /* !__LINUX_STRINGIFY_H */ --- NEW FILE --- #ifndef _TCP_DIAG_H_ #define _TCP_DIAG_H_ 1 /* Just some random number */ #define TCPDIAG_GETSOCK 18 /* Socket identity */ struct tcpdiag_sockid { __u16 tcpdiag_sport; __u16 tcpdiag_dport; __u32 tcpdiag_src[4]; __u32 tcpdiag_dst[4]; __u32 tcpdiag_if; __u32 tcpdiag_cookie[2]; #define TCPDIAG_NOCOOKIE (~0U) }; /* Request structure */ struct tcpdiagreq { __u8 tcpdiag_family; /* Family of addresses. */ __u8 tcpdiag_src_len; __u8 tcpdiag_dst_len; __u8 tcpdiag_ext; /* Query extended information */ struct tcpdiag_sockid id; __u32 tcpdiag_states; /* States to dump */ __u32 tcpdiag_dbs; /* Tables to dump (NI) */ }; enum { TCPDIAG_REQ_NONE, TCPDIAG_REQ_BYTECODE, }; #define TCPDIAG_REQ_MAX TCPDIAG_REQ_BYTECODE /* Bytecode is sequence of 4 byte commands followed by variable arguments. * All the commands identified by "code" are conditional jumps forward: * to offset cc+"yes" or to offset cc+"no". "yes" is supposed to be * length of the command and its arguments. */ struct tcpdiag_bc_op { unsigned char code; unsigned char yes; unsigned short no; }; enum { TCPDIAG_BC_NOP, TCPDIAG_BC_JMP, TCPDIAG_BC_S_GE, TCPDIAG_BC_S_LE, TCPDIAG_BC_D_GE, TCPDIAG_BC_D_LE, TCPDIAG_BC_AUTO, TCPDIAG_BC_S_COND, TCPDIAG_BC_D_COND, }; struct tcpdiag_hostcond { __u8 family; __u8 prefix_len; int port; __u32 addr[0]; }; /* Base info structure. It contains socket identity (addrs/ports/cookie) * and, alas, the information shown by netstat. */ struct tcpdiagmsg { __u8 tcpdiag_family; __u8 tcpdiag_state; __u8 tcpdiag_timer; __u8 tcpdiag_retrans; struct tcpdiag_sockid id; __u32 tcpdiag_expires; __u32 tcpdiag_rqueue; __u32 tcpdiag_wqueue; __u32 tcpdiag_uid; __u32 tcpdiag_inode; }; /* Extensions */ enum { TCPDIAG_NONE, TCPDIAG_MEMINFO, TCPDIAG_INFO, }; #define TCPDIAG_MAX TCPDIAG_INFO /* TCPDIAG_MEM */ struct tcpdiag_meminfo { __u32 tcpdiag_rmem; __u32 tcpdiag_wmem; __u32 tcpdiag_fmem; __u32 tcpdiag_tmem; }; #endif /* _TCP_DIAG_H_ */ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:15
|
Update of /cvsroot/linux-vax/kernel-2.4/include/asm-cris In directory sc8-pr-cvs1:/tmp/cvs-serv14646/include/asm-cris Added Files: ethernet.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * ioctl defines for ethernet driver * * Copyright (c) 2001 Axis Communications AB * * Author: Mikael Starvik * */ #ifndef _CRIS_ETHERNET_H #define _CRIS_ETHERNET_H #define SET_ETH_SPEED_AUTO SIOCDEVPRIVATE /* Auto neg speed */ #define SET_ETH_SPEED_10 SIOCDEVPRIVATE+1 /* 10 Mbps */ #define SET_ETH_SPEED_100 SIOCDEVPRIVATE+2 /* 100 Mbps. */ #define SET_ETH_DUPLEX_AUTO SIOCDEVPRIVATE+3 /* Auto neg duplex */ #define SET_ETH_DUPLEX_HALF SIOCDEVPRIVATE+4 /* Full duplex */ #define SET_ETH_DUPLEX_FULL SIOCDEVPRIVATE+5 /* Half duplex */ #endif /* _CRIS_ETHERNET_H */ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:15
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/nls In directory sc8-pr-cvs1:/tmp/cvs-serv14646/fs/nls Added Files: nls_cp1250.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * linux/fs/nls_cp1250.c * * Charset cp1250 translation tables. * Generated automatically from the Unicode and charset * tables from the Unicode Organization (www.unicode.org). * The Unicode to charset table has only exact mappings. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/string.h> #include <linux/nls.h> #include <linux/errno.h> static wchar_t charset2uni[256] = { /* 0x00*/ 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, /* 0x10*/ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, /* 0x20*/ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, /* 0x30*/ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, /* 0x40*/ 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, /* 0x50*/ 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, /* 0x60*/ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, /* 0x70*/ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0x007f, /* 0x80*/ 0x20ac, 0x0000, 0x201a, 0x0000, 0x201e, 0x2026, 0x2020, 0x2021, 0x0000, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179, /* 0x90*/ 0x0000, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, 0x0000, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a, /* 0xa0*/ 0x00a0, 0x02c7, 0x02d8, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7, 0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b, /* 0xb0*/ 0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7, 0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c, /* 0xc0*/ 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, /* 0xd0*/ 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, /* 0xe0*/ 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, /* 0xf0*/ 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, }; static unsigned char page00[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ 0xb0, 0xb1, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ 0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ }; static unsigned char page01[256] = { 0x00, 0x00, 0xc3, 0xe3, 0xa5, 0xb9, 0xc6, 0xe6, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0xc5, 0xe5, 0x00, 0x00, 0xbc, 0xbe, 0x00, /* 0x38-0x3f */ 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */ 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */ 0xd8, 0xf8, 0x8c, 0x9c, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */ 0x8a, 0x9a, 0xde, 0xfe, 0x8d, 0x9d, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */ 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x8f, 0x9f, 0xaf, 0xbf, 0x8e, 0x9e, 0x00, /* 0x78-0x7f */ }; static unsigned char page02[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, /* 0xc0-0xc7 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ }; static unsigned char page20[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ }; static unsigned char page21[256] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ }; static unsigned char *page_uni2charset[256] = { page00, page01, page02, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, page20, page21, NULL, NULL, NULL, NULL, NULL, NULL, }; static unsigned char charset2lower[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x40-0x47 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x48-0x4f */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x50-0x57 */ 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, /* 0x60-0x67 */ 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, /* 0x68-0x6f */ 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, /* 0x70-0x77 */ 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 0x80, 0x00, 0x82, 0x00, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x00, 0x89, 0x9a, 0x8b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x88-0x8f */ 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ 0x00, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xb3, 0xa4, 0xb9, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xba, 0xab, 0xac, 0xad, 0xae, 0xbf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xb9, 0xba, 0xbb, 0xbe, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xc0-0xc7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xc8-0xcf */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xd7, /* 0xd0-0xd7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, /* 0xd8-0xdf */ 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0xf8-0xff */ }; static unsigned char charset2upper[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00-0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08-0x0f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10-0x17 */ 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18-0x1f */ 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20-0x27 */ 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28-0x2f */ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, /* 0x30-0x37 */ 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38-0x3f */ 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x40-0x47 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x48-0x4f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x50-0x57 */ 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, /* 0x58-0x5f */ 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, /* 0x60-0x67 */ 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, /* 0x68-0x6f */ 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, /* 0x70-0x77 */ 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, /* 0x78-0x7f */ 0x80, 0x00, 0x82, 0x00, 0x84, 0x85, 0x86, 0x87, /* 0x80-0x87 */ 0x00, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ 0x00, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x90-0x97 */ 0x00, 0x99, 0x8a, 0x9b, 0x8c, 0x8d, 0x8e, 0x8f, /* 0x98-0x9f */ 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ 0xb0, 0xb1, 0xb2, 0xa3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ 0xb8, 0xa5, 0xaa, 0xbb, 0xbc, 0xbd, 0xbc, 0xaf, /* 0xb8-0xbf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0x00, /* 0xd8-0xdf */ 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xe0-0xe7 */ 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xe8-0xef */ 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xf7, /* 0xf0-0xf7 */ 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xff, /* 0xf8-0xff */ }; static int uni2char(wchar_t uni, unsigned char *out, int boundlen) { unsigned char *uni2charset; unsigned char cl = uni & 0x00ff; unsigned char ch = (uni & 0xff00) >> 8; if (boundlen <= 0) return -ENAMETOOLONG; uni2charset = page_uni2charset[ch]; if (uni2charset && uni2charset[cl]) out[0] = uni2charset[cl]; else return -EINVAL; return 1; } static int char2uni(const unsigned char *rawstring, int boundlen, wchar_t *uni) { *uni = charset2uni[*rawstring]; if (*uni == 0x0000) return -EINVAL; return 1; } static struct nls_table table = { "cp1250", uni2char, char2uni, charset2lower, charset2upper, THIS_MODULE, }; static int __init init_nls_cp1250(void) { return register_nls(&table); } static void __exit exit_nls_cp1250(void) { unregister_nls(&table); } module_init(init_nls_cp1250) module_exit(exit_nls_cp1250) MODULE_LICENSE("BSD without advertising clause"); /* * Overrides for Emacs so that we follow Linus's tabbing style. * Emacs will notice this stuff at the end of the file and automatically * adjust the settings for this buffer only. This must remain at the end * of the file. * --------------------------------------------------------------------------- * Local variables: * c-indent-level: 8 * c-brace-imaginary-offset: 0 * c-brace-offset: -8 * c-argdecl-indent: 8 * c-label-offset: -8 * c-continued-statement-offset: 8 * c-continued-brace-offset: 0 * End: */ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:14
|
Update of /cvsroot/linux-vax/kernel-2.4/fs/freevxfs In directory sc8-pr-cvs1:/tmp/cvs-serv14646/fs/freevxfs Added Files: vxfs_kcompat.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- #ifndef _VXFS_KCOMPAT_H #define _VXFS_KCOMPAT_H #include <linux/version.h> #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) #include <linux/blkdev.h> typedef long sector_t; /* Dito. */ static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block) { bh->b_state |= 1 << BH_Mapped; bh->b_dev = sb->s_dev; bh->b_blocknr = block; } /* From fs/block_dev.c (Linux 2.5.2-pre2) */ static inline int sb_set_blocksize(struct super_block *sb, int size) { int bits; if (set_blocksize(sb->s_dev, size) < 0) return 0; sb->s_blocksize = size; for (bits = 9, size >>= 9; size >>= 1; bits++) ; sb->s_blocksize_bits = bits; return sb->s_blocksize; } /* Dito. */ static inline int sb_min_blocksize(struct super_block *sb, int size) { int minsize = get_hardsect_size(sb->s_dev); if (size < minsize) size = minsize; return sb_set_blocksize(sb, size); } #endif /* Kernel 2.4 */ #endif /* _VXFS_KCOMPAT_H */ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:14
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/usb/serial In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/usb/serial Added Files: ipaq.c ipaq.h kl5kusb105.c kl5kusb105.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * USB Compaq iPAQ driver * * Copyright (C) 2001 * Ganesh Varadarajan <ga...@ve...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * */ #include <linux/config.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/signal.h> #include <linux/errno.h> #include <linux/poll.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/fcntl.h> #include <linux/tty.h> #include <linux/tty_driver.h> #include <linux/tty_flip.h> #include <linux/module.h> #include <linux/spinlock.h> #include <linux/usb.h> #ifdef CONFIG_USB_SERIAL_DEBUG static int debug = 1; #else static int debug = 0; #endif #include "usb-serial.h" #include "ipaq.h" /* * Version Information */ #define DRIVER_VERSION "v0.1" #define DRIVER_AUTHOR "Ganesh Varadarajan <ga...@ve...>" #define DRIVER_DESC "USB Compaq iPAQ driver" /* Function prototypes for an ipaq */ static int ipaq_open (struct usb_serial_port *port, struct file *filp); static void ipaq_close (struct usb_serial_port *port, struct file *filp); static int ipaq_startup (struct usb_serial *serial); static void ipaq_shutdown (struct usb_serial *serial); static int ipaq_write(struct usb_serial_port *port, int from_user, const unsigned char *buf, int count); static int ipaq_write_bulk(struct usb_serial_port *port, int from_user, const unsigned char *buf, int count); static int ipaq_write_flush(struct usb_serial_port *port); static void ipaq_read_bulk_callback (struct urb *urb); static void ipaq_write_bulk_callback(struct urb *urb); static int ipaq_write_room(struct usb_serial_port *port); static int ipaq_chars_in_buffer(struct usb_serial_port *port); static void ipaq_destroy_lists(struct usb_serial_port *port); static __devinitdata struct usb_device_id ipaq_id_table [] = { { USB_DEVICE(IPAQ_VENDOR_ID, IPAQ_PRODUCT_ID) }, { } /* Terminating entry */ }; MODULE_DEVICE_TABLE (usb, ipaq_id_table); /* All of the device info needed for the Compaq iPAQ */ struct usb_serial_device_type ipaq_device = { name: "Compaq iPAQ", id_table: ipaq_id_table, needs_interrupt_in: MUST_HAVE_NOT, needs_bulk_in: MUST_HAVE, needs_bulk_out: MUST_HAVE, num_interrupt_in: 0, num_bulk_in: 1, num_bulk_out: 1, num_ports: 1, open: ipaq_open, close: ipaq_close, startup: ipaq_startup, shutdown: ipaq_shutdown, write: ipaq_write, write_room: ipaq_write_room, chars_in_buffer: ipaq_chars_in_buffer, read_bulk_callback: ipaq_read_bulk_callback, write_bulk_callback: ipaq_write_bulk_callback, }; static spinlock_t write_list_lock; static int bytes_in; static int bytes_out; static int ipaq_open(struct usb_serial_port *port, struct file *filp) { struct usb_serial *serial = port->serial; struct ipaq_private *priv; struct ipaq_packet *pkt; int i, result = 0; if (port_paranoia_check(port, __FUNCTION__)) { return -ENODEV; } dbg(__FUNCTION__ " - port %d", port->number); down(&port->sem); ++port->open_count; MOD_INC_USE_COUNT; if (!port->active) { port->active = 1; bytes_in = 0; bytes_out = 0; priv = (struct ipaq_private *)kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); if (priv == NULL) { err(__FUNCTION__ " - Out of memory"); return -ENOMEM; } port->private = (void *)priv; priv->active = 0; priv->queue_len = 0; INIT_LIST_HEAD(&priv->queue); INIT_LIST_HEAD(&priv->freelist); for (i = 0; i < URBDATA_QUEUE_MAX / PACKET_SIZE; i++) { pkt = kmalloc(sizeof(struct ipaq_packet), GFP_KERNEL); if (pkt == NULL) { goto enomem; } pkt->data = kmalloc(PACKET_SIZE, GFP_KERNEL); if (pkt->data == NULL) { kfree(pkt); goto enomem; } pkt->len = 0; pkt->written = 0; INIT_LIST_HEAD(&pkt->list); list_add(&pkt->list, &priv->freelist); priv->free_len += PACKET_SIZE; } /* * Force low latency on. This will immediately push data to the line * discipline instead of queueing. */ port->tty->low_latency = 1; /* * Lose the small buffers usbserial provides. Make larger ones. */ kfree(port->bulk_in_buffer); kfree(port->bulk_out_buffer); port->bulk_in_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); if (port->bulk_in_buffer == NULL) { goto enomem; } port->bulk_out_buffer = kmalloc(URBDATA_SIZE, GFP_KERNEL); if (port->bulk_out_buffer == NULL) { kfree(port->bulk_in_buffer); goto enomem; } port->read_urb->transfer_buffer = port->bulk_in_buffer; port->write_urb->transfer_buffer = port->bulk_out_buffer; port->read_urb->transfer_buffer_length = URBDATA_SIZE; port->bulk_out_size = port->write_urb->transfer_buffer_length = URBDATA_SIZE; /* Start reading from the device */ FILL_BULK_URB(port->read_urb, serial->dev, usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, ipaq_read_bulk_callback, port); result = usb_submit_urb(port->read_urb); if (result) { err(__FUNCTION__ " - failed submitting read urb, error %d", result); } /* * Send out two control messages observed in win98 sniffs. Not sure what * they do. */ result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, 0x1, 0, NULL, 0, 5 * HZ); if (result < 0) { err(__FUNCTION__ " - failed doing control urb, error %d", result); } result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, 0x1, 0, NULL, 0, 5 * HZ); if (result < 0) { err(__FUNCTION__ " - failed doing control urb, error %d", result); } } up(&port->sem); return result; enomem: ipaq_destroy_lists(port); kfree(priv); err(__FUNCTION__ " - Out of memory"); return -ENOMEM; } static void ipaq_close(struct usb_serial_port *port, struct file *filp) { struct usb_serial *serial; struct ipaq_private *priv = port->private; if (port_paranoia_check(port, __FUNCTION__)) { return; } dbg(__FUNCTION__ " - port %d", port->number); serial = get_usb_serial(port, __FUNCTION__); if (!serial) return; down (&port->sem); --port->open_count; if (port->open_count <= 0) { /* * shut down bulk read and write */ usb_unlink_urb(port->write_urb); usb_unlink_urb(port->read_urb); ipaq_destroy_lists(port); kfree(priv); port->private = NULL; port->active = 0; port->open_count = 0; } up (&port->sem); /* Uncomment the following line if you want to see some statistics in your syslog */ /* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */ MOD_DEC_USE_COUNT; } static void ipaq_read_bulk_callback(struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct usb_serial *serial = get_usb_serial (port, __FUNCTION__); struct tty_struct *tty; unsigned char *data = urb->transfer_buffer; int i, result; if (port_paranoia_check(port, __FUNCTION__)) return; dbg(__FUNCTION__ " - port %d", port->number); if (!serial) { dbg(__FUNCTION__ " - bad serial pointer, exiting"); return; } if (urb->status) { dbg(__FUNCTION__ " - nonzero read bulk status received: %d", urb->status); return; } usb_serial_debug_data (__FILE__, __FUNCTION__, urb->actual_length, data); tty = port->tty; if (urb->actual_length) { for (i = 0; i < urb->actual_length ; ++i) { /* if we insert more than TTY_FLIPBUF_SIZE characters, we drop them. */ if(tty->flip.count >= TTY_FLIPBUF_SIZE) { tty_flip_buffer_push(tty); } /* this doesn't actually push the data through unless tty->low_latency is set */ tty_insert_flip_char(tty, data[i], 0); } tty_flip_buffer_push(tty); bytes_in += urb->actual_length; } /* Continue trying to always read */ FILL_BULK_URB(port->read_urb, serial->dev, usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, ipaq_read_bulk_callback, port); result = usb_submit_urb(port->read_urb); if (result) err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); return; } static int ipaq_write(struct usb_serial_port *port, int from_user, const unsigned char *buf, int count) { const unsigned char *current_position = buf; int bytes_sent = 0; int transfer_size; dbg(__FUNCTION__ " - port %d", port->number); usb_serial_debug_data(__FILE__, __FUNCTION__, count, buf); while (count > 0) { transfer_size = min(count, PACKET_SIZE); if (ipaq_write_bulk(port, from_user, current_position, transfer_size)) { break; } current_position += transfer_size; bytes_sent += transfer_size; count -= transfer_size; bytes_out += transfer_size; } return bytes_sent; } static int ipaq_write_bulk(struct usb_serial_port *port, int from_user, const unsigned char *buf, int count) { struct ipaq_private *priv = port->private; struct ipaq_packet *pkt = NULL; int result = 0; unsigned long flags; if (priv->free_len <= 0) { dbg(__FUNCTION__ " - we're stuffed"); return -EAGAIN; } spin_lock_irqsave(&write_list_lock, flags); if (!list_empty(&priv->freelist)) { pkt = list_entry(priv->freelist.next, struct ipaq_packet, list); list_del(&pkt->list); priv->free_len -= PACKET_SIZE; } spin_unlock_irqrestore(&write_list_lock, flags); if (pkt == NULL) { dbg(__FUNCTION__ " - we're stuffed"); return -EAGAIN; } if (from_user) { copy_from_user(pkt->data, buf, count); } else { memcpy(pkt->data, buf, count); } usb_serial_debug_data(__FILE__, __FUNCTION__, count, pkt->data); pkt->len = count; pkt->written = 0; spin_lock_irqsave(&write_list_lock, flags); list_add_tail(&pkt->list, &priv->queue); priv->queue_len += count; if (priv->active == 0) { priv->active = 1; result = ipaq_write_flush(port); } spin_unlock_irqrestore(&write_list_lock, flags); return result; } static int ipaq_write_flush(struct usb_serial_port *port) { struct ipaq_private *priv = (struct ipaq_private *)port->private; struct usb_serial *serial = port->serial; int count, room, result; struct ipaq_packet *pkt; struct urb *urb = port->write_urb; struct list_head *tmp; if (urb->status == -EINPROGRESS) { /* Should never happen */ err(__FUNCTION__ " - flushing while urb is active !"); return -EAGAIN; } room = URBDATA_SIZE; for (tmp = priv->queue.next; tmp != &priv->queue;) { pkt = list_entry(tmp, struct ipaq_packet, list); tmp = tmp->next; count = min(room, (int)(pkt->len - pkt->written)); memcpy(urb->transfer_buffer + (URBDATA_SIZE - room), pkt->data + pkt->written, count); room -= count; pkt->written += count; priv->queue_len -= count; if (pkt->written == pkt->len) { list_del(&pkt->list); list_add(&pkt->list, &priv->freelist); priv->free_len += PACKET_SIZE; } if (room == 0) { break; } } count = URBDATA_SIZE - room; FILL_BULK_URB(port->write_urb, serial->dev, usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress), port->write_urb->transfer_buffer, count, ipaq_write_bulk_callback, port); result = usb_submit_urb(urb); if (result) { err(__FUNCTION__ " - failed submitting write urb, error %d", result); } return result; } static void ipaq_write_bulk_callback(struct urb *urb) { struct usb_serial_port *port = (struct usb_serial_port *)urb->context; struct ipaq_private *priv = (struct ipaq_private *)port->private; unsigned long flags; if (port_paranoia_check (port, __FUNCTION__)) { return; } dbg(__FUNCTION__ " - port %d", port->number); if (urb->status) { dbg(__FUNCTION__ " - nonzero write bulk status received: %d", urb->status); } spin_lock_irqsave(&write_list_lock, flags); if (!list_empty(&priv->queue)) { ipaq_write_flush(port); } else { priv->active = 0; } spin_unlock_irqrestore(&write_list_lock, flags); queue_task(&port->tqueue, &tq_immediate); mark_bh(IMMEDIATE_BH); return; } static int ipaq_write_room(struct usb_serial_port *port) { struct ipaq_private *priv = (struct ipaq_private *)port->private; dbg(__FUNCTION__ " - freelen %d", priv->free_len); return priv->free_len; } static int ipaq_chars_in_buffer(struct usb_serial_port *port) { struct ipaq_private *priv = (struct ipaq_private *)port->private; dbg(__FUNCTION__ " - queuelen %d", priv->queue_len); return priv->queue_len; } static void ipaq_destroy_lists(struct usb_serial_port *port) { struct ipaq_private *priv = (struct ipaq_private *)port->private; struct list_head *tmp; struct ipaq_packet *pkt; for (tmp = priv->queue.next; tmp != &priv->queue;) { pkt = list_entry(tmp, struct ipaq_packet, list); tmp = tmp->next; kfree(pkt->data); kfree(pkt); } for (tmp = priv->freelist.next; tmp != &priv->freelist;) { pkt = list_entry(tmp, struct ipaq_packet, list); tmp = tmp->next; kfree(pkt->data); kfree(pkt); } return; } static int ipaq_startup(struct usb_serial *serial) { dbg(__FUNCTION__); usb_set_configuration(serial->dev, 1); return 0; } static void ipaq_shutdown(struct usb_serial *serial) { int i; dbg (__FUNCTION__); /* stop reads and writes on all ports */ for (i=0; i < serial->num_ports; ++i) { while (serial->port[i].open_count > 0) { ipaq_close(&serial->port[i], NULL); } } } static int __init ipaq_init(void) { usb_serial_register(&ipaq_device); info(DRIVER_DESC " " DRIVER_VERSION); return 0; } static void __exit ipaq_exit(void) { usb_serial_deregister(&ipaq_device); } module_init(ipaq_init); module_exit(ipaq_exit); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_LICENSE("GPL"); MODULE_PARM(debug, "i"); MODULE_PARM_DESC(debug, "Debug enabled or not"); --- NEW FILE --- /* * USB Compaq iPAQ driver * * Copyright (C) 2001 * Ganesh Varadarajan <ga...@ve...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * */ #ifndef __LINUX_USB_SERIAL_IPAQ_H #define __LINUX_USB_SERIAL_IPAQ_H #define IPAQ_VENDOR_ID 0x049f #define IPAQ_PRODUCT_ID 0x0003 /* * Since we can't queue our bulk write urbs (don't know why - it just * doesn't work), we can send down only one write urb at a time. The simplistic * approach taken by the generic usbserial driver will work, but it's not good * for performance. Therefore, we buffer upto URBDATA_QUEUE_MAX bytes of write * requests coming from the line discipline. This is done by chaining them * in lists of struct ipaq_packet, each packet holding a maximum of * PACKET_SIZE bytes. * * ipaq_write() can be called from bottom half context; hence we can't * allocate memory for packets there. So we initialize a pool of packets at * the first open and maintain a freelist. * * The value of PACKET_SIZE was empirically determined by * checking the maximum write sizes sent down by the ppp ldisc. * URBDATA_QUEUE_MAX is set to 64K, which is the maximum TCP window size * supported by the iPAQ. */ struct ipaq_packet { char *data; size_t len; size_t written; struct list_head list; }; struct ipaq_private { int active; int queue_len; int free_len; struct list_head queue; struct list_head freelist; }; #define URBDATA_SIZE 4096 #define URBDATA_QUEUE_MAX (64 * 1024) #define PACKET_SIZE 256 #endif --- NEW FILE --- /* * KLSI KL5KUSB105 chip RS232 converter driver * * Copyright (C) 2001 Utz-Uwe Haus <ha...@uu...> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * All information about the device was acquired using SniffUSB ans snoopUSB * on Windows98. * It was written out of frustration with the PalmConnect USB Serial adapter * sold by Palm Inc. * Neither Palm, nor their contractor (MCCI) or their supplier (KLSI) provided * information that was not already available. * * It seems that KLSI bought some silicon-design information from ScanLogic, * whose SL11R processor is at the core of the KL5KUSB chipset from KLSI. [...1093 lines suppressed...] usb_serial_deregister (&kl5kusb105d_device); } module_init (klsi_105_init); module_exit (klsi_105_exit); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_LICENSE("GPL"); MODULE_PARM(debug, "i"); MODULE_PARM_DESC(debug, "enable extensive debugging messages"); /* FIXME: implement MODULE_PARM(num_urbs, "i"); MODULE_PARM_DESC(num_urbs, "number of URBs to use in write pool"); */ /* vim: set sts=8 ts=8 sw=8: */ --- NEW FILE --- /* * Definitions for the KLSI KL5KUSB105 serial port adapter */ /* vendor/product pairs that are known to contain this chipset */ #define PALMCONNECT_VID 0x0830 #define PALMCONNECT_PID 0x0080 #define KLSI_VID 0x05e9 #define KLSI_KL5KUSB105D_PID 0x00c0 /* Vendor commands: */ /* port table -- the chip supports up to 4 channels */ /* baud rates */ typedef enum { kl5kusb105a_sio_b115200 = 0, kl5kusb105a_sio_b57600 = 1, kl5kusb105a_sio_b38400 = 2, kl5kusb105a_sio_b19200 = 4, kl5kusb105a_sio_b14400 = 5, kl5kusb105a_sio_b9600 = 6, kl5kusb105a_sio_b4800 = 8, /* unchecked */ kl5kusb105a_sio_b2400 = 9, /* unchecked */ kl5kusb105a_sio_b1200 = 0xa, /* unchecked */ kl5kusb105a_sio_b600 = 0xb /* unchecked */ } KL5KUSB105A_SIO_baudrate_t; /* data bits */ #define kl5kusb105a_dtb_7 7 #define kl5kusb105a_dtb_8 8 /* requests: */ #define KL5KUSB105A_SIO_SET_DATA 1 #define KL5KUSB105A_SIO_POLL 2 #define KL5KUSB105A_SIO_CONFIGURE 3 /* values used for request KL5KUSB105A_SIO_CONFIGURE */ #define KL5KUSB105A_SIO_CONFIGURE_READ_ON 3 #define KL5KUSB105A_SIO_CONFIGURE_READ_OFF 2 /* Interpretation of modem status lines */ /* These need sorting out by individually connecting pins and checking * results. FIXME! * When data is being sent we see 0x30 in the lower byte; this must * contain DSR and CTS ... */ #define KL5KUSB105A_DSR ((1<<4) | (1<<5)) #define KL5KUSB105A_CTS ((1<<5) | (1<<4)) #define KL5KUSB105A_WANTS_TO_SEND 0x30 //#define KL5KUSB105A_DTR /* Data Terminal Ready */ //#define KL5KUSB105A_CTS /* Clear To Send */ //#define KL5KUSB105A_CD /* Carrier Detect */ //#define KL5KUSB105A_DSR /* Data Set Ready */ //#define KL5KUSB105A_RxD /* Receive pin */ //#define KL5KUSB105A_LE //#define KL5KUSB105A_RTS //#define KL5KUSB105A_ST //#define KL5KUSB105A_SR //#define KL5KUSB105A_RI /* Ring Indicator */ /* vim: set ts=8 sts=8: */ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:14
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/video In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/video Added Files: tridentfb.c tridentfb.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * Frame buffer driver for Trident Blade and Image series * * Copyright 2001,2002 - Jani Monoses <ja...@as...> * * $Id: tridentfb.c,v 1.1 2003/06/10 03:08:11 airlied Exp $ * * CREDITS:(in order of appearance) * skeletonfb.c by Geert Uytterhoeven and other fb code in drivers/video * Special thanks ;) to Mattia Crivellini <ti...@mc...> * much inspired by the XFree86 4.1.0 Trident driver sources by Alan Hourihane * the FreeVGA project * Francesco Salvestrini <sal...@us...> XP support,code,suggestions * NOTES: * Tested on Compaq Presario 12XL300 with CyberBladei1 * Tested on Toshiba 1800-514 with CyberBladeXPAi1 * No monitors were harmed during the writing of this driver * TODO: * timing value tweaking so it looks good on every monitor in every mode [...1268 lines suppressed...] return 0; } static struct fb_ops tridentfb_ops = { fb_get_fix:fbgen_get_fix, fb_get_var:fbgen_get_var, fb_set_var:fbgen_set_var, fb_get_cmap:fbgen_get_cmap, fb_set_cmap:fbgen_set_cmap, fb_pan_display:fbgen_pan_display, }; #ifdef MODULE module_init(tridentfb_init); #endif module_exit(tridentfb_exit); MODULE_AUTHOR("Jani Monoses <ja...@as...>"); MODULE_DESCRIPTION("Framebuffer driver for Trident cards"); MODULE_LICENSE("GPL"); --- NEW FILE --- #ifndef TRIDENTFB_DEBUG #define TRIDENTFB_DEBUG 0 #endif #if TRIDENTFB_DEBUG #define debug(f,a...) printk("%s:" f, __FUNCTION__ , ## a) #else #define debug(f,a...) #endif #define output(f, a...) printk("tridentfb: " f, ## a) #define Kb (1024) #define Mb (Kb*Kb) /* PCI IDS of supported cards temporarily here */ #define CYBER9320 0x9320 #define CYBER9388 0x9388 #define CYBER9397 0x9397 #define CYBER9397DVD 0x939A #define CYBER9520 0x9520 #define CYBER9525DVD 0x9525 #define IMAGE975 0x9750 #define IMAGE985 0x9850 #define BLADE3D 0x9880 #define CYBERBLADEE4 0x9540 #define CYBERBLADEi7 0x8400 #define CYBERBLADEi7D 0x8420 #define CYBERBLADEi1 0x8500 #define CYBERBLADEi1D 0x8520 #define CYBERBLADEAi1 0x8600 #define CYBERBLADEAi1D 0x8620 #define CYBERBLADEXPAi1 0x8820 #define CYBERBLADEXPm8 0x9910 #define CYBERBLADEXPm16 0x9930 /* acceleration families */ #define IMAGE 0 #define BLADE 1 #define XP 2 #define is_image() (family == IMAGE) #define is_blade() (family == BLADE) #define is_xp() (family == XP) /* these defines are for 'lcd' variable */ #define LCD_STRETCH 0 #define LCD_CENTER 1 #define LCD_BIOS 2 /* display types */ #define DISPLAY_CRT 0 #define DISPLAY_FP 1 #define flatpanel (displaytype == DISPLAY_FP) /* these are for defaultaccel variable */ #define ACCEL 1 #define NOACCEL 0 #define TRIDENT_IOSIZE 0x20000 #define NTSC 14.31818 #define PAL 17.73448 /* General Registers */ #define SPR 0x1F /* Software Programming Register (videoram) */ /* 3C4 */ #define RevisionID 0x09 #define OldOrNew 0x0B #define ConfPort1 0x0C #define ConfPort2 0x0C #define NewMode2 0x0D #define NewMode1 0x0E #define Protection 0x11 #define MCLKLow 0x16 #define MCLKHigh 0x17 #define ClockLow 0x18 #define ClockHigh 0x19 #define SSetup 0x20 #define SKey 0x37 #define SPKey 0x57 /* 0x3x4 */ #define CRTHTotal 0x00 #define CRTHDispEnd 0x01 #define CRTHBlankStart 0x02 #define CRTHBlankEnd 0x03 #define CRTHSyncStart 0x04 #define CRTHSyncEnd 0x05 #define CRTVTotal 0x06 #define CRTVDispEnd 0x12 #define CRTVBlankStart 0x15 #define CRTVBlankEnd 0x16 #define CRTVSyncStart 0x10 #define CRTVSyncEnd 0x11 #define CRTOverflow 0x07 #define CRTPRowScan 0x08 #define CRTMaxScanLine 0x09 #define CRTModeControl 0x17 #define CRTLineCompare 0x18 /* 3x4 */ #define StartAddrHigh 0x0C #define StartAddrLow 0x0D #define Offset 0x13 #define Underline 0x14 #define CRTCMode 0x17 #define CRTCModuleTest 0x1E #define FIFOControl 0x20 #define LinearAddReg 0x21 #define DRAMTiming 0x23 #define New32 0x23 #define RAMDACTiming 0x25 #define CRTHiOrd 0x27 #define AddColReg 0x29 #define InterfaceSel 0x2A #define HorizOverflow 0x2B #define GETest 0x2D #define Performance 0x2F #define GraphEngReg 0x36 #define I2C 0x37 #define PixelBusReg 0x38 #define PCIReg 0x39 #define DRAMControl 0x3A #define MiscContReg 0x3C #define CursorXLow 0x40 #define CursorXHigh 0x41 #define CursorYLow 0x42 #define CursorYHigh 0x43 #define CursorLocLow 0x44 #define CursorLocHigh 0x45 #define CursorXOffset 0x46 #define CursorYOffset 0x47 #define CursorFG1 0x48 #define CursorFG2 0x49 #define CursorFG3 0x4A #define CursorFG4 0x4B #define CursorBG1 0x4C #define CursorBG2 0x4D #define CursorBG3 0x4E #define CursorBG4 0x4F #define CursorControl 0x50 #define PCIRetry 0x55 #define PreEndControl 0x56 #define PreEndFetch 0x57 #define PCIMaster 0x60 #define Enhancement0 0x62 #define NewEDO 0x64 #define TVinterface 0xC0 #define TVMode 0xC1 #define ClockControl 0xCF /* 3CE */ #define MiscExtFunc 0x0F #define PowerStatus 0x23 #define MiscIntContReg 0x2F #define CyberControl 0x30 #define CyberEnhance 0x31 #define FPConfig 0x33 #define VertStretch 0x52 #define HorStretch 0x53 #define BiosMode 0x5c #define BiosReg 0x5d |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:12
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/sound/cs4281 In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/sound/cs4281 Added Files: cs4281_wrapper.h cs4281pm-24.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /******************************************************************************* * * "cs4281_wrapper.h" -- Cirrus Logic-Crystal CS4281 linux audio driver. * * Copyright (C) 2000,2001 Cirrus Logic Corp. * -- tom woller (tw...@cr...) or * (au...@cr...). * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * 12/22/00 trw - new file. * 04/18/01 trw - rework entire wrapper logic. * *******************************************************************************/ #ifndef __CS4281_WRAPPER_H #define __CS4281_WRAPPER_H /* 2.4.x wrapper */ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,12) static int cs4281_null_suspend(struct pci_dev *pcidev, u32 unused) { return 0; } static int cs4281_null_resume(struct pci_dev *pcidev) { return 0; } #else #define no_llseek cs4281_llseek static loff_t cs4281_llseek(struct file *file, loff_t offset, int origin) { return -ESPIPE; } void cs4281_null_suspend(struct pci_dev *pcidev) { return; } void cs4281_null_resume(struct pci_dev *pcidev) { return; } #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,3) /* Some versions of 2.4.2 resolve pci_set_dma_mask and some do not... * but 2.4.0 definitely does not */ #define pci_set_dma_mask(dev,data) 0; #else #endif #define cs4x_mem_map_reserve(page) mem_map_reserve(page) #define cs4x_mem_map_unreserve(page) mem_map_unreserve(page) #endif /* #ifndef __CS4281_WRAPPER_H */ --- NEW FILE --- /******************************************************************************* * * "cs4281pm-24.h" -- Cirrus Logic-Crystal CS4281 linux audio driver. * * Copyright (C) 2000,2001 Cirrus Logic Corp. * -- tom woller (tw...@cr...) or * (au...@cr...). * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * 2001.04.05 trw - new file. * *******************************************************************************/ #ifndef NOT_CS4281_PM #include <linux/pm.h> #include <linux/config.h> #include "cs4281pm.h" //#define CS4281_PCI_PM_SUPPORT_ENABLE 1 #if CS4281_PCI_PM_SUPPORT_ENABLE #define cs_pm_register(a, b, c) 0; #define cs_pm_unregister_all(a) /* * for now (12/22/00) only enable the pm_register PM support. * allow these table entries to be null. */ #define CS4281_SUSPEND_TBL cs4281_suspend_tbl #define CS4281_RESUME_TBL cs4281_resume_tbl #if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,12) static int cs4281_suspend_tbl(struct pci_dev *pcidev, u32 unused); static int cs4281_resume_tbl(struct pci_dev *pcidev); #else void cs4281_suspend_tbl(struct pci_dev *pcidev); void cs4281_resume_tbl(struct pci_dev *pcidev); #endif //LINUX_VERSION #else //CS4281_PCI_PM_SUPPORT_ENABLE #ifdef CONFIG_PM int cs4281_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *data); #define cs_pm_register(a, b, c) pm_register((a), (b), (c)); #define cs_pm_unregister_all(a) pm_unregister_all((a)); #define CS4281_SUSPEND_TBL cs4281_null_suspend #define CS4281_RESUME_TBL cs4281_null_resume #else #define cs_pm_register(a, b, c) 0; #define cs_pm_unregister_all(a) #define CS4281_SUSPEND_TBL cs4281_null_suspend #define CS4281_RESUME_TBL cs4281_null_resume #endif //CONFIG_PM #endif //CS4281_PCI_PM_SUPPORT_ENABLE #else #define cs_pm_register(a, b, c) 0; #define cs_pm_unregister_all(a) #define CS4281_SUSPEND_TBL cs4281_null_suspend #define CS4281_RESUME_TBL cs4281_null_resume #endif //NOT_CS4281_PM |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/s390 In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/s390 Added Files: sysinfo.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * drivers/s390/sysinfo.c * * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation * Author(s): Ulrich Weigand (Ulr...@de...) */ #include <linux/config.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/proc_fs.h> #include <linux/init.h> #include <asm/ebcdic.h> struct sysinfo_1_1_1 { char reserved_0[32]; char manufacturer[16]; char type[4]; char reserved_1[12]; char model[16]; char sequence[16]; char plant[4]; }; struct sysinfo_1_2_1 { char reserved_0[80]; char sequence[16]; char plant[4]; char reserved_1[2]; unsigned short cpu_address; }; struct sysinfo_1_2_2 { char reserved_0[32]; unsigned int capability; unsigned short cpus_total; unsigned short cpus_configured; unsigned short cpus_standby; unsigned short cpus_reserved; unsigned short adjustment[0]; }; struct sysinfo_2_2_1 { char reserved_0[80]; char sequence[16]; char plant[4]; unsigned short cpu_id; unsigned short cpu_address; }; struct sysinfo_2_2_2 { char reserved_0[32]; unsigned short lpar_number; char reserved_1; unsigned char characteristics; #define LPAR_CHAR_DEDICATED (1 << 7) #define LPAR_CHAR_SHARED (1 << 6) #define LPAR_CHAR_LIMITED (1 << 5) unsigned short cpus_total; unsigned short cpus_configured; unsigned short cpus_standby; unsigned short cpus_reserved; char name[8]; unsigned int caf; char reserved_2[16]; unsigned short cpus_dedicated; unsigned short cpus_shared; }; struct sysinfo_3_2_2 { char reserved_0[31]; unsigned char count; struct { char reserved_0[4]; unsigned short cpus_total; unsigned short cpus_configured; unsigned short cpus_standby; unsigned short cpus_reserved; char name[8]; unsigned int caf; char cpi[16]; char reserved_1[24]; } vm[8]; }; union s390_sysinfo { struct sysinfo_1_1_1 sysinfo_1_1_1; struct sysinfo_1_2_1 sysinfo_1_2_1; struct sysinfo_1_2_2 sysinfo_1_2_2; struct sysinfo_2_2_1 sysinfo_2_2_1; struct sysinfo_2_2_2 sysinfo_2_2_2; struct sysinfo_3_2_2 sysinfo_3_2_2; }; static inline int stsi (void *sysinfo, int fc, int sel1, int sel2) { int cc, retv; #ifndef CONFIG_ARCH_S390X __asm__ __volatile__ ( "lr\t0,%2\n" "\tlr\t1,%3\n" "\tstsi\t0(%4)\n" "0:\tipm\t%0\n" "\tsrl\t%0,28\n" "1:lr\t%1,0\n" ".section .fixup,\"ax\"\n" "2:\tlhi\t%0,3\n" "\tbras\t1,3f\n" "\t.long 1b\n" "3:\tl\t1,0(1)\n" "\tbr\t1\n" ".previous\n" ".section __ex_table,\"a\"\n" "\t.align 4\n" "\t.long 0b,2b\n" ".previous\n" : "=d" (cc), "=d" (retv) : "d" ((fc << 28) | sel1), "d" (sel2), "a" (sysinfo) : "cc", "memory", "0", "1" ); #else __asm__ __volatile__ ( "lr\t0,%2\n" "lr\t1,%3\n" "\tstsi\t0(%4)\n" "0:\tipm\t%0\n" "\tsrl\t%0,28\n" "1:lr\t%1,0\n" ".section .fixup,\"ax\"\n" "2:\tlhi\t%0,3\n" "\tjg\t1b\n" ".previous\n" ".section __ex_table,\"a\"\n" "\t.align 8\n" "\t.quad 0b,2b\n" ".previous\n" : "=d" (cc), "=d" (retv) : "d" ((fc << 28) | sel1), "d" (sel2), "a" (sysinfo) : "cc", "memory", "0", "1" ); #endif return cc? -1 : retv; } static inline int stsi_0 (void) { int rc = stsi (NULL, 0, 0, 0); return rc == -1 ? rc : (((unsigned int)rc) >> 28); } static inline int stsi_1_1_1 (struct sysinfo_1_1_1 *info) { int rc = stsi (info, 1, 1, 1); if (rc != -1) { EBCASC (info->manufacturer, sizeof(info->manufacturer)); EBCASC (info->type, sizeof(info->type)); EBCASC (info->model, sizeof(info->model)); EBCASC (info->sequence, sizeof(info->sequence)); EBCASC (info->plant, sizeof(info->plant)); } return rc == -1 ? rc : 0; } static inline int stsi_1_2_1 (struct sysinfo_1_2_1 *info) { int rc = stsi (info, 1, 2, 1); if (rc != -1) { EBCASC (info->sequence, sizeof(info->sequence)); EBCASC (info->plant, sizeof(info->plant)); } return rc == -1 ? rc : 0; } static inline int stsi_1_2_2 (struct sysinfo_1_2_2 *info) { int rc = stsi (info, 1, 2, 2); return rc == -1 ? rc : 0; } static inline int stsi_2_2_1 (struct sysinfo_2_2_1 *info) { int rc = stsi (info, 2, 2, 1); if (rc != -1) { EBCASC (info->sequence, sizeof(info->sequence)); EBCASC (info->plant, sizeof(info->plant)); } return rc == -1 ? rc : 0; } static inline int stsi_2_2_2 (struct sysinfo_2_2_2 *info) { int rc = stsi (info, 2, 2, 2); if (rc != -1) { EBCASC (info->name, sizeof(info->name)); } return rc == -1 ? rc : 0; } static inline int stsi_3_2_2 (struct sysinfo_3_2_2 *info) { int rc = stsi (info, 3, 2, 2); if (rc != -1) { int i; for (i = 0; i < info->count; i++) { EBCASC (info->vm[i].name, sizeof(info->vm[i].name)); EBCASC (info->vm[i].cpi, sizeof(info->vm[i].cpi)); } } return rc == -1 ? rc : 0; } static int proc_read_sysinfo(char *page, char **start, off_t off, int count, int *eof, void *data) { unsigned long info_page = get_free_page (GFP_KERNEL); union s390_sysinfo *info = (union s390_sysinfo *) info_page; int len = 0; int level; int i; if (!info) return 0; level = stsi_0 (); if (level < 1) goto out; if (stsi_1_1_1 (&info->sysinfo_1_1_1)) goto out; len += sprintf (page+len, "Manufacturer: %-16.16s\n", info->sysinfo_1_1_1.manufacturer); len += sprintf (page+len, "Type: %-4.4s\n", info->sysinfo_1_1_1.type); len += sprintf (page+len, "Model: %-16.16s\n", info->sysinfo_1_1_1.model); len += sprintf (page+len, "Sequence Code: %-16.16s\n", info->sysinfo_1_1_1.sequence); len += sprintf (page+len, "Plant: %-4.4s\n", info->sysinfo_1_1_1.plant); if (stsi_1_2_2 (&info->sysinfo_1_2_2)) goto out; len += sprintf (page+len, "\n"); len += sprintf (page+len, "CPUs Total: %d\n", info->sysinfo_1_2_2.cpus_total); len += sprintf (page+len, "CPUs Configured: %d\n", info->sysinfo_1_2_2.cpus_configured); len += sprintf (page+len, "CPUs Standby: %d\n", info->sysinfo_1_2_2.cpus_standby); len += sprintf (page+len, "CPUs Reserved: %d\n", info->sysinfo_1_2_2.cpus_reserved); len += sprintf (page+len, "Capability: %d\n", info->sysinfo_1_2_2.capability); for (i = 2; i <= info->sysinfo_1_2_2.cpus_total; i++) len += sprintf (page+len, "Adjustment %02d-way: %d\n", i, info->sysinfo_1_2_2.adjustment[i-2]); if (level < 2) goto out; if (stsi_2_2_2 (&info->sysinfo_2_2_2)) goto out; len += sprintf (page+len, "\n"); len += sprintf (page+len, "LPAR Number: %d\n", info->sysinfo_2_2_2.lpar_number); len += sprintf (page+len, "LPAR Characteristics: "); if (info->sysinfo_2_2_2.characteristics & LPAR_CHAR_DEDICATED) len += sprintf (page+len, "Dedicated "); if (info->sysinfo_2_2_2.characteristics & LPAR_CHAR_SHARED) len += sprintf (page+len, "Shared "); if (info->sysinfo_2_2_2.characteristics & LPAR_CHAR_LIMITED) len += sprintf (page+len, "Limited "); len += sprintf (page+len, "\n"); len += sprintf (page+len, "LPAR Name: %-8.8s\n", info->sysinfo_2_2_2.name); len += sprintf (page+len, "LPAR Adjustment: %d\n", info->sysinfo_2_2_2.caf); len += sprintf (page+len, "LPAR CPUs Total: %d\n", info->sysinfo_2_2_2.cpus_total); len += sprintf (page+len, "LPAR CPUs Configured: %d\n", info->sysinfo_2_2_2.cpus_configured); len += sprintf (page+len, "LPAR CPUs Standby: %d\n", info->sysinfo_2_2_2.cpus_standby); len += sprintf (page+len, "LPAR CPUs Reserved: %d\n", info->sysinfo_2_2_2.cpus_reserved); len += sprintf (page+len, "LPAR CPUs Dedicated: %d\n", info->sysinfo_2_2_2.cpus_dedicated); len += sprintf (page+len, "LPAR CPUs Shared: %d\n", info->sysinfo_2_2_2.cpus_shared); if (level < 3) goto out; if (stsi_3_2_2 (&info->sysinfo_3_2_2)) goto out; for (i = 0; i < info->sysinfo_3_2_2.count; i++) { len += sprintf (page+len, "\n"); len += sprintf (page+len, "VM%02d Name: %-8.8s\n", i, info->sysinfo_3_2_2.vm[i].name); len += sprintf (page+len, "VM%02d Control Program: %-16.16s\n", i, info->sysinfo_3_2_2.vm[i].cpi); len += sprintf (page+len, "VM%02d Adjustment: %d\n", i, info->sysinfo_3_2_2.vm[i].caf); len += sprintf (page+len, "VM%02d CPUs Total: %d\n", i, info->sysinfo_3_2_2.vm[i].cpus_total); len += sprintf (page+len, "VM%02d CPUs Configured: %d\n", i, info->sysinfo_3_2_2.vm[i].cpus_configured); len += sprintf (page+len, "VM%02d CPUs Standby: %d\n", i, info->sysinfo_3_2_2.vm[i].cpus_standby); len += sprintf (page+len, "VM%02d CPUs Reserved: %d\n", i, info->sysinfo_3_2_2.vm[i].cpus_reserved); } out: free_page (info_page); return len; } static __init int create_proc_sysinfo(void) { create_proc_read_entry ("sysinfo", 0444, NULL, proc_read_sysinfo, NULL); return 0; } __initcall(create_proc_sysinfo); |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/net Added Files: mii.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* mii.c: MII interface library Maintained by Jeff Garzik <jg...@ma...> Copyright 2001 Jeff Garzik */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/netdevice.h> #include <linux/ethtool.h> #include <linux/mii.h> int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) { struct net_device *dev = mii->dev; u32 advert, bmcr, lpa, nego; ecmd->supported = (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full | SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Full | SUPPORTED_Autoneg | SUPPORTED_TP | SUPPORTED_MII); /* only supports twisted-pair */ ecmd->port = PORT_MII; /* only supports internal transceiver */ ecmd->transceiver = XCVR_INTERNAL; /* this isn't fully supported at higher layers */ ecmd->phy_address = mii->phy_id; ecmd->advertising = ADVERTISED_TP | ADVERTISED_MII; advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE); if (advert & ADVERTISE_10HALF) ecmd->advertising |= ADVERTISED_10baseT_Half; if (advert & ADVERTISE_10FULL) ecmd->advertising |= ADVERTISED_10baseT_Full; if (advert & ADVERTISE_100HALF) ecmd->advertising |= ADVERTISED_100baseT_Half; if (advert & ADVERTISE_100FULL) ecmd->advertising |= ADVERTISED_100baseT_Full; bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); lpa = mii->mdio_read(dev, mii->phy_id, MII_LPA); if (bmcr & BMCR_ANENABLE) { ecmd->advertising |= ADVERTISED_Autoneg; ecmd->autoneg = AUTONEG_ENABLE; nego = mii_nway_result(advert & lpa); if (nego == LPA_100FULL || nego == LPA_100HALF) ecmd->speed = SPEED_100; else ecmd->speed = SPEED_10; if (nego == LPA_100FULL || nego == LPA_10FULL) { ecmd->duplex = DUPLEX_FULL; mii->full_duplex = 1; } else { ecmd->duplex = DUPLEX_HALF; mii->full_duplex = 0; } } else { ecmd->autoneg = AUTONEG_DISABLE; ecmd->speed = (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10; ecmd->duplex = (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF; } /* ignore maxtxpkt, maxrxpkt for now */ return 0; } int mii_ethtool_sset(struct mii_if_info *mii, struct ethtool_cmd *ecmd) { struct net_device *dev = mii->dev; if (ecmd->speed != SPEED_10 && ecmd->speed != SPEED_100) return -EINVAL; if (ecmd->duplex != DUPLEX_HALF && ecmd->duplex != DUPLEX_FULL) return -EINVAL; if (ecmd->port != PORT_MII) return -EINVAL; if (ecmd->transceiver != XCVR_INTERNAL) return -EINVAL; if (ecmd->phy_address != mii->phy_id) return -EINVAL; if (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE) return -EINVAL; /* ignore supported, maxtxpkt, maxrxpkt */ if (ecmd->autoneg == AUTONEG_ENABLE) { u32 bmcr, advert, tmp; if ((ecmd->advertising & (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full)) == 0) return -EINVAL; /* advertise only what has been requested */ advert = mii->mdio_read(dev, mii->phy_id, MII_ADVERTISE); tmp = advert & ~(ADVERTISE_ALL | ADVERTISE_100BASE4); if (ADVERTISED_10baseT_Half) tmp |= ADVERTISE_10HALF; if (ADVERTISED_10baseT_Full) tmp |= ADVERTISE_10FULL; if (ADVERTISED_100baseT_Half) tmp |= ADVERTISE_100HALF; if (ADVERTISED_100baseT_Full) tmp |= ADVERTISE_100FULL; if (advert != tmp) { mii->mdio_write(dev, mii->phy_id, MII_ADVERTISE, tmp); mii->advertising = tmp; } /* turn on autonegotiation, and force a renegotiate */ bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART); mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr); mii->duplex_lock = 0; } else { u32 bmcr, tmp; /* turn off auto negotiation, set speed and duplexity */ bmcr = mii->mdio_read(dev, mii->phy_id, MII_BMCR); tmp = bmcr & ~(BMCR_ANENABLE | BMCR_SPEED100 | BMCR_FULLDPLX); if (ecmd->speed == SPEED_100) bmcr |= BMCR_SPEED100; if (ecmd->duplex == DUPLEX_FULL) { bmcr |= BMCR_FULLDPLX; mii->full_duplex = 1; } else mii->full_duplex = 0; if (bmcr != tmp) mii->mdio_write(dev, mii->phy_id, MII_BMCR, bmcr); mii->duplex_lock = 1; } return 0; } int mii_link_ok (struct mii_if_info *mii) { if (mii->mdio_read(mii->dev, mii->phy_id, MII_BMSR) & BMSR_LSTATUS) return 1; return 0; } int mii_nway_restart (struct mii_if_info *mii) { int bmcr; int r = -EINVAL; /* if autoneg is off, it's an error */ bmcr = mii->mdio_read(mii->dev, mii->phy_id, MII_BMCR); if (bmcr & BMCR_ANENABLE) { bmcr |= BMCR_ANRESTART; mii->mdio_write(mii->dev, mii->phy_id, MII_BMCR, bmcr); r = 0; } return r; } MODULE_AUTHOR ("Jeff Garzik <jg...@ma...>"); MODULE_DESCRIPTION ("MII hardware support library"); MODULE_LICENSE("GPL"); EXPORT_SYMBOL(mii_link_ok); EXPORT_SYMBOL(mii_nway_restart); EXPORT_SYMBOL(mii_ethtool_gset); EXPORT_SYMBOL(mii_ethtool_sset); |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:11
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/net/wireless In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/net/wireless Added Files: hermes_rid.h ieee802_11.h Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- #ifndef _HERMES_RID_H #define _HERMES_RID_H /* * Configuration RIDs */ #define HERMES_RID_CNFPORTTYPE 0xFC00 /* used */ #define HERMES_RID_CNFOWNMACADDR 0xFC01 /* used */ #define HERMES_RID_CNFDESIREDSSID 0xFC02 /* used */ #define HERMES_RID_CNFOWNCHANNEL 0xFC03 /* used */ #define HERMES_RID_CNFOWNSSID 0xFC04 /* used */ #define HERMES_RID_CNFOWNATIMWINDOW 0xFC05 #define HERMES_RID_CNFSYSTEMSCALE 0xFC06 /* used */ #define HERMES_RID_CNFMAXDATALEN 0xFC07 #define HERMES_RID_CNFWDSADDRESS 0xFC08 #define HERMES_RID_CNFPMENABLED 0xFC09 /* used */ #define HERMES_RID_CNFPMEPS 0xFC0A #define HERMES_RID_CNFMULTICASTRECEIVE 0xFC0B /* used */ #define HERMES_RID_CNFMAXSLEEPDURATION 0xFC0C /* used */ #define HERMES_RID_CNFPMHOLDOVERDURATION 0xFC0D /* used */ #define HERMES_RID_CNFOWNNAME 0xFC0E /* used */ #define HERMES_RID_CNFOWNDTIMPERIOD 0xFC10 #define HERMES_RID_CNFWDSADDRESS1 0xFC11 #define HERMES_RID_CNFWDSADDRESS2 0xFC12 #define HERMES_RID_CNFWDSADDRESS3 0xFC13 #define HERMES_RID_CNFWDSADDRESS4 0xFC14 #define HERMES_RID_CNFWDSADDRESS5 0xFC15 #define HERMES_RID_CNFWDSADDRESS6 0xFC16 #define HERMES_RID_CNFMULTICASTPMBUFFERING 0xFC17 #define HERMES_RID_CNFWEPENABLED_AGERE 0xFC20 /* used */ #define HERMES_RID_CNFMANDATORYBSSID_SYMBOL 0xFC21 #define HERMES_RID_CNFWEPDEFAULTKEYID 0xFC23 /* used */ #define HERMES_RID_CNFDEFAULTKEY0 0xFC24 /* used */ #define HERMES_RID_CNFDEFAULTKEY1 0xFC25 /* used */ #define HERMES_RID_CNFMWOROBUST_AGERE 0xFC25 /* used */ #define HERMES_RID_CNFDEFAULTKEY2 0xFC26 /* used */ #define HERMES_RID_CNFDEFAULTKEY3 0xFC27 /* used */ #define HERMES_RID_CNFWEPFLAGS_INTERSIL 0xFC28 /* used */ #define HERMES_RID_CNFWEPKEYMAPPINGTABLE 0xFC29 #define HERMES_RID_CNFAUTHENTICATION 0xFC2A /* used */ #define HERMES_RID_CNFMAXASSOCSTA 0xFC2B #define HERMES_RID_CNFKEYLENGTH_SYMBOL 0xFC2B #define HERMES_RID_CNFTXCONTROL 0xFC2C #define HERMES_RID_CNFROAMINGMODE 0xFC2D #define HERMES_RID_CNFHOSTAUTHENTICATION 0xFC2E #define HERMES_RID_CNFRCVCRCERROR 0xFC30 #define HERMES_RID_CNFMMLIFE 0xFC31 #define HERMES_RID_CNFALTRETRYCOUNT 0xFC32 #define HERMES_RID_CNFBEACONINT 0xFC33 #define HERMES_RID_CNFAPPCFINFO 0xFC34 #define HERMES_RID_CNFSTAPCFINFO 0xFC35 #define HERMES_RID_CNFPRIORITYQUSAGE 0xFC37 #define HERMES_RID_CNFTIMCTRL 0xFC40 #define HERMES_RID_CNFTHIRTY2TALLY 0xFC42 #define HERMES_RID_CNFENHSECURITY 0xFC43 #define HERMES_RID_CNFGROUPADDRESSES 0xFC80 /* used */ #define HERMES_RID_CNFCREATEIBSS 0xFC81 /* used */ #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD 0xFC82 /* used */ #define HERMES_RID_CNFRTSTHRESHOLD 0xFC83 /* used */ #define HERMES_RID_CNFTXRATECONTROL 0xFC84 /* used */ #define HERMES_RID_CNFPROMISCUOUSMODE 0xFC85 /* used */ #define HERMES_RID_CNFBASICRATES_SYMBOL 0xFC8A #define HERMES_RID_CNFPREAMBLE_SYMBOL 0xFC8C /* used */ #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD0 0xFC90 #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD1 0xFC91 #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD2 0xFC92 #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD3 0xFC93 #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD4 0xFC94 #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD5 0xFC95 #define HERMES_RID_CNFFRAGMENTATIONTHRESHOLD6 0xFC96 #define HERMES_RID_CNFRTSTHRESHOLD0 0xFC97 #define HERMES_RID_CNFRTSTHRESHOLD1 0xFC98 #define HERMES_RID_CNFRTSTHRESHOLD2 0xFC99 #define HERMES_RID_CNFRTSTHRESHOLD3 0xFC9A #define HERMES_RID_CNFRTSTHRESHOLD4 0xFC9B #define HERMES_RID_CNFRTSTHRESHOLD5 0xFC9C #define HERMES_RID_CNFRTSTHRESHOLD6 0xFC9D #define HERMES_RID_CNFSHORTPREAMBLE 0xFCB0 #define HERMES_RID_CNFWEPKEYS_AGERE 0xFCB0 /* used */ #define HERMES_RID_CNFEXCLUDELONGPREAMBLE 0xFCB1 #define HERMES_RID_CNFTXKEY_AGERE 0xFCB1 /* used */ #define HERMES_RID_CNFAUTHENTICATIONRSPTO 0xFCB2 #define HERMES_RID_CNFBASICRATES 0xFCB3 #define HERMES_RID_CNFSUPPORTEDRATES 0xFCB4 #define HERMES_RID_CNFTICKTIME 0xFCE0 /* used */ #define HERMES_RID_CNFSCANREQUEST 0xFCE1 #define HERMES_RID_CNFJOINREQUEST 0xFCE2 #define HERMES_RID_CNFAUTHENTICATESTATION 0xFCE3 #define HERMES_RID_CNFCHANNELINFOREQUEST 0xFCE4 /* * Information RIDs */ #define HERMES_RID_MAXLOADTIME 0xFD00 #define HERMES_RID_DOWNLOADBUFFER 0xFD01 #define HERMES_RID_PRIID 0xFD02 #define HERMES_RID_PRISUPRANGE 0xFD03 #define HERMES_RID_CFIACTRANGES 0xFD04 #define HERMES_RID_NICSERNUM 0xFD0A #define HERMES_RID_NICID 0xFD0B #define HERMES_RID_MFISUPRANGE 0xFD0C #define HERMES_RID_CFISUPRANGE 0xFD0D #define HERMES_RID_CHANNELLIST 0xFD10 /* used */ #define HERMES_RID_REGULATORYDOMAINS 0xFD11 #define HERMES_RID_TEMPTYPE 0xFD12 #define HERMES_RID_CIS 0xFD13 #define HERMES_RID_STAID 0xFD20 /* used */ #define HERMES_RID_STASUPRANGE 0xFD21 #define HERMES_RID_MFIACTRANGES 0xFD22 #define HERMES_RID_CFIACTRANGES2 0xFD23 #define HERMES_RID_SECONDARYVERSION_SYMBOL 0xFD24 /* used */ #define HERMES_RID_PORTSTATUS 0xFD40 #define HERMES_RID_CURRENTSSID 0xFD41 /* used */ #define HERMES_RID_CURRENTBSSID 0xFD42 /* used */ #define HERMES_RID_COMMSQUALITY 0xFD43 /* used */ #define HERMES_RID_CURRENTTXRATE 0xFD44 /* used */ #define HERMES_RID_CURRENTBEACONINTERVAL 0xFD45 #define HERMES_RID_CURRENTSCALETHRESHOLDS 0xFD46 #define HERMES_RID_PROTOCOLRSPTIME 0xFD47 #define HERMES_RID_SHORTRETRYLIMIT 0xFD48 /* used */ #define HERMES_RID_LONGRETRYLIMIT 0xFD49 /* used */ #define HERMES_RID_MAXTRANSMITLIFETIME 0xFD4A /* used */ #define HERMES_RID_MAXRECEIVELIFETIME 0xFD4B #define HERMES_RID_CFPOLLABLE 0xFD4C #define HERMES_RID_AUTHENTICATIONALGORITHMS 0xFD4D #define HERMES_RID_PRIVACYOPTIONIMPLEMENTED 0xFD4F #define HERMES_RID_CURRENTTXRATE1 0xFD80 #define HERMES_RID_CURRENTTXRATE2 0xFD81 #define HERMES_RID_CURRENTTXRATE3 0xFD82 #define HERMES_RID_CURRENTTXRATE4 0xFD83 #define HERMES_RID_CURRENTTXRATE5 0xFD84 #define HERMES_RID_CURRENTTXRATE6 0xFD85 #define HERMES_RID_OWNMACADDR 0xFD86 #define HERMES_RID_SCANRESULTSTABLE 0xFD88 #define HERMES_RID_PHYTYPE 0xFDC0 #define HERMES_RID_CURRENTCHANNEL 0xFDC1 /* used */ #define HERMES_RID_CURRENTPOWERSTATE 0xFDC2 #define HERMES_RID_CCAMODE 0xFDC3 #define HERMES_RID_SUPPORTEDDATARATES 0xFDC6 /* used */ #define HERMES_RID_BUILDSEQ 0xFFFE #define HERMES_RID_FWID 0xFFFF /* "ID" structure - used for ESSID and station nickname */ struct hermes_idstring { u16 len; u16 val[16]; } __attribute__ ((packed)); typedef struct hermes_multicast { u8 addr[HERMES_MAX_MULTICAST][ETH_ALEN]; } __attribute__ ((packed)) hermes_multicast_t; #endif --- NEW FILE --- #ifndef _IEEE802_11_H #define _IEEE802_11_H struct ieee802_11_hdr { u16 frame_ctl; u16 duration_id; u8 addr1[ETH_ALEN]; u8 addr2[ETH_ALEN]; u8 addr3[ETH_ALEN]; u16 seq_ctl; u8 addr4[ETH_ALEN]; u16 data_len; } __attribute__ ((packed)); /* Frame control field constants */ #define IEEE802_11_FCTL_VERS 0x0002 #define IEEE802_11_FCTL_FTYPE 0x000c #define IEEE802_11_FCTL_STYPE 0x00f0 #define IEEE802_11_FCTL_TODS 0x0100 #define IEEE802_11_FCTL_FROMDS 0x0200 #define IEEE802_11_FCTL_MOREFRAGS 0x0400 #define IEEE802_11_FCTL_RETRY 0x0800 #define IEEE802_11_FCTL_PM 0x1000 #define IEEE802_11_FCTL_MOREDATA 0x2000 #define IEEE802_11_FCTL_WEP 0x4000 #define IEEE802_11_FCTL_ORDER 0x8000 #define IEEE802_11_FTYPE_MGMT 0x0000 #define IEEE802_11_FTYPE_CTL 0x0004 #define IEEE802_11_FTYPE_DATA 0x0008 /* management */ #define IEEE802_11_STYPE_ASSOC_REQ 0x0000 #define IEEE802_11_STYPE_ASSOC_RESP 0x0010 #define IEEE802_11_STYPE_REASSOC_REQ 0x0020 #define IEEE802_11_STYPE_REASSOC_RESP 0x0030 #define IEEE802_11_STYPE_PROBE_REQ 0x0040 #define IEEE802_11_STYPE_PROBE_RESP 0x0050 #define IEEE802_11_STYPE_BEACON 0x0080 #define IEEE802_11_STYPE_ATIM 0x0090 #define IEEE802_11_STYPE_DISASSOC 0x00A0 #define IEEE802_11_STYPE_AUTH 0x00B0 #define IEEE802_11_STYPE_DEAUTH 0x00C0 /* control */ #define IEEE802_11_STYPE_PSPOLL 0x00A0 #define IEEE802_11_STYPE_RTS 0x00B0 #define IEEE802_11_STYPE_CTS 0x00C0 #define IEEE802_11_STYPE_ACK 0x00D0 #define IEEE802_11_STYPE_CFEND 0x00E0 #define IEEE802_11_STYPE_CFENDACK 0x00F0 /* data */ #define IEEE802_11_STYPE_DATA 0x0000 #define IEEE802_11_STYPE_DATA_CFACK 0x0010 #define IEEE802_11_STYPE_DATA_CFPOLL 0x0020 #define IEEE802_11_STYPE_DATA_CFACKPOLL 0x0030 #define IEEE802_11_STYPE_NULLFUNC 0x0040 #define IEEE802_11_STYPE_CFACK 0x0050 #define IEEE802_11_STYPE_CFPOLL 0x0060 #define IEEE802_11_STYPE_CFACKPOLL 0x0070 #define IEEE802_11_SCTL_FRAG 0x000F #define IEEE802_11_SCTL_SEQ 0xFFF0 #endif /* _IEEE802_11_H */ |
From: Dave A. <ai...@us...> - 2003-06-10 03:08:10
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/macintosh In directory sc8-pr-cvs1:/tmp/cvs-serv14646/drivers/macintosh Added Files: ans-lcd.c apm_emu.c Log Message: DA: additional files from 2.4.1[78] kernels.. --- NEW FILE --- /* * /dev/lcd driver for Apple Network Servers. */ #include <linux/types.h> #include <linux/errno.h> #include <linux/kernel.h> #include <linux/miscdevice.h> #include <linux/fcntl.h> #include <linux/init.h> #include <linux/delay.h> #include <asm/uaccess.h> #include <asm/sections.h> #include <asm/prom.h> #include <asm/ans-lcd.h> #include <asm/io.h> #define ANSLCD_ADDR 0xf301c000 #define ANSLCD_CTRL_IX 0x00 #define ANSLCD_DATA_IX 0x10 static unsigned long anslcd_short_delay = 80; static unsigned long anslcd_long_delay = 3280; static volatile unsigned char* anslcd_ptr; #undef DEBUG static void __pmac anslcd_write_byte_ctrl ( unsigned char c ) { #ifdef DEBUG printk(KERN_DEBUG "LCD: CTRL byte: %02x\n",c); #endif out_8(anslcd_ptr + ANSLCD_CTRL_IX, c); switch(c) { case 1: case 2: case 3: udelay(anslcd_long_delay); break; default: udelay(anslcd_short_delay); } } static void __pmac anslcd_write_byte_data ( unsigned char c ) { out_8(anslcd_ptr + ANSLCD_DATA_IX, c); udelay(anslcd_short_delay); } static ssize_t __pmac anslcd_write( struct file * file, const char * buf, size_t count, loff_t *ppos ) { const char * p = buf; int i; #ifdef DEBUG printk(KERN_DEBUG "LCD: write\n"); #endif if ( verify_area(VERIFY_READ, buf, count) ) return -EFAULT; for ( i = *ppos; count > 0; ++i, ++p, --count ) { char c; __get_user(c, p); anslcd_write_byte_data( c ); } *ppos = i; return p - buf; } static int __pmac anslcd_ioctl( struct inode * inode, struct file * file, unsigned int cmd, unsigned long arg ) { char ch, *temp; #ifdef DEBUG printk(KERN_DEBUG "LCD: ioctl(%d,%d)\n",cmd,arg); #endif switch ( cmd ) { case ANSLCD_CLEAR: anslcd_write_byte_ctrl ( 0x38 ); anslcd_write_byte_ctrl ( 0x0f ); anslcd_write_byte_ctrl ( 0x06 ); anslcd_write_byte_ctrl ( 0x01 ); anslcd_write_byte_ctrl ( 0x02 ); return 0; case ANSLCD_SENDCTRL: temp = (char *) arg; __get_user(ch, temp); for (; ch; temp++) { /* FIXME: This is ugly, but should work, as a \0 byte is not a valid command code */ anslcd_write_byte_ctrl ( ch ); __get_user(ch, temp); } return 0; case ANSLCD_SETSHORTDELAY: if (!capable(CAP_SYS_ADMIN)) return -EACCES; anslcd_short_delay=arg; return 0; case ANSLCD_SETLONGDELAY: if (!capable(CAP_SYS_ADMIN)) return -EACCES; anslcd_long_delay=arg; return 0; default: return -EINVAL; } } static int __pmac anslcd_open( struct inode * inode, struct file * file ) { return 0; } struct file_operations anslcd_fops = { write: anslcd_write, ioctl: anslcd_ioctl, open: anslcd_open, }; static struct miscdevice anslcd_dev = { ANSLCD_MINOR, "anslcd", &anslcd_fops }; const char anslcd_logo[] = "********************" /* Line #1 */ "* LINUX! *" /* Line #3 */ "* Welcome to *" /* Line #2 */ "********************"; /* Line #4 */ int __init anslcd_init(void) { int a; struct device_node* node; node = find_devices("lcd"); if (!node || !node->parent) return -ENODEV; if (strcmp(node->parent->name, "gc")) return -ENODEV; anslcd_ptr = (volatile unsigned char*)ioremap(ANSLCD_ADDR, 0x20); misc_register(&anslcd_dev); #ifdef DEBUG printk(KERN_DEBUG "LCD: init\n"); #endif anslcd_write_byte_ctrl ( 0x38 ); anslcd_write_byte_ctrl ( 0x0c ); anslcd_write_byte_ctrl ( 0x06 ); anslcd_write_byte_ctrl ( 0x01 ); anslcd_write_byte_ctrl ( 0x02 ); for(a=0;a<80;a++) { anslcd_write_byte_data(anslcd_logo[a]); } return 0; } __initcall(anslcd_init); --- NEW FILE --- /* APM emulation layer for PowerMac * * Copyright 2001 Benjamin Herrenschmidt (be...@ke...) * * Lots of code inherited from apm.c, see appropriate notice in * arch/i386/kernel/apm.c * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * */ #include <linux/config.h> #include <linux/module.h> #include <linux/poll.h> #include <linux/types.h> #include <linux/stddef.h> #include <linux/timer.h> #include <linux/fcntl.h> #include <linux/slab.h> #include <linux/stat.h> #include <linux/proc_fs.h> #include <linux/miscdevice.h> #include <linux/apm_bios.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/pm.h> #include <linux/kernel.h> #include <linux/smp_lock.h> #include <linux/adb.h> #include <linux/pmu.h> #include <asm/system.h> #include <asm/uaccess.h> #include <asm/machdep.h> #undef DEBUG #ifdef DEBUG #define DBG(args...) printk(KERN_DEBUG args) //#define DBG(args...) xmon_printf(args) #else #define DBG(args...) do { } while (0) #endif /* * The apm_bios device is one of the misc char devices. * This is its minor number. */ #define APM_MINOR_DEV 134 /* * Maximum number of events stored */ #define APM_MAX_EVENTS 20 #define FAKE_APM_BIOS_VERSION 0x0101 #define APM_USER_NOTIFY_TIMEOUT (5*HZ) /* * The per-file APM data */ struct apm_user { int magic; struct apm_user * next; int suser: 1; int suspend_waiting: 1; int suspends_pending; int suspends_read; int event_head; int event_tail; apm_event_t events[APM_MAX_EVENTS]; }; /* * The magic number in apm_user */ #define APM_BIOS_MAGIC 0x4101 /* * Local variables */ static int suspends_pending; static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); static struct apm_user * user_list; static int apm_notify_sleep(struct pmu_sleep_notifier *self, int when); static struct pmu_sleep_notifier apm_sleep_notifier = { apm_notify_sleep, SLEEP_LEVEL_USERLAND, }; static char driver_version[] = "0.5"; /* no spaces */ #ifdef DEBUG static char * apm_event_name[] = { "system standby", "system suspend", "normal resume", "critical resume", "low battery", "power status change", "update time", "critical suspend", "user standby", "user suspend", "system standby resume", "capabilities change" }; #define NR_APM_EVENT_NAME \ (sizeof(apm_event_name) / sizeof(apm_event_name[0])) #endif static int queue_empty(struct apm_user *as) { return as->event_head == as->event_tail; } static apm_event_t get_queued_event(struct apm_user *as) { as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; return as->events[as->event_tail]; } static void queue_event(apm_event_t event, struct apm_user *sender) { struct apm_user * as; DBG("apm_emu: queue_event(%s)\n", apm_event_name[event-1]); if (user_list == NULL) return; for (as = user_list; as != NULL; as = as->next) { if (as == sender) continue; as->event_head = (as->event_head + 1) % APM_MAX_EVENTS; if (as->event_head == as->event_tail) { static int notified; if (notified++ == 0) printk(KERN_ERR "apm_emu: an event queue overflowed\n"); as->event_tail = (as->event_tail + 1) % APM_MAX_EVENTS; } as->events[as->event_head] = event; if (!as->suser) continue; switch (event) { case APM_SYS_SUSPEND: case APM_USER_SUSPEND: as->suspends_pending++; suspends_pending++; break; case APM_NORMAL_RESUME: as->suspend_waiting = 0; break; } } wake_up_interruptible(&apm_waitqueue); } static int check_apm_user(struct apm_user *as, const char *func) { if ((as == NULL) || (as->magic != APM_BIOS_MAGIC)) { printk(KERN_ERR "apm_emu: %s passed bad filp\n", func); return 1; } return 0; } static ssize_t do_read(struct file *fp, char *buf, size_t count, loff_t *ppos) { struct apm_user * as; int i; apm_event_t event; DECLARE_WAITQUEUE(wait, current); as = fp->private_data; if (check_apm_user(as, "read")) return -EIO; if (count < sizeof(apm_event_t)) return -EINVAL; if (queue_empty(as)) { if (fp->f_flags & O_NONBLOCK) return -EAGAIN; add_wait_queue(&apm_waitqueue, &wait); repeat: set_current_state(TASK_INTERRUPTIBLE); if (queue_empty(as) && !signal_pending(current)) { schedule(); goto repeat; } set_current_state(TASK_RUNNING); remove_wait_queue(&apm_waitqueue, &wait); } i = count; while ((i >= sizeof(event)) && !queue_empty(as)) { event = get_queued_event(as); DBG("apm_emu: do_read, returning: %s\n", apm_event_name[event-1]); if (copy_to_user(buf, &event, sizeof(event))) { if (i < count) break; return -EFAULT; } switch (event) { case APM_SYS_SUSPEND: case APM_USER_SUSPEND: as->suspends_read++; break; } buf += sizeof(event); i -= sizeof(event); } if (i < count) return count - i; if (signal_pending(current)) return -ERESTARTSYS; return 0; } static unsigned int do_poll(struct file *fp, poll_table * wait) { struct apm_user * as; as = fp->private_data; if (check_apm_user(as, "poll")) return 0; poll_wait(fp, &apm_waitqueue, wait); if (!queue_empty(as)) return POLLIN | POLLRDNORM; return 0; } static int do_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg) { struct apm_user * as; DECLARE_WAITQUEUE(wait, current); as = filp->private_data; if (check_apm_user(as, "ioctl")) return -EIO; if (!as->suser) return -EPERM; switch (cmd) { case APM_IOC_SUSPEND: /* If a suspend message was sent to userland, we * consider this as a confirmation message */ if (as->suspends_read > 0) { as->suspends_read--; as->suspends_pending--; suspends_pending--; } else { // Route to PMU suspend ? break; } as->suspend_waiting = 1; add_wait_queue(&apm_waitqueue, &wait); DBG("apm_emu: ioctl waking up sleep waiter !\n"); wake_up(&apm_suspend_waitqueue); mb(); while(as->suspend_waiting && !signal_pending(current)) { set_current_state(TASK_INTERRUPTIBLE); schedule(); } set_current_state(TASK_RUNNING); remove_wait_queue(&apm_waitqueue, &wait); break; default: return -EINVAL; } return 0; } static int do_release(struct inode * inode, struct file * filp) { struct apm_user * as; as = filp->private_data; if (check_apm_user(as, "release")) return 0; filp->private_data = NULL; lock_kernel(); if (as->suspends_pending > 0) { suspends_pending -= as->suspends_pending; if (suspends_pending <= 0) wake_up(&apm_suspend_waitqueue); } if (user_list == as) user_list = as->next; else { struct apm_user * as1; for (as1 = user_list; (as1 != NULL) && (as1->next != as); as1 = as1->next) ; if (as1 == NULL) printk(KERN_ERR "apm: filp not in user list\n"); else as1->next = as->next; } unlock_kernel(); kfree(as); return 0; } static int do_open(struct inode * inode, struct file * filp) { struct apm_user * as; as = (struct apm_user *)kmalloc(sizeof(*as), GFP_KERNEL); if (as == NULL) { printk(KERN_ERR "apm: cannot allocate struct of size %d bytes\n", sizeof(*as)); return -ENOMEM; } as->magic = APM_BIOS_MAGIC; as->event_tail = as->event_head = 0; as->suspends_pending = 0; as->suspends_read = 0; /* * XXX - this is a tiny bit broken, when we consider BSD * process accounting. If the device is opened by root, we * instantly flag that we used superuser privs. Who knows, * we might close the device immediately without doing a * privileged operation -- cevans */ as->suser = capable(CAP_SYS_ADMIN); as->next = user_list; user_list = as; filp->private_data = as; DBG("apm_emu: opened by %s, suser: %d\n", current->comm, (int)as->suser); return 0; } /* Wait for all clients to ack the suspend request. APM API * doesn't provide a way to NAK, but this could be added * here. */ static int wait_all_suspend(void) { DECLARE_WAITQUEUE(wait, current); add_wait_queue(&apm_suspend_waitqueue, &wait); DBG("apm_emu: wait_all_suspend(), suspends_pending: %d\n", suspends_pending); while(suspends_pending > 0) { set_current_state(TASK_UNINTERRUPTIBLE); schedule(); } set_current_state(TASK_RUNNING); remove_wait_queue(&apm_suspend_waitqueue, &wait); DBG("apm_emu: wait_all_suspend() - complete !\n"); return 1; } static int apm_notify_sleep(struct pmu_sleep_notifier *self, int when) { switch(when) { case PBOOK_SLEEP_REQUEST: queue_event(APM_SYS_SUSPEND, NULL); if (!wait_all_suspend()) return PBOOK_SLEEP_REFUSE; break; case PBOOK_SLEEP_REJECT: case PBOOK_WAKE: queue_event(APM_NORMAL_RESUME, NULL); break; } return PBOOK_SLEEP_OK; } #define APM_CRITICAL 10 #define APM_LOW 30 static int apm_emu_get_info(char *buf, char **start, off_t fpos, int length) { /* Arguments, with symbols from linux/apm_bios.h. Information is from the Get Power Status (0x0a) call unless otherwise noted. 0) Linux driver version (this will change if format changes) 1) APM BIOS Version. Usually 1.0, 1.1 or 1.2. 2) APM flags from APM Installation Check (0x00): bit 0: APM_16_BIT_SUPPORT bit 1: APM_32_BIT_SUPPORT bit 2: APM_IDLE_SLOWS_CLOCK bit 3: APM_BIOS_DISABLED bit 4: APM_BIOS_DISENGAGED 3) AC line status 0x00: Off-line 0x01: On-line 0x02: On backup power (BIOS >= 1.1 only) 0xff: Unknown 4) Battery status 0x00: High 0x01: Low 0x02: Critical 0x03: Charging 0x04: Selected battery not present (BIOS >= 1.2 only) 0xff: Unknown 5) Battery flag bit 0: High bit 1: Low bit 2: Critical bit 3: Charging bit 7: No system battery 0xff: Unknown 6) Remaining battery life (percentage of charge): 0-100: valid -1: Unknown 7) Remaining battery life (time units): Number of remaining minutes or seconds -1: Unknown 8) min = minutes; sec = seconds */ unsigned short ac_line_status = 0xff; unsigned short battery_status = 0xff; unsigned short battery_flag = 0xff; int percentage = -1; int time_units = -1; int real_count = 0; int i; char * p = buf; ac_line_status = ((pmu_power_flags & PMU_PWR_AC_PRESENT) != 0); for (i=0; i<pmu_battery_count; i++) { if (percentage < 0) percentage = 0; if (time_units < 0) time_units = 0; if (pmu_batteries[i].flags & PMU_BATT_PRESENT) { percentage += (pmu_batteries[i].charge * 100) / pmu_batteries[i].max_charge; /* hrm... should we provide the remaining charge * time when AC is plugged ? If yes, just remove * that test --BenH */ if (!ac_line_status) time_units += pmu_batteries[i].time_remaining / 60; real_count++; if (!(pmu_batteries[i].flags & PMU_BATT_CHARGING)) battery_flag &= ~0x08; } } if (real_count) { percentage /= real_count; if (battery_flag & 0x08) { battery_status = 0x03; battery_flag = 0x08; } else if (percentage <= APM_CRITICAL) { battery_status = 0x02; battery_flag = 0x04; } else if (percentage <= APM_LOW) { battery_status = 0x01; battery_flag = 0x02; } else { battery_status = 0x00; battery_flag = 0x01; } } p += sprintf(p, "%s %d.%d 0x%02x 0x%02x 0x%02x 0x%02x %d%% %d %s\n", driver_version, (FAKE_APM_BIOS_VERSION >> 8) & 0xff, FAKE_APM_BIOS_VERSION & 0xff, 0, ac_line_status, battery_status, battery_flag, percentage, time_units, "min"); return p - buf; } static struct file_operations apm_bios_fops = { owner: THIS_MODULE, read: do_read, poll: do_poll, ioctl: do_ioctl, open: do_open, release: do_release, }; static struct miscdevice apm_device = { APM_MINOR_DEV, "apm_bios", &apm_bios_fops }; static int __init apm_emu_init(void) { struct proc_dir_entry *apm_proc; if (sys_ctrler != SYS_CTRLER_PMU) { printk(KERN_INFO "apm_emu: Requires a machine with a PMU.\n"); return -ENODEV; } apm_proc = create_proc_info_entry("apm", 0, NULL, apm_emu_get_info); if (apm_proc) SET_MODULE_OWNER(apm_proc); misc_register(&apm_device); pmu_register_sleep_notifier(&apm_sleep_notifier); printk(KERN_INFO "apm_emu: APM Emulation %s initialized.\n", driver_version); return 0; } static void __exit apm_emu_exit(void) { pmu_unregister_sleep_notifier(&apm_sleep_notifier); misc_deregister(&apm_device); remove_proc_entry("apm", NULL); printk(KERN_INFO "apm_emu: APM Emulation removed.\n"); } module_init(apm_emu_init); module_exit(apm_emu_exit); MODULE_AUTHOR("Benjamin Herrenschmidt"); MODULE_DESCRIPTION("APM emulation layer for PowerMac"); MODULE_LICENSE("GPL"); EXPORT_NO_SYMBOLS; |