diff -u --recursive --new-file v1.3.37/linux/Makefile linux/Makefile --- v1.3.37/linux/Makefile Sun Oct 29 11:38:47 1995 +++ linux/Makefile Tue Nov 7 20:01:43 1995 @@ -1,9 +1,19 @@ VERSION = 1 PATCHLEVEL = 3 -SUBLEVEL = 37 +SUBLEVEL = 38 ARCH = i386 +# +# For SMP kernels, set this. We don't want to have this in the config file +# because it makes re-config very ugly and too many fundamental files depend +# on "CONFIG_SMP" +# +# NOTE! SMP is experimental, and gcc-2.5.8 is recommended. See the file +# Documentation/SMP. +# +# SMP = 1 + .EXPORT_ALL_VARIABLES: CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ @@ -74,6 +84,10 @@ ifdef CONFIG_CPP CFLAGS := $(CFLAGS) -x c++ +endif + +ifdef SMP +CFLAGS += -D__SMP__ endif # diff -u --recursive --new-file v1.3.37/linux/Rules.make linux/Rules.make --- v1.3.37/linux/Rules.make Mon Sep 25 12:26:20 1995 +++ linux/Rules.make Tue Nov 7 19:46:15 1995 @@ -32,13 +32,14 @@ # # Common rules # -.c.s: + +%.s: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -S $< -o $@ -.c.o: +%.o: %.c $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $< -.s.o: +%.o: %.s $(AS) $(ASFLAGS) $(EXTRA_CFLAGS) -o $@ $< # diff -u --recursive --new-file v1.3.37/linux/arch/alpha/config.in linux/arch/alpha/config.in --- v1.3.37/linux/arch/alpha/config.in Sun Oct 29 11:38:47 1995 +++ linux/arch/alpha/config.in Tue Nov 7 09:18:34 1995 @@ -4,6 +4,10 @@ # mainmenu_name "Kernel configuration of Linux for Alpha machines" +# clear all implied options (don't want default values for those): +unset CONFIG_CROSSCOMPILE CONFIG_NATIVE +unset CONFIG_PCI CONFIG_ALPHA_LCA CONFIG_ALPHA_APECS + mainmenu_option next_comment comment 'General setup' @@ -28,7 +32,7 @@ define_bool CONFIG_PCI y define_bool CONFIG_ALPHA_LCA y fi -if [ "$CONFIG_ALPHA_CABRIOLET" = "y" \ +if [ "$CONFIG_ALPHA_CABRIOLET" = "y" -o "$CONFIG_ALPHA_AVANTI" = "y" \ -o "$CONFIG_ALPHA_EB64" = "y" -o "$CONFIG_ALPHA_EB64P" = "y" ] then bool 'Using SRM as bootloader' CONFIG_ALPHA_SRM @@ -36,8 +40,11 @@ define_bool CONFIG_ALPHA_APECS y fi +bool 'Kernel GDB support' CONFIG_KGDB +bool 'Echo console messages on /dev/ttyS1' CONFIG_SERIAL_ECHO if [ "$CONFIG_PCI" = "y" ]; then - bool ' PCI bridge optimisation (experimental)' CONFIG_PCI_OPTIMIZE + bool 'TGA Console Support' CONFIG_TGA_CONSOLE + bool 'PCI bridge optimisation (experimental)' CONFIG_PCI_OPTIMIZE fi bool 'Networking support' CONFIG_NET bool 'System V IPC' CONFIG_SYSVIPC diff -u --recursive --new-file v1.3.37/linux/arch/alpha/kernel/bios32.c linux/arch/alpha/kernel/bios32.c --- v1.3.37/linux/arch/alpha/kernel/bios32.c Sun Oct 29 11:38:47 1995 +++ linux/arch/alpha/kernel/bios32.c Tue Nov 7 09:18:34 1995 @@ -587,17 +587,15 @@ * example, sound boards seem to like using IRQ 9. */ const unsigned int route_tab = 0x0b0a090f; - unsigned char pin; + unsigned char pin, level_bits; int pirq; pcibios_write_config_dword(0, PCI_DEVFN(7, 0), 0x60, route_tab); - /* ensure irq 9, 10, 11, and 15 are level sensitive: */ - outb((1<<(9-8)) | (1<<(10-8)) | (1<<(11-8)) | (1<<(15-8)), 0x4d1); - /* * Go through all devices, fixing up irqs as we see fit: */ + level_bits = 0; for (dev = pci_devices; dev; dev = dev->next) { dev->irq = 0; if (dev->bus->number != 0 || @@ -614,7 +612,16 @@ if (pirq < 0) { continue; } + if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { + continue; /* for now, displays get no IRQ */ + } dev->irq = (route_tab >> (8 * pirq)) & 0xff; + + /* must set the PCI IRQs to level triggered */ + /* assume they are all >= 8 */ + level_bits |= (1 << (dev->irq - 8)); + outb(level_bits, 0x4d1); + #if PCI_MODIFY /* tell the device: */ pcibios_write_config_byte(dev->bus->number, dev->devfn, @@ -646,6 +653,10 @@ } +#ifdef CONFIG_TGA_CONSOLE +extern void tga_console_init(void); +#endif /* CONFIG_TGA_CONSOLE */ + unsigned long pcibios_fixup(unsigned long mem_start, unsigned long mem_end) { #if PCI_MODIFY @@ -671,6 +682,11 @@ #else # error You must tell me what kind of platform you want. #endif + +#ifdef CONFIG_TGA_CONSOLE + tga_console_init(); +#endif /* CONFIG_TGA_CONSOLE */ + return mem_start; } diff -u --recursive --new-file v1.3.37/linux/arch/alpha/kernel/entry.S linux/arch/alpha/kernel/entry.S --- v1.3.37/linux/arch/alpha/kernel/entry.S Sun Oct 29 11:38:47 1995 +++ linux/arch/alpha/kernel/entry.S Sun Oct 29 14:54:27 1995 @@ -497,7 +497,6 @@ 1: jsr $26,($27),do_entSys blt $0,syscall_error /* the call failed */ stq $0,0($30) -ret_success: stq $31,72($30) /* a3=0 => no error */ .align 3 ret_from_sys_call: @@ -527,19 +526,20 @@ /* * Some system calls (e.g., ptrace) can return arbitrary * values which might normally be mistaken as error numbers. - * Those functions must setup $0 (v0) directly in the stack frame - * and return with value -255. + * Those functions must zero $0 (v0) directly in the stack + * frame to indicate that a negative return value wasn't an + * error number.. */ - addq $0,255,$1 - beq $1,ret_success + ldq $19,0($30) /* old syscall nr (zero if success) */ + beq $19,ret_success - bis $31,$31,$26 /* tell "ret_from_sys_call" that we can restart */ - ldq $19,0($30) /* .. with this syscall nr */ ldq $20,72($30) /* .. and this a3 */ subq $31,$0,$0 /* with error in v0 */ addq $31,1,$1 /* set a3 for errno return */ - stq $0,0($30) + bis $31,$31,$26 /* tell "ret_from_sys_call" that we can restart */ stq $1,72($30) /* a3 for return */ +ret_success: + stq $0,0($30) br $31,ret_from_sys_call .align 3 diff -u --recursive --new-file v1.3.37/linux/arch/alpha/kernel/ptrace.c linux/arch/alpha/kernel/ptrace.c --- v1.3.37/linux/arch/alpha/kernel/ptrace.c Thu Sep 7 17:17:16 1995 +++ linux/arch/alpha/kernel/ptrace.c Sun Oct 29 14:54:27 1995 @@ -551,15 +551,15 @@ DBG(DBG_MEM, ("peek %#lx->%#lx\n", addr, tmp)); if (res < 0) return res; - regs.r0 = tmp; /* special return */ - return -255; + regs.r0 = 0; /* special return: no errors */ + return tmp; } /* read register number ADDR. */ case PTRACE_PEEKUSR: - regs.r0 = get_reg(child, addr); + regs.r0 = 0; /* special return: no errors */ DBG(DBG_MEM, ("peek $%ld=%#lx\n", addr, regs.r0)); - return -255; /* special return */ + return get_reg(child, addr); /* when I and D space are separate, this will have to be fixed. */ case PTRACE_POKETEXT: /* write the word at location addr. */ diff -u --recursive --new-file v1.3.37/linux/arch/alpha/kernel/setup.c linux/arch/alpha/kernel/setup.c --- v1.3.37/linux/arch/alpha/kernel/setup.c Mon Sep 18 14:53:48 1995 +++ linux/arch/alpha/kernel/setup.c Tue Nov 7 09:18:34 1995 @@ -66,6 +66,24 @@ 16 /* orig-video-points */ }; +/* + * Initialize Programmable Interval Timers with standard values. Some + * drivers depend on them being initialized (e.g., joystick driver). + */ +static void init_pit (void) +{ + outb(0x54, 0x43); /* counter 1: refresh timer */ + outb(0x18, 0x41); + + outb(0x36, 0x43); /* counter 0: system timer */ + outb(0x00, 0x40); + outb(0x00, 0x40); + + outb(0xb6, 0x43); /* counter 2: speaker */ + outb(0x31, 0x42); + outb(0x13, 0x42); +} + static unsigned long find_end_memory(void) { int i; @@ -91,6 +109,8 @@ unsigned long * memory_start_p, unsigned long * memory_end_p) { extern int _end; + + init_pit(); hwrpb = (struct hwrpb_struct*)(IDENT_ADDR + INIT_HWRPB->phys_addr); diff -u --recursive --new-file v1.3.37/linux/arch/alpha/lib/io.c linux/arch/alpha/lib/io.c --- v1.3.37/linux/arch/alpha/lib/io.c Fri Jul 7 08:54:44 1995 +++ linux/arch/alpha/lib/io.c Tue Nov 7 09:18:34 1995 @@ -11,90 +11,77 @@ * byte-wide IO. */ #ifdef __is_local -#undef __bus_inb -unsigned int __bus_inb(unsigned long addr) + +unsigned int _bus_inb(unsigned long addr) { - return ___bus_inb(addr); + return __bus_inb(addr); } -#undef __bus_outb -void __bus_outb(unsigned char b, unsigned long addr) +void _bus_outb(unsigned char b, unsigned long addr) { - ___bus_outb(b, addr); + __bus_outb(b, addr); } #endif -#undef inb -unsigned int inb(unsigned long addr) +unsigned int _inb(unsigned long addr) { return __inb(addr); } -#undef inw -unsigned int inw(unsigned long addr) +unsigned int _inw(unsigned long addr) { return __inw(addr); } -#undef inl -unsigned int inl(unsigned long addr) +unsigned int _inl(unsigned long addr) { return __inl(addr); } -#undef outb -void outb(unsigned char b, unsigned long addr) +void _outb(unsigned char b, unsigned long addr) { __outb(b, addr); } -#undef outw -void outw(unsigned short b, unsigned long addr) +void _outw(unsigned short b, unsigned long addr) { __outw(b, addr); } -#undef outl -void outl(unsigned int b, unsigned long addr) +void _outl(unsigned int b, unsigned long addr) { __outl(b, addr); } -#undef readb -unsigned long readb(unsigned long addr) +unsigned long _readb(unsigned long addr) { return __readb(addr); } -#undef readw -unsigned long readw(unsigned long addr) +unsigned long _readw(unsigned long addr) { return __readw(addr); } -#undef readl -unsigned long readl(unsigned long addr) +unsigned long _readl(unsigned long addr) { return __readl(addr); } -#undef writeb -void writeb(unsigned char b, unsigned long addr) +void _writeb(unsigned char b, unsigned long addr) { __writeb(b, addr); } -#undef writew -void writew(unsigned short b, unsigned long addr) +void _writew(unsigned short b, unsigned long addr) { __writew(b, addr); } -#undef writel -void writel(unsigned int b, unsigned long addr) +void _writel(unsigned int b, unsigned long addr) { __writel(b, addr); } @@ -103,7 +90,6 @@ * Read COUNT 8-bit bytes from port PORT into memory starting at * SRC. */ -#undef insb void insb (unsigned long port, void *dst, unsigned long count) { while (((unsigned long)dst) & 0x3) { @@ -140,7 +126,6 @@ * the interfaces seems to be slow: just using the inlined version * of the inw() breaks things. */ -#undef insw void insw (unsigned long port, void *dst, unsigned long count) { if (((unsigned long)dst) & 0x3) { @@ -176,7 +161,6 @@ * the interfaces seems to be slow: just using the inlined version * of the inw() breaks things. */ -#undef insl void insl (unsigned long port, void *dst, unsigned long count) { if (((unsigned long)dst) & 0x3) { @@ -196,7 +180,6 @@ * doing byte reads the "slow" way isn't nearly as slow as * doing byte writes the slow way (no r-m-w cycle). */ -#undef outsb void outsb(unsigned long port, void * src, unsigned long count) { while (count) { @@ -212,7 +195,6 @@ * interfaces seems to be slow: just using the inlined version of the * outw() breaks things. */ -#undef outsw void outsw (unsigned long port, void *src, unsigned long count) { if (((unsigned long)src) & 0x3) { @@ -245,7 +227,6 @@ * interfaces seems to be slow: just using the inlined version of the * outw() breaks things. */ -#undef outsw void outsl (unsigned long port, void *src, unsigned long count) { if (((unsigned long)src) & 0x3) { @@ -264,7 +245,6 @@ * Copy data from IO memory space to "real" memory space. * This needs to be optimized. */ -#undef memcpy_fromio void memcpy_fromio(void * to, unsigned long from, unsigned long count) { while (count) { @@ -279,7 +259,6 @@ * Copy data from "real" memory space to IO memory space. * This needs to be optimized. */ -#undef memcpy_toio void memcpy_toio(unsigned long to, void * from, unsigned long count) { while (count) { @@ -294,7 +273,6 @@ * "memset" on IO memory space. * This needs to be optimized. */ -#undef memset_io void memset_io(unsigned long dst, int c, unsigned long count) { while (count) { diff -u --recursive --new-file v1.3.37/linux/arch/alpha/lib/memcpy.c linux/arch/alpha/lib/memcpy.c --- v1.3.37/linux/arch/alpha/lib/memcpy.c Fri Jul 7 08:54:44 1995 +++ linux/arch/alpha/lib/memcpy.c Sun Oct 29 20:50:09 1995 @@ -113,3 +113,13 @@ __memcpy_unaligned((unsigned long) dest, (unsigned long) src, n); return dest; } + +/* + * Broken compiler uses "bcopy" to do internal + * assignments. Silly OSF/1 BSDism. + */ +char * bcopy(const char * src, char * dest, size_t n) +{ + __memcpy(dest, src, n); + return dest; +} diff -u --recursive --new-file v1.3.37/linux/arch/i386/boot/compressed/head.S linux/arch/i386/boot/compressed/head.S --- v1.3.37/linux/arch/i386/boot/compressed/head.S Wed Oct 4 14:14:28 1995 +++ linux/arch/i386/boot/compressed/head.S Mon Oct 30 10:03:26 1995 @@ -38,7 +38,7 @@ mov %ax,%es mov %ax,%fs mov %ax,%gs -#ifdef CONFIG_SMP +#ifdef __SMP__ orw %bx,%bx # What state are we in BX=1 for SMP # 0 for boot jz 2f # Initial boot diff -u --recursive --new-file v1.3.37/linux/arch/i386/config.in linux/arch/i386/config.in --- v1.3.37/linux/arch/i386/config.in Sun Oct 29 11:38:48 1995 +++ linux/arch/i386/config.in Mon Oct 30 09:53:51 1995 @@ -23,7 +23,6 @@ #if [ "$CONFIG_M586" = "n" ]; then bool 'Use -m486 flag for 486-specific optimizations' CONFIG_M486 #fi -bool 'SMP Kernel (experimental - gcc2.5.8 only: see Documentation/SMP.txt)' CONFIG_SMP mainmenu_option next_comment comment 'Loadable module support' diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile --- v1.3.37/linux/arch/i386/kernel/Makefile Tue Oct 10 18:46:31 1995 +++ linux/arch/i386/kernel/Makefile Mon Oct 30 10:06:31 1995 @@ -23,7 +23,7 @@ O_OBJS := process.o signal.o entry.o traps.o irq.o vm86.o bios32.o \ ptrace.o ioport.o ldt.o setup.o time.o sys_i386.o -ifdef CONFIG_SMP +ifdef SMP O_OBJS += smp.o endif diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/entry.S linux/arch/i386/kernel/entry.S --- v1.3.37/linux/arch/i386/kernel/entry.S Wed Oct 4 14:14:28 1995 +++ linux/arch/i386/kernel/entry.S Mon Oct 30 10:30:17 1995 @@ -41,7 +41,6 @@ */ #include -#include #include #include #define ASSEMBLY @@ -105,7 +104,7 @@ movl $(USER_DS),%edx; \ mov %dx,%fs; -#ifdef CONFIG_SMP +#ifdef __SMP__ #define GET_PROCESSOR_ID \ movl SYMBOL_NAME(apic_reg), %edx; \ @@ -230,7 +229,7 @@ pushfl # We get a different stack layout with call gates, pushl %eax # which has to be cleaned up later.. SAVE_ALL -#ifdef CONFIG_SMP +#ifdef __SMP__ ENTER_KERNEL #endif movl EIP(%esp),%eax # due to call gates, this is eflags, not eip.. @@ -240,7 +239,7 @@ movl %edx,EIP(%esp) # Now we move them to their "normal" places movl %ecx,CS(%esp) # movl %esp,%eax -#ifdef CONFIG_SMP +#ifdef __SMP__ GET_PROCESSOR_OFFSET(%edx) # Processor offset into edx movl SYMBOL_NAME(current_set)(,%edx),%edx #else @@ -270,7 +269,7 @@ ENTRY(system_call) pushl %eax # save orig_eax SAVE_ALL -#ifdef CONFIG_SMP +#ifdef __SMP__ ENTER_KERNEL #endif movl $-ENOSYS,EAX(%esp) @@ -279,7 +278,7 @@ movl SYMBOL_NAME(sys_call_table)(,%eax,4),%eax testl %eax,%eax je ret_from_sys_call -#ifdef CONFIG_SMP +#ifdef __SMP__ GET_PROCESSOR_OFFSET(%edx) movl SYMBOL_NAME(current_set)(,%edx),%ebx #else @@ -304,7 +303,7 @@ movl ORIG_EAX(%esp),%eax call SYMBOL_NAME(sys_call_table)(,%eax,4) movl %eax,EAX(%esp) # save the return value -#ifdef CONFIG_SMP +#ifdef __SMP__ GET_PROCESSOR_OFFSET(%eax) movl SYMBOL_NAME(current_set)(,%eax),%eax #else @@ -336,7 +335,7 @@ movl %eax,EFLAGS(%esp) # stupid cmpl $0,SYMBOL_NAME(need_resched) jne reschedule -#ifdef CONFIG_SMP +#ifdef __SMP__ GET_PROCESSOR_OFFSET(%eax) movl SYMBOL_NAME(current_set)(,%eax), %eax #else @@ -407,11 +406,11 @@ mov %dx,%es movl $(USER_DS),%edx mov %dx,%fs -#ifdef CONFIG_SMP +#ifdef __SMP__ ENTER_KERNEL #endif pushl %eax -#ifdef CONFIG_SMP +#ifdef __SMP__ GET_PROCESSOR_OFFSET(%eax) movl SYMBOL_NAME(current_set)(,%eax), %eax #else @@ -432,7 +431,7 @@ ENTRY(device_not_available) pushl $-1 # mark this as an int SAVE_ALL -#ifdef CONFIG_SMP +#ifdef __SMP__ ENTER_KERNEL #endif pushl $ret_from_sys_call diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/head.S linux/arch/i386/kernel/head.S --- v1.3.37/linux/arch/i386/kernel/head.S Wed Oct 4 14:14:28 1995 +++ linux/arch/i386/kernel/head.S Mon Oct 30 10:30:17 1995 @@ -9,7 +9,6 @@ */ .text -#include #include #include #include @@ -33,7 +32,7 @@ mov %ax,%es mov %ax,%fs mov %ax,%gs -#ifdef CONFIG_SMP +#ifdef __SMP__ orw %bx,%bx jz 1f /* Initial CPU cleans BSS */ /* @@ -48,7 +47,7 @@ jmp checkCPUtype 1: lss stack_start,%esp -#endif CONFIG_SMP +#endif __SMP__ /* * Clear BSS first so that there are no surprises... */ @@ -100,7 +99,7 @@ rep movsb 1: -#ifdef CONFIG_SMP +#ifdef __SMP__ checkCPUtype: #endif @@ -170,7 +169,7 @@ orl $2,%eax # set MP 2: movl %eax,%cr0 call check_x87 -#ifdef CONFIG_SMP +#ifdef __SMP__ movb ready,%eax orb %eax,%eax jz 3f @@ -192,7 +191,7 @@ #endif 3: call setup_paging -#ifdef CONFIG_SMP +#ifdef __SMP__ incb ready #endif 4: @@ -204,7 +203,7 @@ mov %ax,%es mov %ax,%fs mov %ax,%gs -#ifdef CONFIG_SMP +#ifdef __SMP__ movl $(KERNEL_DS), %eax mov %ax,%ss # Reload the stack pointer (segment only) #else @@ -221,7 +220,7 @@ jmp L6 # main should never return here, but # just in case, we know what happens. -#ifdef CONFIG_SMP +#ifdef __SMP__ ready: .byte 0 #endif diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/irq.c linux/arch/i386/kernel/irq.c --- v1.3.37/linux/arch/i386/kernel/irq.c Mon Oct 16 18:38:21 1995 +++ linux/arch/i386/kernel/irq.c Mon Oct 30 10:30:17 1995 @@ -15,7 +15,6 @@ * Naturally it's not a 1:1 relation, but there are similarities. */ -#include #include #include #include @@ -105,14 +104,14 @@ BUILD_IRQ(SECOND,10,0x04) BUILD_IRQ(SECOND,11,0x08) BUILD_IRQ(SECOND,12,0x10) -#ifdef CONFIG_SMP +#ifdef __SMP__ BUILD_MSGIRQ(SECOND,13,0x20) #else BUILD_IRQ(SECOND,13,0x20) #endif BUILD_IRQ(SECOND,14,0x40) BUILD_IRQ(SECOND,15,0x80) -#ifdef CONFIG_SMP +#ifdef __SMP__ BUILD_RESCHEDIRQ(16) #endif @@ -125,7 +124,7 @@ IRQ4_interrupt, IRQ5_interrupt, IRQ6_interrupt, IRQ7_interrupt, IRQ8_interrupt, IRQ9_interrupt, IRQ10_interrupt, IRQ11_interrupt, IRQ12_interrupt, IRQ13_interrupt, IRQ14_interrupt, IRQ15_interrupt -#ifdef CONFIG_SMP +#ifdef __SMP__ ,IRQ16_interrupt #endif }; @@ -189,7 +188,7 @@ /* * Linus - should you add NMI counts here ????? */ -#ifdef CONFIG_SMP +#ifdef __SMP__ len+=sprintf(buf+len, "IPI: %8lu received\n", ipi_count); len+=sprintf(buf+len, "LCK: %8lu spins\n", @@ -208,7 +207,7 @@ asmlinkage void do_IRQ(int irq, struct pt_regs * regs) { struct irqaction * action = irq + irq_action; -#ifdef CONFIG_SMP +#ifdef __SMP__ if(smp_threads_ready && active_kernel_processor!=smp_processor_id()) panic("IRQ %d: active processor set wrongly(%d not %d).\n", irq, active_kernel_processor, smp_processor_id()); #endif @@ -227,7 +226,7 @@ asmlinkage void do_fast_IRQ(int irq) { struct irqaction * action = irq + irq_action; -#ifdef CONFIG_SMP +#ifdef __SMP__ /* IRQ 13 is allowed - thats an invalidate */ if(smp_threads_ready && active_kernel_processor!=smp_processor_id() && irq!=13) panic("fast_IRQ %d: active processor set wrongly(%d not %d).\n", irq, active_kernel_processor, smp_processor_id()); @@ -311,7 +310,7 @@ restore_flags(flags); } -#ifndef CONFIG_SMP +#ifndef __SMP__ /* * Note that on a 486, we don't want to do a SIGFPE on a irq13 @@ -406,12 +405,12 @@ set_intr_gate(0x20+i,bad_interrupt[i]); /* This bit is a hack because we don't send timer messages to all processors yet */ /* It has to here .. it doesnt work if you put it down the bottom - assembler explodes 8) */ -#ifdef CONFIG_SMP +#ifdef __SMP__ set_intr_gate(0x20+i, interrupt[i]); /* IRQ '16' - IPI for rescheduling */ #endif if (request_irq(2, no_action, SA_INTERRUPT, "cascade")) printk("Unable to get IRQ2 for cascade.\n"); -#ifndef CONFIG_SMP +#ifndef __SMP__ if (request_irq(13,math_error_irq, 0, "math error")) printk("Unable to get IRQ13 for math-error handler.\n"); #else diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/process.c linux/arch/i386/kernel/process.c --- v1.3.37/linux/arch/i386/kernel/process.c Fri Oct 6 14:35:14 1995 +++ linux/arch/i386/kernel/process.c Mon Oct 30 10:31:15 1995 @@ -8,7 +8,6 @@ * This file handles the architecture-dependent parts of process handling.. */ -#include #include #include #include @@ -52,7 +51,7 @@ /* printk("Wrong process idled\n"); SMP bug check */ return -EPERM; } -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * SMP locking sanity checker */ @@ -77,7 +76,7 @@ /* endless idle loop with no priority at all */ current->counter = -100; for (;;) { -#ifdef CONFIG_SMP +#ifdef __SMP__ if (cpu_data[smp_processor_id()].hlt_works_ok && !hlt_counter && !need_resched) #else if (hlt_works_ok && !hlt_counter && !need_resched) diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c --- v1.3.37/linux/arch/i386/kernel/setup.c Wed Oct 4 14:14:28 1995 +++ linux/arch/i386/kernel/setup.c Mon Oct 30 10:05:41 1995 @@ -159,7 +159,7 @@ {"Pentium 60/66","Pentium 75+","3", "4","5","6","7","8"}}; char mask[2]; -#ifndef CONFIG_SMP +#ifndef __SMP__ mask[0] = x86_mask+'@'; mask[1] = '\0'; return sprintf(buffer,"cpu\t\t: %c86\n" diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/smp.c linux/arch/i386/kernel/smp.c --- v1.3.37/linux/arch/i386/kernel/smp.c Sun Oct 29 11:38:48 1995 +++ linux/arch/i386/kernel/smp.c Mon Nov 6 12:58:59 1995 @@ -895,9 +895,9 @@ void smp_message_irq(int cpl, struct pt_regs *regs) { - static int n=0; int i=smp_processor_id(); -/* if(n++%d(%d,%ld)\n",smp_src_cpu,i,smp_msg_id,smp_msg_data);*/ switch(smp_msg_id) { diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/sys_i386.c linux/arch/i386/kernel/sys_i386.c --- v1.3.37/linux/arch/i386/kernel/sys_i386.c Thu Sep 7 17:17:16 1995 +++ linux/arch/i386/kernel/sys_i386.c Mon Oct 30 10:30:17 1995 @@ -6,7 +6,6 @@ * platform. */ -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/trampoline.S linux/arch/i386/kernel/trampoline.S --- v1.3.37/linux/arch/i386/kernel/trampoline.S Wed Oct 4 14:14:29 1995 +++ linux/arch/i386/kernel/trampoline.S Mon Oct 30 10:30:17 1995 @@ -14,7 +14,6 @@ ! won't get very far. ! #define __ASSEMBLY__ -#include #include .text diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/trampoline32.S linux/arch/i386/kernel/trampoline32.S --- v1.3.37/linux/arch/i386/kernel/trampoline32.S Wed Oct 4 14:14:29 1995 +++ linux/arch/i386/kernel/trampoline32.S Mon Oct 30 10:30:17 1995 @@ -2,7 +2,6 @@ ! 32bit side of the trampoline code ! #define __ASSEMBLY__ -#include #include ! ! diff -u --recursive --new-file v1.3.37/linux/arch/i386/kernel/traps.c linux/arch/i386/kernel/traps.c --- v1.3.37/linux/arch/i386/kernel/traps.c Wed Oct 4 14:14:29 1995 +++ linux/arch/i386/kernel/traps.c Mon Oct 30 09:59:01 1995 @@ -242,7 +242,7 @@ void math_error(void) { struct i387_hard_struct * env; -#ifdef CONFIG_SMP +#ifdef __SMP__ env=¤t->tss.i387.hard; send_sig(SIGFPE, current, 1); /* @@ -289,7 +289,7 @@ */ asmlinkage void math_state_restore(void) { -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * SMP is actually simpler than uniprocessor for once. Because * we can't pull the delayed FPU switching trick Linus does diff -u --recursive --new-file v1.3.37/linux/arch/i386/mm/fault.c linux/arch/i386/mm/fault.c --- v1.3.37/linux/arch/i386/mm/fault.c Thu Sep 7 17:17:16 1995 +++ linux/arch/i386/mm/fault.c Mon Oct 30 10:31:15 1995 @@ -4,7 +4,6 @@ * Copyright (C) 1995 Linus Torvalds */ -#include #include #include #include @@ -88,7 +87,7 @@ current->tss.screen_bitmap |= 1 << bit; } if (error_code & 1) { -#ifdef CONFIG_TEST_VERIFY_AREA +#ifdef TEST_VERIFY_AREA if (regs->cs == KERNEL_CS) printk("WP fault at %08x\n", regs->eip); #endif diff -u --recursive --new-file v1.3.37/linux/arch/i386/mm/init.c linux/arch/i386/mm/init.c --- v1.3.37/linux/arch/i386/mm/init.c Fri Oct 13 14:44:32 1995 +++ linux/arch/i386/mm/init.c Mon Oct 30 10:15:11 1995 @@ -21,6 +21,13 @@ #include #include +/* + * The SMP kernel can't handle the 4MB page table optimizations yet + */ +#ifdef __SMP__ +#undef USE_PENTIUM_MM +#endif + extern void scsi_mem_init(unsigned long); extern void die_if_kernel(char *,struct pt_regs *,long); extern void show_net_buffers(void); @@ -116,7 +123,7 @@ #if 0 memset((void *) 0, 0, PAGE_SIZE); #endif -#ifdef CONFIG_SMP +#ifdef __SMP__ smp_scan_config(0x0,0x400); /* Scan the bottom 1K for a signature */ /* * FIXME: Linux assumes you have 640K of base ram.. this continues @@ -132,15 +139,14 @@ */ /* smp_alloc_memory(8192); */ #endif -#ifdef CONFIG_TEST_VERIFY_AREA +#ifdef TEST_VERIFY_AREA wp_works_ok = 0; #endif start_mem = PAGE_ALIGN(start_mem); address = 0; pg_dir = swapper_pg_dir; while (address < end_mem) { -#ifdef CONFIG_PENTIUM_MM -#ifndef CONFIG_SMP +#ifdef USE_PENTIUM_MM if (address <= end_mem + 4*1024*1024 && (x86_capability & 8)) { #ifdef GAS_KNOWS_CR4 @@ -162,7 +168,6 @@ continue; } #endif -#endif /* map the memory at virtual addr 0xC0000000 */ pg_table = (pte_t *) (PAGE_MASK & pgd_val(pg_dir[768])); if (!pg_table) { @@ -204,7 +209,7 @@ /* mark usable pages in the mem_map[] */ start_low_mem = PAGE_ALIGN(start_low_mem); -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * But first pinch a few for the stack/trampoline stuff */ diff -u --recursive --new-file v1.3.37/linux/drivers/block/Config.in linux/drivers/block/Config.in --- v1.3.37/linux/drivers/block/Config.in Mon Oct 23 18:02:01 1995 +++ linux/drivers/block/Config.in Mon Nov 6 18:00:27 1995 @@ -15,8 +15,10 @@ bool ' Use new IDE driver for primary/secondary i/f' CONFIG_BLK_DEV_IDE fi if [ "$CONFIG_BLK_DEV_IDE" = "y" ]; then - bool ' PCI Triton IDE Bus Master DMA support' CONFIG_BLK_DEV_TRITON bool ' Include support for IDE/ATAPI CDROMs' CONFIG_BLK_DEV_IDECD + if [ "$CONFIG_PCI" = "y" ]; then + bool ' PCI Triton IDE Bus Master DMA support' CONFIG_BLK_DEV_TRITON + fi fi fi diff -u --recursive --new-file v1.3.37/linux/drivers/block/floppy.c linux/drivers/block/floppy.c --- v1.3.37/linux/drivers/block/floppy.c Mon Oct 23 18:02:02 1995 +++ linux/drivers/block/floppy.c Mon Oct 30 08:18:34 1995 @@ -96,28 +96,22 @@ * features to asm/floppy.h. */ -#define CONFIG_FLOPPY_SANITY -#undef CONFIG_FLOPPY_SILENT_DCL_CLEAR +#define FLOPPY_SANITY_CHECK +#undef FLOPPY_SILENT_DCL_CLEAR #define REALLY_SLOW_IO #define DEBUGT 2 #define DCL_DEBUG /* debug disk change line */ -#include - /* do print messages for unexpected interrupts */ static int print_unex=1; +#include + #ifdef MODULE -#define FD_MODULE -#include -/* - * NB. we must include the kernel identification string to install the module. - */ -#include -char kernel_version[] = UTS_RELEASE; +#define FD_MODULE int FLOPPY_IRQ=6; int FLOPPY_DMA=2; @@ -608,7 +602,7 @@ static const char *timeout_message; -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK static void is_alive(const char *message) { /* this routine checks whether the floppy driver is "alive" */ @@ -618,7 +612,7 @@ } #endif -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK #define OLOGSIZE 20 @@ -697,7 +691,7 @@ static int disk_change(int drive) { int fdc=FDC(drive); -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if(jiffies < UDP->select_delay + UDRS->select_date) DPRINT("WARNING disk change called early\n"); if(! (FDCS->dor & (0x10 << UNIT(drive))) || @@ -1019,7 +1013,7 @@ static void setup_DMA(void) { -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if (raw_cmd->length == 0){ int i; @@ -1096,7 +1090,7 @@ if (status == STATUS_READY){ fd_outb(byte,FD_DATA); -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK output_log[output_log_pos].data = byte; output_log[output_log_pos].status = rstatus; output_log[output_log_pos].jiffies = jiffies; @@ -1127,7 +1121,7 @@ if (!(status & STATUS_READY)) continue; if (status == STATUS_READY){ -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK resultjiffies = jiffies; resultsize = i; #endif @@ -1749,7 +1743,7 @@ jiffies, interruptjiffies, lasthandler); -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK printk("timeout_message=%s\n", timeout_message); printk("last output bytes:\n"); for(i=0; i < OLOGSIZE; i++) @@ -2222,7 +2216,7 @@ floppy->sect + ((R_SECTOR-SECTOR) << SIZECODE >> 2) - (sector_t % floppy->sect) % ssize; -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if ( nr_sectors > current_count_sectors + ssize - (current_count_sectors + sector_t) % ssize + sector_t % ssize){ @@ -2341,7 +2335,7 @@ current_count_sectors = CURRENT->nr_sectors; } remaining = current_count_sectors << 9; -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if ((remaining >> 9) > CURRENT->nr_sectors && CT(COMMAND) == FD_WRITE ){ DPRINT("in copy buffer\n"); @@ -2367,7 +2361,7 @@ while ( remaining > 0){ if ( size > remaining ) size = remaining; -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if (dma_buffer + size > floppy_track_buffer + (max_buffer_sectors << 10) || dma_buffer < floppy_track_buffer ){ @@ -2400,7 +2394,7 @@ dma_buffer += size; bh = bh->b_reqnext; -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if ( !bh){ DPRINT("bh=null in copy buffer after copy\n"); break; @@ -2409,7 +2403,7 @@ size = bh->b_size; buffer = bh->b_data; } -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if ( remaining ){ if ( remaining > 0 ) max_sector -= remaining >> 9; @@ -2591,7 +2585,7 @@ * if we get here, we know that the write * is either aligned or the data already in the buffer * (buffer will be overwritten) */ -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if (sector_t != aligned_sector_t && buffer_track == -1 ) DPRINT("internal error offset !=0 on write\n"); #endif @@ -2606,7 +2600,7 @@ raw_cmd->length = sector_t+current_count_sectors-aligned_sector_t; raw_cmd->length = ((raw_cmd->length -1)|(ssize-1))+1; raw_cmd->length <<= 9; -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK if ((raw_cmd->length < current_count_sectors << 9) || (raw_cmd->kernel_data != CURRENT->buffer && CT(COMMAND) == FD_WRITE && @@ -3949,7 +3943,7 @@ static void floppy_release_irq_and_dma(void) { -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK int drive; #endif long tmpsize; @@ -3983,7 +3977,7 @@ free_pages((unsigned long)tmpaddr, __get_order(tmpsize)); } -#ifdef CONFIG_FLOPPY_SANITY +#ifdef FLOPPY_SANITY_CHECK for(drive=0; drive < N_FDC * 4; drive++) if( motor_off_timer[drive].next ) printk("motor off timer %d still active\n", drive); diff -u --recursive --new-file v1.3.37/linux/drivers/block/genhd.c linux/drivers/block/genhd.c --- v1.3.37/linux/drivers/block/genhd.c Sun Oct 29 11:38:48 1995 +++ linux/drivers/block/genhd.c Mon Nov 6 12:29:40 1995 @@ -379,6 +379,76 @@ #endif /* CONFIG_OSF_PARTITION */ +#ifdef CONFIG_SUN_PARTITION + +static int sun_partition(struct gendisk *hd, unsigned int dev, unsigned long first_sector) +{ + int i, csum; + unsigned short *ush; + struct buffer_head *bh; + struct sun_disklabel { + unsigned char info[128]; /* Informative text string */ + unsigned char spare[292]; /* Boot information etc. */ + unsigned short rspeed; /* Disk rotational speed */ + unsigned short pcylcount; /* Physical cylinder count */ + unsigned short sparecyl; /* extra sects per cylinder */ + unsigned char spare2[4]; /* More magic... */ + unsigned short ilfact; /* Interleave factor */ + unsigned short ncyl; /* Data cylinder count */ + unsigned short nacyl; /* Alt. cylinder count */ + unsigned short ntrks; /* Tracks per cylinder */ + unsigned short nsect; /* Sectors per track */ + unsigned char spare3[4]; /* Even more magic... */ + struct sun_partition { + unsigned long start_cylinder; + unsigned long num_sectors; + } partitions[8]; + unsigned short magic; /* Magic number */ + unsigned short csum; /* Label xor'd checksum */ + } * label; + struct sun_partition *p; + unsigned long spc; +#define SUN_LABEL_MAGIC 0xDABE + + if(!(bh = bread(dev, 0, 1024))) { + printk("Dev %d: unable to read partition table\n", dev); + return -1; + } + label = (struct sun_disklabel *) bh->b_data; + p = label->partitions; + if(label->magic != SUN_LABEL_MAGIC) { + printk("Dev %d Sun disklabel: bad magic %08x\n", dev, label->magic); + brelse(bh); + return 0; + } + /* Look at the checksum */ + ush = ((unsigned short *) (label+1)) - 1; + for(csum = 0; ush >= ((unsigned short *) label);) + csum ^= *ush--; + if(csum) { + printk("Dev %d Sun disklabel: Csum bad, label corrupted\n", dev); + brelse(bh); + return 0; + } + /* All Sun disks have 8 partition entries */ + spc = (label->ntrks * label->nsect); + for(i=0; i < 8; i++, p++) { + unsigned long st_sector; + + /* We register all partitions, even if zero size, so that + * the minor numbers end up ok as per SunOS interpretation. + */ + st_sector = first_sector + (p->start_cylinder * spc); + add_partition(hd, current_minor, st_sector, p->num_sectors); + current_minor++; + } + printk("\n"); + brelse(bh); + return 1; +} + +#endif /* CONFIG_SUN_PARTITION */ + static void check_partition(struct gendisk *hd, kdev_t dev) { static int first_time = 1; @@ -406,6 +476,10 @@ #endif #ifdef CONFIG_OSF_PARTITION if (osf_partition(hd, dev, first_sector)) + return; +#endif +#ifdef CONFIG_SUN_PARTITION + if(sun_partition(hd, dev, first_sector)) return; #endif printk(" unknown partition table\n"); diff -u --recursive --new-file v1.3.37/linux/drivers/block/ide-cd.c linux/drivers/block/ide-cd.c --- v1.3.37/linux/drivers/block/ide-cd.c Mon Sep 18 14:53:50 1995 +++ linux/drivers/block/ide-cd.c Mon Oct 30 10:20:49 1995 @@ -86,7 +86,6 @@ /***************************************************************************/ -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/drivers/block/ide.c linux/drivers/block/ide.c --- v1.3.37/linux/drivers/block/ide.c Mon Oct 23 18:02:03 1995 +++ linux/drivers/block/ide.c Mon Nov 6 18:00:27 1995 @@ -1,5 +1,5 @@ /* - * linux/drivers/block/ide.c Version 5.16 Oct 19, 1995 + * linux/drivers/block/ide.c Version 5.17 Nov 3, 1995 * * Copyright (C) 1994, 1995 Linus Torvalds & authors (see below) */ @@ -166,6 +166,7 @@ * Version 5.16 ugh.. fix "serialize" support, broken in 5.15 * remove "Huh?" from cmd640 code * added qd6580 interface speed select from Colten Edwards + * Version 5.17 kludge around bug in BIOS32 on Intel triton motherboards * * Driver compile-time options are in ide.h * @@ -2949,7 +2950,7 @@ * ide_probe_pci() scans PCI for a specific vendor/device function, * and invokes the supplied init routine for each instance detected. */ -static void ide_probe_pci (unsigned short vendor, unsigned short device, ide_pci_init_proc_t *init) +static void ide_probe_pci (unsigned short vendor, unsigned short device, ide_pci_init_proc_t *init, int func_adj) { unsigned long flags; unsigned index; @@ -2958,7 +2959,7 @@ save_flags(flags); cli(); for (index = 0; !pcibios_find_device (vendor, device, index, &bus, &fn); ++index) { - init (bus, fn); + init (bus, fn + func_adj); } restore_flags(flags); } @@ -2972,13 +2973,18 @@ static void ide_init_pci (void) { #if SUPPORT_RZ1000 - ide_probe_pci (PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000, &init_rz1000); + ide_probe_pci (PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000, &init_rz1000, 0); #endif #if SUPPORT_CMD640 - ide_probe_pci (PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_CMD_640, &init_cmd640); + ide_probe_pci (PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_CMD_640, &init_cmd640, 0); #endif #ifdef CONFIG_BLK_DEV_TRITON - ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371_1, &ide_init_triton); + /* + * Apparently the BIOS32 services on Intel motherboards are buggy, + * and won't find the PCI_DEVICE_ID_INTEL_82371_1 for us. + * So we instead search for PCI_DEVICE_ID_INTEL_82371_0, and then add 1. + */ + ide_probe_pci (PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371_0, &ide_init_triton, 1); #endif } #endif /* CONFIG_PCI */ diff -u --recursive --new-file v1.3.37/linux/drivers/block/ide.h linux/drivers/block/ide.h --- v1.3.37/linux/drivers/block/ide.h Mon Oct 23 18:02:03 1995 +++ linux/drivers/block/ide.h Tue Nov 7 20:04:31 1995 @@ -4,6 +4,8 @@ * Copyright (C) 1994, 1995 Linus Torvalds & authors */ +#include + /* * This is the multiple IDE interface driver, as evolved from hd.c. * It supports up to four IDE interfaces, on one or more IRQs (usually 14 & 15). diff -u --recursive --new-file v1.3.37/linux/drivers/cdrom/cdu31a.c linux/drivers/cdrom/cdu31a.c --- v1.3.37/linux/drivers/cdrom/cdu31a.c Sun Oct 29 11:38:48 1995 +++ linux/drivers/cdrom/cdu31a.c Mon Oct 30 08:10:48 1995 @@ -172,11 +172,7 @@ #include #include -#ifdef MODULE -# include -# include -char kernel_version[]= UTS_RELEASE; -#endif +#include #include #include diff -u --recursive --new-file v1.3.37/linux/drivers/cdrom/gscd.c linux/drivers/cdrom/gscd.c --- v1.3.37/linux/drivers/cdrom/gscd.c Mon Oct 23 18:02:05 1995 +++ linux/drivers/cdrom/gscd.c Mon Oct 30 08:04:28 1995 @@ -1108,7 +1108,7 @@ } -#ifdef FUTURE_WOTK +#ifdef FUTURE_WORK static long gscd_msf2hsg (struct msf *mp) { return gscd_bcd2bin(mp -> frame) diff -u --recursive --new-file v1.3.37/linux/drivers/char/Makefile linux/drivers/char/Makefile --- v1.3.37/linux/drivers/char/Makefile Wed Sep 27 15:59:57 1995 +++ linux/drivers/char/Makefile Tue Nov 7 09:18:34 1995 @@ -18,7 +18,7 @@ M_OBJS := L_OBJS := tty_io.o n_tty.o console.o keyboard.o serial.o \ tty_ioctl.o pty.o vt.o mem.o vc_screen.o random.o \ - defkeymap.o consolemap.o vesa_blank.o selection.o + defkeymap.o consolemap.o selection.o ifdef CONFIG_CYCLADES L_OBJS += cyclades.o @@ -102,6 +102,12 @@ ifdef CONFIG_SCC L_OBJS += scc.o +endif + +ifdef CONFIG_TGA_CONSOLE +L_OBJS += tga.o +else +L_OBJS += vga.o vesa_blank.o endif include $(TOPDIR)/Rules.make diff -u --recursive --new-file v1.3.37/linux/drivers/char/console.c linux/drivers/char/console.c --- v1.3.37/linux/drivers/char/console.c Tue Oct 10 18:46:33 1995 +++ linux/drivers/char/console.c Tue Nov 7 13:48:23 1995 @@ -3,7 +3,6 @@ * * Copyright (C) 1991, 1992 Linus Torvalds */ - /* * console.c * @@ -33,16 +32,6 @@ * 'void scrollback(int lines)' * 'void scrollfront(int lines)' * - * 'int con_get_font(char *data)' - * 'int con_set_font(char *data, int ch512)' - * 'int con_adjust_height(int fontheight)' - * - * 'int con_get_cmap(char *)' - * 'int con_set_cmap(char *)' - * - * 'int reset_palette(int currcons)' - * 'void set_palette(void)' - * * 'void mouse_report(struct tty_struct * tty, int butt, int mrx, int mry)' * 'int mouse_reporting(void)' * @@ -56,9 +45,6 @@ * Copy and paste function by Andrew Haylett, * some enhancements by Alessandro Rubini. * - * User definable mapping table and font loading by Eugene G. Crosser, - * - * * Code to check for different video-cards mostly by Galen Hunt, * * @@ -71,17 +57,9 @@ * Code for xterm like mouse click reporting by Peter Orbaek 20-Jul-94 * * - * Improved loadable font/UTF-8 support by H. Peter Anvin - * Feb-Sep 1995 - * - * improved scrollback, plus colour palette handling, by Simon Tatham - * 17-Jun-95 - * */ #define BLANK 0x0020 -#define CAN_LOAD_EGA_FONTS /* undefine if the user must not do this */ -#define CAN_LOAD_PALETTE /* undefine if the user must not do this */ /* A bitmap for codes <32. A bit of 1 indicates that the code * corresponding to that bit number invokes some special action @@ -122,7 +100,7 @@ #include "vt_kern.h" #include "consolemap.h" #include "selection.h" - +#include "console_struct.h" #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) @@ -134,20 +112,19 @@ static struct termios *console_termios[MAX_NR_CONSOLES]; static struct termios *console_termios_locked[MAX_NR_CONSOLES]; -#define NPAR 16 - static void con_setsize(unsigned long rows, unsigned long cols); static void vc_init(unsigned int console, unsigned long rows, unsigned long cols, int do_clear); -static void get_scrmem(int currcons); -static void set_scrmem(int currcons, long offset); +extern void get_scrmem(int currcons); +extern void set_scrmem(int currcons, long offset); static void set_origin(int currcons); static void blank_screen(void); static void unblank_screen(void); -void poke_blanked_console(void); +extern void poke_blanked_console(void); static void gotoxy(int currcons, int new_x, int new_y); static void save_cur(int currcons); -static inline void set_cursor(int currcons); +extern void set_cursor(int currcons); +extern void hide_cursor(void); static void reset_terminal(int currcons, int do_clear); extern void reset_vc(unsigned int new_console); extern void vt_init(void); @@ -157,11 +134,15 @@ extern void compute_shiftstate(void); extern void reset_palette(int currcons); extern void set_palette(void); +extern unsigned long con_type_init(unsigned long, char *); +extern int set_get_cmap(unsigned char *, int); +extern int set_get_font(unsigned char *, int, int); /* Description of the hardware situation */ -static unsigned char video_type; /* Type of display being used */ -static unsigned long video_mem_base; /* Base of video memory */ -static unsigned long video_mem_term; /* End of video memory */ +/* used in vga.c/tga.c/etc.c... :-) */ + unsigned char video_type; /* Type of display being used */ + unsigned long video_mem_base; /* Base of video memory */ + unsigned long video_mem_term; /* End of video memory */ static unsigned char video_page; /* Initial video page (unused) */ /* these two also used in vesa_blank.c */ unsigned short video_port_reg; /* Video register select port */ @@ -170,173 +151,141 @@ unsigned long video_num_columns; /* Number of text columns */ unsigned long video_num_lines; /* Number of text lines */ unsigned long video_size_row; -static unsigned long video_screen_size; -static int can_do_color = 0; + unsigned long video_screen_size; + int can_do_color = 0; static int printable = 0; /* Is console ready for printing? */ /* these also used in in vt.c */ int video_mode_512ch = 0; /* 512-character mode */ unsigned long video_font_height; /* Height of current screen font */ unsigned long video_scan_lines; /* Number of scan lines on screen */ unsigned long default_font_height; /* Height of default screen font */ -static int video_font_is_default = 1; + int video_font_is_default = 1; static unsigned short console_charmask = 0x0ff; -static unsigned short *vc_scrbuf[MAX_NR_CONSOLES]; + unsigned short *vc_scrbuf[MAX_NR_CONSOLES]; -static int console_blanked = 0; + int console_blanked = 0; static int blankinterval = 10*60*HZ; static long blank_origin, blank__origin, unblank_origin; +struct vc vc_cons [MAX_NR_CONSOLES]; -struct vc_data { - unsigned long vc_screenbuf_size; - unsigned short vc_video_erase_char; /* Background erase character */ - unsigned char vc_attr; /* Current attributes */ - unsigned char vc_def_color; /* Default colors */ - unsigned char vc_color; /* Foreground & background */ - unsigned char vc_s_color; /* Saved foreground & background */ - unsigned char vc_ulcolor; /* Colour for underline mode */ - unsigned char vc_halfcolor; /* Colour for half intensity mode */ - unsigned long vc_origin; /* Used for EGA/VGA fast scroll */ - unsigned long vc_scr_end; /* Used for EGA/VGA fast scroll */ - unsigned long vc_pos; - unsigned long vc_x,vc_y; - unsigned long vc_top,vc_bottom; - unsigned long vc_state; - unsigned long vc_npar,vc_par[NPAR]; - unsigned long vc_video_mem_start; /* Start of video RAM */ - unsigned long vc_video_mem_end; /* End of video RAM (sort of) */ - unsigned long vc_saved_x; - unsigned long vc_saved_y; - /* mode flags */ - unsigned long vc_charset : 1; /* Character set G0 / G1 */ - unsigned long vc_s_charset : 1; /* Saved character set */ - unsigned long vc_disp_ctrl : 1; /* Display chars < 32? */ - unsigned long vc_toggle_meta : 1; /* Toggle high bit? */ - unsigned long vc_decscnm : 1; /* Screen Mode */ - unsigned long vc_decom : 1; /* Origin Mode */ - unsigned long vc_decawm : 1; /* Autowrap Mode */ - unsigned long vc_deccm : 1; /* Cursor Visible */ - unsigned long vc_decim : 1; /* Insert Mode */ - unsigned long vc_deccolm : 1; /* 80/132 Column Mode */ - /* attribute flags */ - unsigned long vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ - unsigned long vc_underline : 1; - unsigned long vc_blink : 1; - unsigned long vc_reverse : 1; - unsigned long vc_s_intensity : 2; /* saved rendition */ - unsigned long vc_s_underline : 1; - unsigned long vc_s_blink : 1; - unsigned long vc_s_reverse : 1; - /* misc */ - unsigned long vc_ques : 1; - unsigned long vc_need_wrap : 1; - unsigned long vc_has_scrolled : 1; /* Info for unblank_screen */ - unsigned long vc_kmalloced : 1; /* kfree_s() needed */ - unsigned long vc_report_mouse : 2; - unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ - unsigned char vc_utf_count; - long vc_utf_char; - unsigned long vc_tab_stop[5]; /* Tab stops. 160 columns. */ - unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */ - unsigned short * vc_translate; - unsigned char vc_G0_charset; - unsigned char vc_G1_charset; - unsigned char vc_saved_G0; - unsigned char vc_saved_G1; - /* additional information is in vt_kern.h */ -}; - -static struct vc { - struct vc_data *d; - - /* might add scrmem, vt_struct, kbd at some time, - to have everything in one place - the disadvantage - would be that vc_cons etc can no longer be static */ -} vc_cons [MAX_NR_CONSOLES]; - -#define screenbuf_size (vc_cons[currcons].d->vc_screenbuf_size) -#define origin (vc_cons[currcons].d->vc_origin) -#define scr_end (vc_cons[currcons].d->vc_scr_end) -#define pos (vc_cons[currcons].d->vc_pos) -#define top (vc_cons[currcons].d->vc_top) -#define bottom (vc_cons[currcons].d->vc_bottom) -#define x (vc_cons[currcons].d->vc_x) -#define y (vc_cons[currcons].d->vc_y) -#define vc_state (vc_cons[currcons].d->vc_state) -#define npar (vc_cons[currcons].d->vc_npar) -#define par (vc_cons[currcons].d->vc_par) -#define ques (vc_cons[currcons].d->vc_ques) -#define attr (vc_cons[currcons].d->vc_attr) -#define saved_x (vc_cons[currcons].d->vc_saved_x) -#define saved_y (vc_cons[currcons].d->vc_saved_y) -#define translate (vc_cons[currcons].d->vc_translate) -#define G0_charset (vc_cons[currcons].d->vc_G0_charset) -#define G1_charset (vc_cons[currcons].d->vc_G1_charset) -#define saved_G0 (vc_cons[currcons].d->vc_saved_G0) -#define saved_G1 (vc_cons[currcons].d->vc_saved_G1) -#define utf (vc_cons[currcons].d->vc_utf) -#define utf_count (vc_cons[currcons].d->vc_utf_count) -#define utf_char (vc_cons[currcons].d->vc_utf_char) -#define video_mem_start (vc_cons[currcons].d->vc_video_mem_start) -#define video_mem_end (vc_cons[currcons].d->vc_video_mem_end) -#define video_erase_char (vc_cons[currcons].d->vc_video_erase_char) -#define disp_ctrl (vc_cons[currcons].d->vc_disp_ctrl) -#define toggle_meta (vc_cons[currcons].d->vc_toggle_meta) -#define decscnm (vc_cons[currcons].d->vc_decscnm) -#define decom (vc_cons[currcons].d->vc_decom) -#define decawm (vc_cons[currcons].d->vc_decawm) -#define deccm (vc_cons[currcons].d->vc_deccm) -#define decim (vc_cons[currcons].d->vc_decim) -#define deccolm (vc_cons[currcons].d->vc_deccolm) -#define need_wrap (vc_cons[currcons].d->vc_need_wrap) -#define has_scrolled (vc_cons[currcons].d->vc_has_scrolled) -#define kmalloced (vc_cons[currcons].d->vc_kmalloced) -#define report_mouse (vc_cons[currcons].d->vc_report_mouse) -#define color (vc_cons[currcons].d->vc_color) -#define s_color (vc_cons[currcons].d->vc_s_color) -#define def_color (vc_cons[currcons].d->vc_def_color) -#define foreground (color & 0x0f) -#define background (color & 0xf0) -#define charset (vc_cons[currcons].d->vc_charset) -#define s_charset (vc_cons[currcons].d->vc_s_charset) -#define intensity (vc_cons[currcons].d->vc_intensity) -#define underline (vc_cons[currcons].d->vc_underline) -#define blink (vc_cons[currcons].d->vc_blink) -#define reverse (vc_cons[currcons].d->vc_reverse) -#define s_intensity (vc_cons[currcons].d->vc_s_intensity) -#define s_underline (vc_cons[currcons].d->vc_s_underline) -#define s_blink (vc_cons[currcons].d->vc_s_blink) -#define s_reverse (vc_cons[currcons].d->vc_s_reverse) -#define ulcolor (vc_cons[currcons].d->vc_ulcolor) -#define halfcolor (vc_cons[currcons].d->vc_halfcolor) -#define tab_stop (vc_cons[currcons].d->vc_tab_stop) -#define palette (vc_cons[currcons].d->vc_palette) -#define vcmode (vt_cons[currcons]->vc_mode) -#define structsize (sizeof(struct vc_data) + sizeof(struct vt_struct)) +#ifdef CONFIG_SERIAL_ECHO -static void memsetw(void * s, unsigned short c, unsigned int count) +#include + +extern int serial_echo_init (int base); +extern int serial_echo_print (const char *s); + +/* + * this defines the address for the port to which printk echoing is done + * when CONFIG_SERIAL_ECHO is defined + */ +#define SERIAL_ECHO_PORT 0x3f8 /* COM1 */ + +static int serial_echo_port = 0; + +#define serial_echo_outb(v,a) outb((v),(a)+serial_echo_port) +#define serial_echo_inb(a) inb((a)+serial_echo_port) + +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) + +/* Wait for transmitter & holding register to empty */ +#define WAIT_FOR_XMITR \ + do { \ + lsr = serial_echo_inb(UART_LSR); \ + } while ((lsr & BOTH_EMPTY) != BOTH_EMPTY) + +/* These two functions abstract the actual communications with the + * debug port. This is so we can change the underlying communications + * mechanism without modifying the rest of the code. + */ +int +serial_echo_print(const char *s) { - unsigned short * addr = (unsigned short *) s; + int lsr, ier; + int i; - count /= 2; - while (count) { - count--; - scr_writew(c, addr++); + if (!serial_echo_port) return (0); + + /* + * First save the IER then disable the interrupts + */ + ier = serial_echo_inb(UART_IER); + serial_echo_outb(0x00, UART_IER); + + /* + * Now, do each character + */ + for (i = 0; *s; i++, s++) { + WAIT_FOR_XMITR; + + /* Send the character out. */ + serial_echo_outb(*s, UART_TX); + + /* if a LF, also do CR... */ + if (*s == 10) { + WAIT_FOR_XMITR; + serial_echo_outb(13, UART_TX); + } } + + /* + * Finally, Wait for transmitter & holding register to empty + * and restore the IER + */ + do { + lsr = serial_echo_inb(UART_LSR); + } while ((lsr & BOTH_EMPTY) != BOTH_EMPTY); + serial_echo_outb(ier, UART_IER); + + return (0); } -static inline void memcpyw(unsigned short *to, unsigned short *from, - unsigned int count) + +int +serial_echo_init(int base) { - count /= 2; - while (count) { - count--; - scr_writew(scr_readw(from++), to++); - } + int comstat, hi, lo; + + if (base != 0x2f8 && base != 0x3f8) { + serial_echo_port = 0; + return (0); + } else + serial_echo_port = base; + + /* + * read the Divisor Latch + */ + comstat = serial_echo_inb(UART_LCR); + serial_echo_outb(comstat | UART_LCR_DLAB, UART_LCR); + hi = serial_echo_inb(UART_DLM); + lo = serial_echo_inb(UART_DLL); + serial_echo_outb(comstat, UART_LCR); + + /* + * now do hardwired init + */ + serial_echo_outb(0x03, UART_LCR); /* No parity, 8 data bits, 1 stop */ + serial_echo_outb(0x83, UART_LCR); /* Access divisor latch */ + serial_echo_outb(0x00, UART_DLM); /* 9600 baud */ + serial_echo_outb(0x0c, UART_DLL); + serial_echo_outb(0x03, UART_LCR); /* Done with divisor */ + + /* Prior to disabling interrupts, read the LSR and RBR + * registers + */ + comstat = serial_echo_inb(UART_LSR); /* COM? LSR */ + comstat = serial_echo_inb(UART_RX); /* COM? RBR */ + serial_echo_outb(0x00, UART_IER); /* Disable all interrupts */ + + return(0); } +#endif /* CONFIG_SERIAL_ECHO */ + + int vc_cons_allocated(unsigned int i) { return (i < MAX_NR_CONSOLES && vc_cons[i].d); @@ -503,15 +452,15 @@ #define VT100ID "\033[?1;2c" #define VT102ID "\033[?6c" -static unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7, +unsigned char color_table[] = { 0, 4, 2, 6, 1, 5, 3, 7, 8,12,10,14, 9,13,11,15 }; /* the default colour table, for VGA+ colour systems */ -static int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa, +int default_red[] = {0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa, 0x55,0xff,0x55,0xff,0x55,0xff,0x55,0xff}; -static int default_grn[] = {0x00,0x00,0xaa,0x55,0x00,0x00,0xaa,0xaa, +int default_grn[] = {0x00,0x00,0xaa,0x55,0x00,0x00,0xaa,0xaa, 0x55,0x55,0xff,0xff,0x55,0x55,0xff,0xff}; -static int default_blu[] = {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa, +int default_blu[] = {0x00,0x00,0x00,0x00,0xaa,0xaa,0xaa,0xaa, 0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff}; /* @@ -549,27 +498,13 @@ /* * Hardware scrollback support */ -static unsigned short __real_origin; -static unsigned short __origin; /* offset of currently displayed screen */ +unsigned short __real_origin; +unsigned short __origin; /* offset of currently displayed screen */ #define last_lpos (((video_mem_term-video_mem_base)/video_num_columns/2)-video_num_lines+1) #define last_origin_rel ( last_lpos * video_num_columns ) #define last_origin ( video_mem_base + last_origin_rel * 2 ) -static unsigned short __scrollback_mode; /* 1 means scrollback can wrap */ - -static inline void __set_origin(unsigned short offset) -{ - unsigned long flags; - - clear_selection(); - - save_flags(flags); cli(); - __origin = offset; - outb_p(12, video_port_reg); - outb_p(offset >> 8, video_port_val); - outb_p(13, video_port_reg); - outb_p(offset, video_port_val); - restore_flags(flags); -} +unsigned short __scrollback_mode; /* 1 means scrollback can wrap */ +extern void __set_origin(unsigned short); void scrollback(int lines) { @@ -633,40 +568,7 @@ __set_origin(__real_origin); } -/* - * Put the cursor just beyond the end of the display adaptor memory. - */ -static inline void hide_cursor(void) -{ - /* This is inefficient, we could just put the cursor at 0xffff, - but perhaps the delays due to the inefficiency are useful for - some hardware... */ - outb_p(14, video_port_reg); - outb_p(0xff&((video_mem_term-video_mem_base)>>9), video_port_val); - outb_p(15, video_port_reg); - outb_p(0xff&((video_mem_term-video_mem_base)>>1), video_port_val); -} - -static inline void set_cursor(int currcons) -{ - unsigned long flags; - - if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS) - return; - if (__real_origin != __origin) - __set_origin(__real_origin); - save_flags(flags); cli(); - if (deccm) { - outb_p(14, video_port_reg); - outb_p(0xff&((pos-video_mem_base)>>9), video_port_val); - outb_p(15, video_port_reg); - outb_p(0xff&((pos-video_mem_base)>>1), video_port_val); - } else - hide_cursor(); - restore_flags(flags); -} - -static void scrup(int currcons, unsigned int t, unsigned int b) +void scrup(int currcons, unsigned int t, unsigned int b) { int hardscroll = 1; @@ -733,7 +635,8 @@ } } -static void scrdown(int currcons, unsigned int t, unsigned int b) +void +scrdown(int currcons, unsigned int t, unsigned int b) { unsigned short *d, *s; unsigned int count; @@ -1919,6 +1822,10 @@ return; } +#ifdef CONFIG_SERIAL_ECHO + serial_echo_print(b); +#endif /* CONFIG_SERIAL_ECHO */ + while ((c = *(b++)) != 0) { if (c == 10 || c == 13 || need_wrap) { if (c != 13) @@ -2002,7 +1909,7 @@ */ unsigned long con_init(unsigned long kmem_start) { - const char *display_desc = "????"; + char display_desc[5] = "????"; int currcons = 0; int orig_x = ORIG_X; int orig_y = ORIG_Y; @@ -2039,6 +1946,7 @@ video_page = ORIG_VIDEO_PAGE; /* never used */ __scrollback_mode = 0 ; + timer_table[BLANK_TIMER].fn = blank_screen; timer_table[BLANK_TIMER].expires = 0; if (blankinterval) { @@ -2046,90 +1954,7 @@ timer_active |= 1< reports that we - should use 0xA0000 for the bwmap as well.. */ -#define blackwmap ((char *)0xa0000) -#define cmapsz 8192 -#define attrib_port (0x3c0) -#define seq_port_reg (0x3c4) -#define seq_port_val (0x3c5) -#define gr_port_reg (0x3ce) -#define gr_port_val (0x3cf) - -static int set_get_font(char * arg, int set, int ch512) -{ -#ifdef CAN_LOAD_EGA_FONTS - int i; - char *charmap; - int beg; - unsigned short video_port_status = video_port_reg + 6; - int font_select = 0x00; - - /* no use to "load" CGA... */ - - if (video_type == VIDEO_TYPE_EGAC || video_type == VIDEO_TYPE_VGAC) { - charmap = colourmap; - beg = 0x0e; -#ifdef VGA_CAN_DO_64KB - if (video_type == VIDEO_TYPE_VGAC) - beg = 0x06; -#endif - } else if (video_type == VIDEO_TYPE_EGAM) { - charmap = blackwmap; - beg = 0x0a; - } else - return -EINVAL; - - if (arg) - { - i = verify_area(set ? VERIFY_READ : VERIFY_WRITE, (void *)arg, - ch512 ? 2*cmapsz : cmapsz); - if (i) - return i; - } - else - ch512 = 0; /* Default font is always 256 */ - -#ifdef BROKEN_GRAPHICS_PROGRAMS - /* - * All fonts are loaded in slot 0 (0:1 for 512 ch) - */ - - if (!arg) - return -EINVAL; /* Return to default font not supported */ - - video_font_is_default = 0; - font_select = ch512 ? 0x04 : 0x00; -#else - /* - * The default font is kept in slot 0 and is never touched. - * A custom font is loaded in slot 2 (256 ch) or 2:3 (512 ch) - */ - - if (set) - { - video_font_is_default = !arg; - font_select = arg ? (ch512 ? 0x0e : 0x0a) : 0x00; - } - - if ( !video_font_is_default ) - charmap += 4*cmapsz; -#endif - - cli(); - outb_p( 0x00, seq_port_reg ); /* First, the sequencer */ - outb_p( 0x01, seq_port_val ); /* Synchronous reset */ - outb_p( 0x02, seq_port_reg ); - outb_p( 0x04, seq_port_val ); /* CPU writes only to map 2 */ - outb_p( 0x04, seq_port_reg ); - outb_p( 0x07, seq_port_val ); /* Sequential addressing */ - outb_p( 0x00, seq_port_reg ); - outb_p( 0x03, seq_port_val ); /* Clear synchronous reset */ - - outb_p( 0x04, gr_port_reg ); /* Now, the graphics controller */ - outb_p( 0x02, gr_port_val ); /* select map 2 */ - outb_p( 0x05, gr_port_reg ); - outb_p( 0x00, gr_port_val ); /* disable odd-even addressing */ - outb_p( 0x06, gr_port_reg ); - outb_p( 0x00, gr_port_val ); /* map start at A000:0000 */ - sti(); - - if (arg) - { - if (set) - for (i=0; ivc_palette[k++] = default_red[j]; - vc_cons[i].d->vc_palette[k++] = default_grn[j]; - vc_cons[i].d->vc_palette[k++] = default_blu[j]; - } - } - set_palette() ; - } - - return 0; -#else - return -EINVAL; -#endif -} - -/* * Load palette into the EGA/VGA DAC registers. arg points to a colour * map, 3 bytes per colour, 16 colours, range from 0 to 255. */ @@ -2620,22 +2188,6 @@ set_palette() ; } -void set_palette (void) -{ - int i, j ; - - if (video_type != VIDEO_TYPE_VGAC || console_blanked || - vt_cons[fg_console]->vc_mode == KD_GRAPHICS) - return ; - - for (i=j=0; i<16; i++) { - outb_p (color_table[i], dac_reg) ; - outb_p (vc_cons[fg_console].d->vc_palette[j++]>>2, dac_val) ; - outb_p (vc_cons[fg_console].d->vc_palette[j++]>>2, dac_val) ; - outb_p (vc_cons[fg_console].d->vc_palette[j++]>>2, dac_val) ; - } -} - /* * Load font into the EGA/VGA character generator. arg points to a 8192 * byte map, 32 bytes per character. Only first H of them are used for @@ -2658,80 +2210,4 @@ int con_get_font (char *arg) { return set_get_font (arg,0,video_mode_512ch); -} - -/* - * Adjust the screen to fit a font of a certain height - * - * Returns < 0 for error, 0 if nothing changed, and the number - * of lines on the adjusted console if changed. - */ -int con_adjust_height(unsigned long fontheight) -{ - int rows, maxscan; - unsigned char ovr, vde, fsr, curs, cure; - - if (fontheight > 32 || (video_type != VIDEO_TYPE_VGAC && - video_type != VIDEO_TYPE_EGAC && video_type != VIDEO_TYPE_EGAM)) - return -EINVAL; - - if ( fontheight == video_font_height || fontheight == 0 ) - return 0; - - video_font_height = fontheight; - - rows = video_scan_lines/fontheight; /* Number of video rows we end up with */ - maxscan = rows*fontheight - 1; /* Scan lines to actually display-1 */ - - /* Reprogram the CRTC for the new font size - Note: the attempt to read the overflow register will fail - on an EGA, but using 0xff for the previous value appears to - be OK for EGA text modes in the range 257-512 scan lines, so I - guess we don't need to worry about it. - - The same applies for the spill bits in the font size and cursor - registers; they are write-only on EGA, but it appears that they - are all don't care bits on EGA, so I guess it doesn't matter. */ - - cli(); - outb_p( 0x07, video_port_reg ); /* CRTC overflow register */ - ovr = inb_p(video_port_val); - outb_p( 0x09, video_port_reg ); /* Font size register */ - fsr = inb_p(video_port_val); - outb_p( 0x0a, video_port_reg ); /* Cursor start */ - curs = inb_p(video_port_val); - outb_p( 0x0b, video_port_reg ); /* Cursor end */ - cure = inb_p(video_port_val); - sti(); - - vde = maxscan & 0xff; /* Vertical display end reg */ - ovr = (ovr & 0xbd) + /* Overflow register */ - ((maxscan & 0x100) >> 7) + - ((maxscan & 0x200) >> 3); - fsr = (fsr & 0xe0) + (fontheight-1); /* Font size register */ - curs = (curs & 0xc0) + fontheight - (fontheight < 10 ? 2 : 3); - cure = (cure & 0xe0) + fontheight - (fontheight < 10 ? 1 : 2); - - cli(); - outb_p( 0x07, video_port_reg ); /* CRTC overflow register */ - outb_p( ovr, video_port_val ); - outb_p( 0x09, video_port_reg ); /* Font size */ - outb_p( fsr, video_port_val ); - outb_p( 0x0a, video_port_reg ); /* Cursor start */ - outb_p( curs, video_port_val ); - outb_p( 0x0b, video_port_reg ); /* Cursor end */ - outb_p( cure, video_port_val ); - outb_p( 0x12, video_port_reg ); /* Vertical display limit */ - outb_p( vde, video_port_val ); - sti(); - - if ( rows == video_num_lines ) { - /* Change didn't affect number of lines -- no need to scare - the rest of the world */ - return 0; - } - - vc_resize(rows, 0); /* Adjust console size */ - - return rows; } diff -u --recursive --new-file v1.3.37/linux/drivers/char/console.h linux/drivers/char/console.h --- v1.3.37/linux/drivers/char/console.h Thu Jan 1 02:00:00 1970 +++ linux/drivers/char/console.h Tue Nov 7 09:18:35 1995 @@ -0,0 +1,138 @@ +/* + * console.h + * + * Data structure and defines shared between console.c, vga.c and tga.c + */ + +#define NPAR 16 + +struct vc_data { + unsigned long vc_screenbuf_size; + unsigned short vc_video_erase_char; /* Background erase character */ + unsigned char vc_attr; /* Current attributes */ + unsigned char vc_def_color; /* Default colors */ + unsigned char vc_color; /* Foreground & background */ + unsigned char vc_s_color; /* Saved foreground & background */ + unsigned char vc_ulcolor; /* Colour for underline mode */ + unsigned char vc_halfcolor; /* Colour for half intensity mode */ + unsigned long vc_origin; /* Used for EGA/VGA fast scroll */ + unsigned long vc_scr_end; /* Used for EGA/VGA fast scroll */ + unsigned long vc_pos; + unsigned long vc_x,vc_y; + unsigned long vc_top,vc_bottom; + unsigned long vc_state; + unsigned long vc_npar,vc_par[NPAR]; + unsigned long vc_video_mem_start; /* Start of video RAM */ + unsigned long vc_video_mem_end; /* End of video RAM (sort of) */ + unsigned long vc_saved_x; + unsigned long vc_saved_y; + /* mode flags */ + unsigned long vc_charset : 1; /* Character set G0 / G1 */ + unsigned long vc_s_charset : 1; /* Saved character set */ + unsigned long vc_disp_ctrl : 1; /* Display chars < 32? */ + unsigned long vc_toggle_meta : 1; /* Toggle high bit? */ + unsigned long vc_decscnm : 1; /* Screen Mode */ + unsigned long vc_decom : 1; /* Origin Mode */ + unsigned long vc_decawm : 1; /* Autowrap Mode */ + unsigned long vc_deccm : 1; /* Cursor Visible */ + unsigned long vc_decim : 1; /* Insert Mode */ + unsigned long vc_deccolm : 1; /* 80/132 Column Mode */ + /* attribute flags */ + unsigned long vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ + unsigned long vc_underline : 1; + unsigned long vc_blink : 1; + unsigned long vc_reverse : 1; + unsigned long vc_s_intensity : 2; /* saved rendition */ + unsigned long vc_s_underline : 1; + unsigned long vc_s_blink : 1; + unsigned long vc_s_reverse : 1; + /* misc */ + unsigned long vc_ques : 1; + unsigned long vc_need_wrap : 1; + unsigned long vc_has_scrolled : 1; /* Info for unblank_screen */ + unsigned long vc_kmalloced : 1; /* kfree_s() needed */ + unsigned long vc_report_mouse : 2; + unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ + unsigned char vc_utf_count; + long vc_utf_char; + unsigned long vc_tab_stop[5]; /* Tab stops. 160 columns. */ + unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */ + unsigned short * vc_translate; + unsigned char vc_G0_charset; + unsigned char vc_G1_charset; + unsigned char vc_saved_G0; + unsigned char vc_saved_G1; + /* additional information is in vt_kern.h */ +}; + +struct vc { + struct vc_data *d; + + /* might add scrmem, vt_struct, kbd at some time, + to have everything in one place - the disadvantage + would be that vc_cons etc can no longer be static */ +}; + +extern struct vc vc_cons [MAX_NR_CONSOLES]; + +#define screenbuf_size (vc_cons[currcons].d->vc_screenbuf_size) +#define origin (vc_cons[currcons].d->vc_origin) +#define scr_end (vc_cons[currcons].d->vc_scr_end) +#define pos (vc_cons[currcons].d->vc_pos) +#define top (vc_cons[currcons].d->vc_top) +#define bottom (vc_cons[currcons].d->vc_bottom) +#define x (vc_cons[currcons].d->vc_x) +#define y (vc_cons[currcons].d->vc_y) +#define vc_state (vc_cons[currcons].d->vc_state) +#define npar (vc_cons[currcons].d->vc_npar) +#define par (vc_cons[currcons].d->vc_par) +#define ques (vc_cons[currcons].d->vc_ques) +#define attr (vc_cons[currcons].d->vc_attr) +#define saved_x (vc_cons[currcons].d->vc_saved_x) +#define saved_y (vc_cons[currcons].d->vc_saved_y) +#define translate (vc_cons[currcons].d->vc_translate) +#define G0_charset (vc_cons[currcons].d->vc_G0_charset) +#define G1_charset (vc_cons[currcons].d->vc_G1_charset) +#define saved_G0 (vc_cons[currcons].d->vc_saved_G0) +#define saved_G1 (vc_cons[currcons].d->vc_saved_G1) +#define utf (vc_cons[currcons].d->vc_utf) +#define utf_count (vc_cons[currcons].d->vc_utf_count) +#define utf_char (vc_cons[currcons].d->vc_utf_char) +#define video_mem_start (vc_cons[currcons].d->vc_video_mem_start) +#define video_mem_end (vc_cons[currcons].d->vc_video_mem_end) +#define video_erase_char (vc_cons[currcons].d->vc_video_erase_char) +#define disp_ctrl (vc_cons[currcons].d->vc_disp_ctrl) +#define toggle_meta (vc_cons[currcons].d->vc_toggle_meta) +#define decscnm (vc_cons[currcons].d->vc_decscnm) +#define decom (vc_cons[currcons].d->vc_decom) +#define decawm (vc_cons[currcons].d->vc_decawm) +#define deccm (vc_cons[currcons].d->vc_deccm) +#define decim (vc_cons[currcons].d->vc_decim) +#define deccolm (vc_cons[currcons].d->vc_deccolm) +#define need_wrap (vc_cons[currcons].d->vc_need_wrap) +#define has_scrolled (vc_cons[currcons].d->vc_has_scrolled) +#define kmalloced (vc_cons[currcons].d->vc_kmalloced) +#define report_mouse (vc_cons[currcons].d->vc_report_mouse) +#define color (vc_cons[currcons].d->vc_color) +#define s_color (vc_cons[currcons].d->vc_s_color) +#define def_color (vc_cons[currcons].d->vc_def_color) +#define foreground (color & 0x0f) +#define background (color & 0xf0) +#define charset (vc_cons[currcons].d->vc_charset) +#define s_charset (vc_cons[currcons].d->vc_s_charset) +#define intensity (vc_cons[currcons].d->vc_intensity) +#define underline (vc_cons[currcons].d->vc_underline) +#define blink (vc_cons[currcons].d->vc_blink) +#define reverse (vc_cons[currcons].d->vc_reverse) +#define s_intensity (vc_cons[currcons].d->vc_s_intensity) +#define s_underline (vc_cons[currcons].d->vc_s_underline) +#define s_blink (vc_cons[currcons].d->vc_s_blink) +#define s_reverse (vc_cons[currcons].d->vc_s_reverse) +#define ulcolor (vc_cons[currcons].d->vc_ulcolor) +#define halfcolor (vc_cons[currcons].d->vc_halfcolor) +#define tab_stop (vc_cons[currcons].d->vc_tab_stop) +#define palette (vc_cons[currcons].d->vc_palette) + +#define vcmode (vt_cons[currcons]->vc_mode) +#define structsize (sizeof(struct vc_data) + sizeof(struct vt_struct)) + diff -u --recursive --new-file v1.3.37/linux/drivers/char/console_struct.h linux/drivers/char/console_struct.h --- v1.3.37/linux/drivers/char/console_struct.h Thu Jan 1 02:00:00 1970 +++ linux/drivers/char/console_struct.h Tue Nov 7 09:18:35 1995 @@ -0,0 +1,138 @@ +/* + * console_struct.h + * + * Data structure and defines shared between console.c, vga.c and tga.c + */ + +#define NPAR 16 + +struct vc_data { + unsigned long vc_screenbuf_size; + unsigned short vc_video_erase_char; /* Background erase character */ + unsigned char vc_attr; /* Current attributes */ + unsigned char vc_def_color; /* Default colors */ + unsigned char vc_color; /* Foreground & background */ + unsigned char vc_s_color; /* Saved foreground & background */ + unsigned char vc_ulcolor; /* Colour for underline mode */ + unsigned char vc_halfcolor; /* Colour for half intensity mode */ + unsigned long vc_origin; /* Used for EGA/VGA fast scroll */ + unsigned long vc_scr_end; /* Used for EGA/VGA fast scroll */ + unsigned long vc_pos; + unsigned long vc_x,vc_y; + unsigned long vc_top,vc_bottom; + unsigned long vc_state; + unsigned long vc_npar,vc_par[NPAR]; + unsigned long vc_video_mem_start; /* Start of video RAM */ + unsigned long vc_video_mem_end; /* End of video RAM (sort of) */ + unsigned long vc_saved_x; + unsigned long vc_saved_y; + /* mode flags */ + unsigned long vc_charset : 1; /* Character set G0 / G1 */ + unsigned long vc_s_charset : 1; /* Saved character set */ + unsigned long vc_disp_ctrl : 1; /* Display chars < 32? */ + unsigned long vc_toggle_meta : 1; /* Toggle high bit? */ + unsigned long vc_decscnm : 1; /* Screen Mode */ + unsigned long vc_decom : 1; /* Origin Mode */ + unsigned long vc_decawm : 1; /* Autowrap Mode */ + unsigned long vc_deccm : 1; /* Cursor Visible */ + unsigned long vc_decim : 1; /* Insert Mode */ + unsigned long vc_deccolm : 1; /* 80/132 Column Mode */ + /* attribute flags */ + unsigned long vc_intensity : 2; /* 0=half-bright, 1=normal, 2=bold */ + unsigned long vc_underline : 1; + unsigned long vc_blink : 1; + unsigned long vc_reverse : 1; + unsigned long vc_s_intensity : 2; /* saved rendition */ + unsigned long vc_s_underline : 1; + unsigned long vc_s_blink : 1; + unsigned long vc_s_reverse : 1; + /* misc */ + unsigned long vc_ques : 1; + unsigned long vc_need_wrap : 1; + unsigned long vc_has_scrolled : 1; /* Info for unblank_screen */ + unsigned long vc_kmalloced : 1; /* kfree_s() needed */ + unsigned long vc_report_mouse : 2; + unsigned char vc_utf : 1; /* Unicode UTF-8 encoding */ + unsigned char vc_utf_count; + long vc_utf_char; + unsigned long vc_tab_stop[5]; /* Tab stops. 160 columns. */ + unsigned char vc_palette[16*3]; /* Colour palette for VGA+ */ + unsigned short * vc_translate; + unsigned char vc_G0_charset; + unsigned char vc_G1_charset; + unsigned char vc_saved_G0; + unsigned char vc_saved_G1; + /* additional information is in vt_kern.h */ +}; + +struct vc { + struct vc_data *d; + + /* might add scrmem, vt_struct, kbd at some time, + to have everything in one place - the disadvantage + would be that vc_cons etc can no longer be static */ +}; + +extern struct vc vc_cons [MAX_NR_CONSOLES]; + +#define screenbuf_size (vc_cons[currcons].d->vc_screenbuf_size) +#define origin (vc_cons[currcons].d->vc_origin) +#define scr_end (vc_cons[currcons].d->vc_scr_end) +#define pos (vc_cons[currcons].d->vc_pos) +#define top (vc_cons[currcons].d->vc_top) +#define bottom (vc_cons[currcons].d->vc_bottom) +#define x (vc_cons[currcons].d->vc_x) +#define y (vc_cons[currcons].d->vc_y) +#define vc_state (vc_cons[currcons].d->vc_state) +#define npar (vc_cons[currcons].d->vc_npar) +#define par (vc_cons[currcons].d->vc_par) +#define ques (vc_cons[currcons].d->vc_ques) +#define attr (vc_cons[currcons].d->vc_attr) +#define saved_x (vc_cons[currcons].d->vc_saved_x) +#define saved_y (vc_cons[currcons].d->vc_saved_y) +#define translate (vc_cons[currcons].d->vc_translate) +#define G0_charset (vc_cons[currcons].d->vc_G0_charset) +#define G1_charset (vc_cons[currcons].d->vc_G1_charset) +#define saved_G0 (vc_cons[currcons].d->vc_saved_G0) +#define saved_G1 (vc_cons[currcons].d->vc_saved_G1) +#define utf (vc_cons[currcons].d->vc_utf) +#define utf_count (vc_cons[currcons].d->vc_utf_count) +#define utf_char (vc_cons[currcons].d->vc_utf_char) +#define video_mem_start (vc_cons[currcons].d->vc_video_mem_start) +#define video_mem_end (vc_cons[currcons].d->vc_video_mem_end) +#define video_erase_char (vc_cons[currcons].d->vc_video_erase_char) +#define disp_ctrl (vc_cons[currcons].d->vc_disp_ctrl) +#define toggle_meta (vc_cons[currcons].d->vc_toggle_meta) +#define decscnm (vc_cons[currcons].d->vc_decscnm) +#define decom (vc_cons[currcons].d->vc_decom) +#define decawm (vc_cons[currcons].d->vc_decawm) +#define deccm (vc_cons[currcons].d->vc_deccm) +#define decim (vc_cons[currcons].d->vc_decim) +#define deccolm (vc_cons[currcons].d->vc_deccolm) +#define need_wrap (vc_cons[currcons].d->vc_need_wrap) +#define has_scrolled (vc_cons[currcons].d->vc_has_scrolled) +#define kmalloced (vc_cons[currcons].d->vc_kmalloced) +#define report_mouse (vc_cons[currcons].d->vc_report_mouse) +#define color (vc_cons[currcons].d->vc_color) +#define s_color (vc_cons[currcons].d->vc_s_color) +#define def_color (vc_cons[currcons].d->vc_def_color) +#define foreground (color & 0x0f) +#define background (color & 0xf0) +#define charset (vc_cons[currcons].d->vc_charset) +#define s_charset (vc_cons[currcons].d->vc_s_charset) +#define intensity (vc_cons[currcons].d->vc_intensity) +#define underline (vc_cons[currcons].d->vc_underline) +#define blink (vc_cons[currcons].d->vc_blink) +#define reverse (vc_cons[currcons].d->vc_reverse) +#define s_intensity (vc_cons[currcons].d->vc_s_intensity) +#define s_underline (vc_cons[currcons].d->vc_s_underline) +#define s_blink (vc_cons[currcons].d->vc_s_blink) +#define s_reverse (vc_cons[currcons].d->vc_s_reverse) +#define ulcolor (vc_cons[currcons].d->vc_ulcolor) +#define halfcolor (vc_cons[currcons].d->vc_halfcolor) +#define tab_stop (vc_cons[currcons].d->vc_tab_stop) +#define palette (vc_cons[currcons].d->vc_palette) + +#define vcmode (vt_cons[currcons]->vc_mode) +#define structsize (sizeof(struct vc_data) + sizeof(struct vt_struct)) + diff -u --recursive --new-file v1.3.37/linux/drivers/char/istallion.c linux/drivers/char/istallion.c --- v1.3.37/linux/drivers/char/istallion.c Tue Oct 10 18:46:33 1995 +++ linux/drivers/char/istallion.c Mon Oct 30 10:22:00 1995 @@ -25,11 +25,7 @@ /*****************************************************************************/ -#ifdef MODULE -#include #include -#include -#endif #include #include @@ -711,11 +707,6 @@ /*****************************************************************************/ #ifdef MODULE - -/* - * Include kernel version number for modules. - */ -char kernel_version[] = UTS_RELEASE; int init_module() { diff -u --recursive --new-file v1.3.37/linux/drivers/char/keyboard.c linux/drivers/char/keyboard.c --- v1.3.37/linux/drivers/char/keyboard.c Mon Oct 16 18:38:22 1995 +++ linux/drivers/char/keyboard.c Tue Nov 7 09:18:35 1995 @@ -1196,6 +1196,7 @@ request_irq(KEYBOARD_IRQ, keyboard_interrupt, 0, "keyboard"); request_region(0x60,16,"kbd"); #ifdef __alpha__ +#if 0 /* if there is an input byte left, eat it up: */ if (inb(0x64) & 0x01) { inb(0x60); @@ -1209,8 +1210,192 @@ kb_wait(); if (!send_data(0xf0) || !send_data(0x02)) printk("Scanmode 2 change failed\n"); -#endif +#else /* 0 */ + { + static int alpha_kbd_init(void); /* forward decl */ + + alpha_kbd_init(); + } +#endif /* 0 */ +#endif /* __alpha __ */ mark_bh(KEYBOARD_BH); enable_bh(KEYBOARD_BH); return 0; } + +#ifdef __alpha__ +/* + * keyboard controller registers + */ +#define KBD_STATUS_REG (unsigned int) 0x64 +#define KBD_CNTL_REG (unsigned int) 0x64 +#define KBD_DATA_REG (unsigned int) 0x60 +/* + * controller commands + */ +#define KBD_READ_MODE (unsigned int) 0x20 +#define KBD_WRITE_MODE (unsigned int) 0x60 +#define KBD_SELF_TEST (unsigned int) 0xAA +#define KBD_SELF_TEST2 (unsigned int) 0xAB +#define KBD_CNTL_ENABLE (unsigned int) 0xAE +/* + * keyboard commands + */ +#define KBD_ENABLE (unsigned int) 0xF4 +#define KBD_DISABLE (unsigned int) 0xF5 +#define KBD_RESET (unsigned int) 0xFF +/* + * keyboard replies + */ +#define KBD_ACK (unsigned int) 0xFA +#define KBD_POR (unsigned int) 0xAA +/* + * status register bits + */ +#define KBD_OBF (unsigned int) 0x01 +#define KBD_IBF (unsigned int) 0x02 +#define KBD_GTO (unsigned int) 0x40 +#define KBD_PERR (unsigned int) 0x80 +/* + * keyboard controller mode register bits + */ +#define KBD_EKI (unsigned int) 0x01 + +#define TIMEOUT_CONST 500000 + +static int +kbd_wait_for_input(void) +{ + int n; + int status, data; + + n = TIMEOUT_CONST; + do { + status = inb(KBD_STATUS_REG); + /* + * Wait for input data to become available. This bit will + * then be cleared by the following read of the DATA + * register. + */ + + if (!(status & KBD_OBF)) + continue; + + data = inb(KBD_DATA_REG); + + /* + * Check to see if a timeout error has occured. This means + * that transmission was started but did not complete in the + * normal time cycle. PERR is set when a parity error occured + * in the last transmission. + */ + if (status & (KBD_GTO | KBD_PERR)) { + continue; + } + return (data & 0xff); + } while (--n); + return (-1); /* timed-out if fell through to here... */ +} + +static void +kbd_write(int address, int data) +{ + int status; + + do { + status = inb(KBD_STATUS_REG); /* spin until input buffer empty*/ + } while (status & KBD_IBF); + outb(data, address); /* write out the data*/ +} + +static int +alpha_kbd_init(void) +{ + unsigned long flags; + + save_flags(flags); cli(); + + /* Flush any pending input. */ + while (kbd_wait_for_input() != -1) + continue; + + /* + * Test the keyboard interface. + * This seems to be the only way to get it going. + * If the test is successful a x55 is placed in the input buffer. + */ + kbd_write(KBD_CNTL_REG, KBD_SELF_TEST); + if (kbd_wait_for_input() != 0x55) { + printk("alpha_kbd_init: keyboard failed self test.\n"); + restore_flags(flags); + return(-1); + } + + /* + * Perform a keyboard interface test. This causes the controller + * to test the keyboard clock and data lines. The results of the + * test are placed in the input buffer. + */ + kbd_write(KBD_CNTL_REG, KBD_SELF_TEST2); + if (kbd_wait_for_input() != 0x00) { + printk("alpha_kbd_init: keyboard failed self test 2.\n"); + restore_flags(flags); + return(-1); + } + + /* Enable the keyboard by allowing the keyboard clock to run. */ + kbd_write(KBD_CNTL_REG, KBD_CNTL_ENABLE); + + /* + * Reset keyboard. If the read times out + * then the assumption is that no keyboard is + * plugged into the machine. + * This defaults the keyboard to scan-code set 2. + */ + kbd_write(KBD_DATA_REG, KBD_RESET); + if (kbd_wait_for_input() != KBD_ACK) { + printk("alpha_kbd_init: reset kbd failed, no ACK.\n"); + restore_flags(flags); + return(-1); + } + + if (kbd_wait_for_input() != KBD_POR) { + printk("alpha_kbd_init: reset kbd failed, not POR.\n"); + restore_flags(flags); + return(-1); + } + + /* + * now do a DEFAULTS_DISABLE always + */ + kbd_write(KBD_DATA_REG, KBD_DISABLE); + if (kbd_wait_for_input() != KBD_ACK) { + printk("alpha_kbd_init: disable kbd failed, no ACK.\n"); + restore_flags(flags); + return(-1); + } + + /* + * enable keyboard interrupt, operate in "real" mode, + * Enable keyboard (by clearing the disable keyboard bit), + * no conversion of keycodes. + */ + kbd_write(KBD_CNTL_REG, KBD_WRITE_MODE); + kbd_write(KBD_DATA_REG, KBD_EKI); + + /* + * now ENABLE the keyboard to set it scanning... + */ + kbd_write(KBD_DATA_REG, KBD_ENABLE); + if (kbd_wait_for_input() != KBD_ACK) { + printk("alpha_kbd_init: keyboard enable failed.\n"); + restore_flags(flags); + return(-1); + } + + restore_flags(flags); + + return (1); + +} +#endif /* __alpha__ */ diff -u --recursive --new-file v1.3.37/linux/drivers/char/mouse.c linux/drivers/char/mouse.c --- v1.3.37/linux/drivers/char/mouse.c Tue Oct 10 18:46:33 1995 +++ linux/drivers/char/mouse.c Tue Nov 7 12:16:23 1995 @@ -16,13 +16,7 @@ * Support for loadable modules. 8-Sep-95 Philip Blundell */ -#ifdef MODULE #include -#include -#else -#define MOD_INC_USE_COUNT -#define MOD_DEC_USE_COUNT -#endif #include #include @@ -100,8 +94,14 @@ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; + #define mouse_init init_module + +void cleanup_module(void) +{ + unregister_chrdev(MOUSE_MAJOR, "mouse"); +} + #endif int mouse_init(void) @@ -127,14 +127,3 @@ } return 0; } - -#ifdef MODULE -void cleanup_module(void) -{ - if (MOD_IN_USE) { - printk("mouse: in use, remove delayed\n"); - return; - } - unregister_chrdev(MOUSE_MAJOR, "mouse"); -} -#endif diff -u --recursive --new-file v1.3.37/linux/drivers/char/scc.c linux/drivers/char/scc.c --- v1.3.37/linux/drivers/char/scc.c Tue Oct 10 18:46:34 1995 +++ linux/drivers/char/scc.c Mon Oct 30 10:23:15 1995 @@ -1,6 +1,3 @@ -#include /* fastest method */ -#ifdef CONFIG_SCC - #define RCS_ID "$Id: scc.c,v 1.26 1995/09/07 14:46:19 jreuter Exp jreuter $" #define BANNER "Z8530 SCC driver v1.9.dl1bke (beta) by dl1bke\n" @@ -134,7 +131,6 @@ #include #include #include -#include #include #include #include @@ -2420,4 +2416,3 @@ return 0; } -#endif diff -u --recursive --new-file v1.3.37/linux/drivers/char/selection.h linux/drivers/char/selection.h --- v1.3.37/linux/drivers/char/selection.h Mon Sep 18 14:53:53 1995 +++ linux/drivers/char/selection.h Tue Nov 7 20:04:52 1995 @@ -15,6 +15,31 @@ extern unsigned long video_num_columns; extern unsigned long video_num_lines; extern unsigned long video_size_row; +extern unsigned char video_type; +extern unsigned long video_mem_base; +extern unsigned long video_mem_term; +extern unsigned long video_screen_size; +extern unsigned short video_port_reg; +extern unsigned short video_port_val; + +extern int console_blanked; +extern int can_do_color; + +extern unsigned long video_font_height; +extern unsigned long video_scan_lines; +extern unsigned long default_font_height; +extern int video_font_is_default; + +extern unsigned char color_table[]; +extern int default_red[]; +extern int default_grn[]; +extern int default_blu[]; + +extern unsigned short __real_origin; +extern unsigned short __origin; +extern unsigned short __scrollback_mode; + +extern unsigned short *vc_scrbuf[MAX_NR_CONSOLES]; extern void do_unblank_screen(void); extern unsigned short *screen_pos(int currcons, int w_offset, int viewed); @@ -32,11 +57,68 @@ extern void getconsxy(int currcons, char *p); extern void putconsxy(int currcons, char *p); + /* how to access screen memory */ + +#include + +#ifdef CONFIG_TGA_CONSOLE + +extern int tga_blitc(unsigned int, unsigned long); +extern unsigned long video_mem_term; + +/* + * TGA console screen memory access + * + * TGA is *not* a character/attribute cell device; font bitmaps must be rendered + * to the screen pixels. + * + * The "unsigned short * addr" is *ALWAYS* a kernel virtual address, either + * of the VC's backing store, or the "shadow screen" memory where the screen + * contents are kept, as the TGA frame buffer is *not* char/attr cells. + * + * The "(unsigned long) addr < video_mem_term" tests for an Alpha kernel + * virtual address less than the end of the "shadow scrren" memory. This + * indicates we really want to write to the screen, so, we do... :-) + * + * NOTE: we must guarantee that video_mem_term is less than *any* VC's backing + * store; to do that, we must allocate it earlier than any VC's are done. + * + * NOTE also: there's only *TWO* operations: to put/get a character/attribute. + * All the others needed by VGA support go away, as Not Applicable for TGA. + */ +static inline void scr_writew(unsigned short val, unsigned short * addr) +{ + /* + * always deposit the char/attr, then see if it was to "screen" mem. + * if so, then render the char/attr onto the real screen. + */ + *addr = val; + if ((unsigned long)addr < video_mem_term) { + tga_blitc(val, (unsigned long) addr); + } +} + +static inline unsigned short scr_readw(unsigned short * addr) +{ + return *addr; +} +#else /* CONFIG_TGA_CONSOLE */ + +/* + * normal VGA console access + * + */ + #ifdef __alpha__ #include +/* + * NOTE: "(long) addr < 0" tests for an Alpha kernel virtual address; this + * indicates a VC's backing store; otherwise, it's a bus memory address, for + * the VGA's screen memory, so we do the Alpha "swizzle"... :-) + */ static inline void scr_writeb(unsigned char val, unsigned char * addr) { if ((long) addr < 0) @@ -67,8 +149,12 @@ return readw((unsigned long) addr); } -#else - +#else /* __alpha__ */ +/* + * normal VGA console access + * + * NOTE: these do normal PC-style frame buffer accesses + */ static inline void scr_writeb(unsigned char val, unsigned char * addr) { *addr = val; @@ -89,4 +175,26 @@ return *addr; } -#endif +#endif /* __alpha__ */ +#endif /* CONFIG_TGA_CONSOLE */ + +static inline void memsetw(void * s, unsigned short c, unsigned int count) +{ + unsigned short * addr = (unsigned short *) s; + + count /= 2; + while (count) { + count--; + scr_writew(c, addr++); + } +} + +static inline void memcpyw(unsigned short *to, unsigned short *from, + unsigned int count) +{ + count /= 2; + while (count) { + count--; + scr_writew(scr_readw(from++), to++); + } +} diff -u --recursive --new-file v1.3.37/linux/drivers/char/tga.c linux/drivers/char/tga.c --- v1.3.37/linux/drivers/char/tga.c Thu Jan 1 02:00:00 1970 +++ linux/drivers/char/tga.c Tue Nov 7 12:08:20 1995 @@ -0,0 +1,1136 @@ +/* + * linux/drivers/char/tga.c + * + * Copyright (C) 1995 Jay Estabrook + */ + +/* + * tga.c + * + * This module exports the console io support for DEC's TGA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "kbd_kern.h" +#include "vt_kern.h" +#include "consolemap.h" +#include "selection.h" +#include "console_struct.h" + +extern void register_console(void (*proc)(const char *)); +extern void console_print(const char *); + +/* TGA hardware description (minimal) */ +/* + * Offsets within Memory Space + */ +#define TGA_ROM_OFFSET 0x0000000 +#define TGA_REGS_OFFSET 0x0100000 +#define TGA_8PLANE_FB_OFFSET 0x0200000 +#define TGA_24PLANE_FB_OFFSET 0x0804000 +#define TGA_24PLUSZ_FB_OFFSET 0x1004000 + +#define TGA_PLANEMASK_REG 0x0028 +#define TGA_MODE_REG 0x0030 +#define TGA_RASTEROP_REG 0x0034 +#define TGA_DEEP_REG 0x0050 +#define TGA_PIXELMASK_REG 0x005c +#define TGA_CURSOR_BASE_REG 0x0060 +#define TGA_HORIZ_REG 0x0064 +#define TGA_VERT_REG 0x0068 +#define TGA_BASE_ADDR_REG 0x006c +#define TGA_VALID_REG 0x0070 +#define TGA_CURSOR_XY_REG 0x0074 +#define TGA_INTR_STAT_REG 0x007c +#define TGA_RAMDAC_SETUP_REG 0x00c0 +#define TGA_BLOCK_COLOR0_REG 0x0140 +#define TGA_BLOCK_COLOR1_REG 0x0144 +#define TGA_CLOCK_REG 0x01e8 +#define TGA_RAMDAC_REG 0x01f0 +#define TGA_CMD_STAT_REG 0x01f8 + +/* + * useful defines for managing the BT485 on the 8-plane TGA + */ +#define BT485_READ_BIT 0x01 +#define BT485_WRITE_BIT 0x00 + +#define BT485_ADDR_PAL_WRITE 0x00 +#define BT485_DATA_PAL 0x02 +#define BT485_PIXEL_MASK 0x04 +#define BT485_ADDR_PAL_READ 0x06 +#define BT485_ADDR_CUR_WRITE 0x08 +#define BT485_DATA_CUR 0x0a +#define BT485_CMD_0 0x0c +#define BT485_ADDR_CUR_READ 0x0e +#define BT485_CMD_1 0x10 +#define BT485_CMD_2 0x12 +#define BT485_STATUS 0x14 +#define BT485_CMD_3 0x14 +#define BT485_CUR_RAM 0x16 +#define BT485_CUR_LOW_X 0x18 +#define BT485_CUR_HIGH_X 0x1a +#define BT485_CUR_LOW_Y 0x1c +#define BT485_CUR_HIGH_Y 0x1e + +/* + * useful defines for managing the BT463 on the 24-plane TGAs + */ +#define BT463_ADDR_LO 0x0 +#define BT463_ADDR_HI 0x1 +#define BT463_REG_ACC 0x2 +#define BT463_PALETTE 0x3 + +#define BT463_CUR_CLR_0 0x0100 +#define BT463_CUR_CLR_1 0x0101 + +#define BT463_CMD_REG_0 0x0201 +#define BT463_CMD_REG_1 0x0202 +#define BT463_CMD_REG_2 0x0203 + +#define BT463_READ_MASK_0 0x0205 +#define BT463_READ_MASK_1 0x0206 +#define BT463_READ_MASK_2 0x0207 +#define BT463_READ_MASK_3 0x0208 + +#define BT463_BLINK_MASK_0 0x0209 +#define BT463_BLINK_MASK_1 0x020a +#define BT463_BLINK_MASK_2 0x020b +#define BT463_BLINK_MASK_3 0x020c + +#define BT463_WINDOW_TYPE_BASE 0x0300 + +/* + * built-in font management constants + * + * NOTE: the built-in font is 8x16, and the video resolution + * is 640x480 @ 60Hz. + * This means we could put 30 rows of text on the screen (480/16). + * However, we wish to make then TGA look just like a VGA, as the + * default, so, we pad the character to 8x18, and leave some scan + * lines at the bottom unused. + */ +#define TGA_F_WIDTH 8 +#define TGA_F_HEIGHT 16 +#define TGA_F_HEIGHT_PADDED 18 + +int tga_type; +unsigned int tga_mem_base; +unsigned long tga_fb_base; +unsigned long tga_regs_base; +unsigned int tga_bpp, tga_fb_width, tga_fb_height, tga_fb_stride; + +static unsigned int fb_offset_presets[4] = { + TGA_8PLANE_FB_OFFSET, + TGA_24PLANE_FB_OFFSET, + 0xffffffff, + TGA_24PLUSZ_FB_OFFSET +}; + +static unsigned int deep_presets[4] = { + 0x00014000, + 0x0001440d, + 0xffffffff, + 0x0001441d +}; + +static unsigned int rasterop_presets[4] = { + 0x00000003, + 0x00000303, + 0xffffffff, + 0x00000303 +}; + +static unsigned int mode_presets[4] = { + 0x00002000, + 0x00002300, + 0xffffffff, + 0x00002300 +}; + +static unsigned int base_addr_presets[4] = { + 0x00000000, + 0x00000001, + 0xffffffff, + 0x00000001 +}; + +#define TGA_WRITE_REG(v,r) \ + { writel((v), tga_regs_base+(r)); mb(); } + +#define TGA_READ_REG(r) readl(tga_regs_base+(r)) + +#define BT485_WRITE(v,r) \ + TGA_WRITE_REG((r),TGA_RAMDAC_SETUP_REG); \ + TGA_WRITE_REG(((v)&0xff)|((r)<<8),TGA_RAMDAC_REG); + +#define BT463_LOAD_ADDR(a) \ + TGA_WRITE_REG(BT463_ADDR_LO<<2, TGA_RAMDAC_SETUP_REG); \ + TGA_WRITE_REG((BT463_ADDR_LO<<10)|((a)&0xff), TGA_RAMDAC_REG); \ + TGA_WRITE_REG(BT463_ADDR_HI<<2, TGA_RAMDAC_SETUP_REG); \ + TGA_WRITE_REG((BT463_ADDR_HI<<10)|(((a)>>8)&0xff), TGA_RAMDAC_REG); + +#define BT463_WRITE(m,a,v) \ + BT463_LOAD_ADDR((a)); \ + TGA_WRITE_REG(((m)<<2),TGA_RAMDAC_SETUP_REG); \ + TGA_WRITE_REG(((m)<<10)|((v)&0xff),TGA_RAMDAC_REG); + +extern char tga_builtin_font[]; + +void tga_init_video(void); +void tga_clear_screen(void); + +void +set_palette (void) +{ + int i, j; + + if (tga_type == 0) { /* 8-plane */ + BT485_WRITE(0x00, BT485_ADDR_PAL_WRITE); + TGA_WRITE_REG(BT485_DATA_PAL, TGA_RAMDAC_SETUP_REG); + + for (i = 0; i < 16; i++) { + j = color_table[i]; + TGA_WRITE_REG(default_red[j]|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG); + TGA_WRITE_REG(default_grn[j]|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG); + TGA_WRITE_REG(default_blu[j]|(BT485_DATA_PAL<<8),TGA_RAMDAC_REG); + } + } else { + BT463_LOAD_ADDR(0x0000); + TGA_WRITE_REG((BT463_PALETTE<<2), TGA_RAMDAC_REG); + + for (i = 0; i < 16; i++) { + j = color_table[i]; + TGA_WRITE_REG(default_red[j]|(BT463_PALETTE<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(default_grn[j]|(BT463_PALETTE<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(default_blu[j]|(BT463_PALETTE<<10), TGA_RAMDAC_REG); + } + } +} + +void +__set_origin(unsigned short offset) +{ + /* + * should not be called, but if so, do nothing... + */ +} + +/* + * Hide the cursor from view, during blanking, usually... + */ +void +hide_cursor(void) +{ + unsigned long flags; + save_flags(flags); cli(); + + if (tga_type == 0) { + BT485_WRITE(0x20, BT485_CMD_2); + } else { + TGA_WRITE_REG(0x03, TGA_VALID_REG); /* SCANNING and BLANK */ + } + + restore_flags(flags); +} + +void +set_cursor(int currcons) +{ + unsigned int idx, xt, yt, row, col; + unsigned long flags; + + if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS) + return; + + if (__real_origin != __origin) + __set_origin(__real_origin); + + save_flags(flags); cli(); + + if (deccm) { + idx = (pos - video_mem_base) >> 1; + col = idx % 80; + row = (idx - col) / 80; + + if (tga_type == 0) { /* 8-plane */ + + xt = col * TGA_F_WIDTH + 64; + yt = row * TGA_F_HEIGHT_PADDED + 64; + + /* make sure it's enabled */ + BT485_WRITE(0x22, BT485_CMD_2); /* WIN cursor type */ + + BT485_WRITE(xt, BT485_CUR_LOW_X); + BT485_WRITE((xt >> 8), BT485_CUR_HIGH_X); + BT485_WRITE(yt, BT485_CUR_LOW_Y); + BT485_WRITE((yt >> 8), BT485_CUR_HIGH_Y); + + } else { + + xt = col * TGA_F_WIDTH + 144; + yt = row * TGA_F_HEIGHT_PADDED + 35; + + TGA_WRITE_REG(0x05, TGA_VALID_REG); /* SCANNING and CURSOR */ + TGA_WRITE_REG(xt | (yt << 12), TGA_CURSOR_XY_REG); + } + + } else + hide_cursor(); + restore_flags(flags); +} + +unsigned long +con_type_init(unsigned long kmem_start, char *display_desc) +{ + can_do_color = 1; + + /* + * fake the screen memory with some CPU memory + */ + video_mem_base = kmem_start; + kmem_start += video_screen_size; + video_mem_term = kmem_start; + + video_type = VIDEO_TYPE_TGAC; + + strcpy(display_desc,"TGA"); + + return kmem_start; +} + +/* + * NOTE: get_scrmem() and set_scrmem() are here only because + * the VGA version of set_scrmem() has some direct VGA references. + */ +void +get_scrmem(int currcons) +{ + memcpyw((unsigned short *)vc_scrbuf[currcons], + (unsigned short *)origin, video_screen_size); + __scrollback_mode = 0 ; + origin = video_mem_start = (unsigned long)vc_scrbuf[currcons]; + scr_end = video_mem_end = video_mem_start + video_screen_size; + pos = origin + y*video_size_row + (x<<1); +} + +void +set_scrmem(int currcons, long offset) +{ + if (video_mem_term - video_mem_base < offset + video_screen_size) + offset = 0; /* strange ... */ + memcpyw((unsigned short *)(video_mem_base + offset), + (unsigned short *) origin, video_screen_size); + video_mem_start = video_mem_base; + video_mem_end = video_mem_term; + origin = video_mem_base + offset; + scr_end = origin + video_screen_size; + pos = origin + y*video_size_row + (x<<1); +} + +/* + * PIO_FONT support. + * + * for now, we will use/allow *only* our built-in font... + */ +int +set_get_font(char * arg, int set, int ch512) +{ + return -EINVAL; +} + +/* + * Adjust the screen to fit a font of a certain height + * + * Returns < 0 for error, 0 if nothing changed, and the number + * of lines on the adjusted console if changed. + * + * for now, we only support the built-in font... + */ +int +con_adjust_height(unsigned long fontheight) +{ + return -EINVAL; +} + +/* NOTE: + * this is here, and not in console.c, because the VGA version + * tests the controller type to see if color can be done. We *KNOW* + * that we can do color on the TGA... :-) + * + * FIXME? maybe the init codes for VGA and TGA could set + * a flag for (in)ability to do colormap set/get??? + */ + +int +set_get_cmap(unsigned char * arg, int set) { + int i; + + i = verify_area(set ? VERIFY_READ : VERIFY_WRITE, (void *)arg, 16*3); + if (i) + return i; + + for (i=0; i<16; i++) { + if (set) { + default_red[i] = get_user(arg++) ; + default_grn[i] = get_user(arg++) ; + default_blu[i] = get_user(arg++) ; + } else { + put_user (default_red[i], arg++) ; + put_user (default_grn[i], arg++) ; + put_user (default_blu[i], arg++) ; + } + } + if (set) { + for (i=0; ivc_palette[k++] = default_red[j]; + vc_cons[i].d->vc_palette[k++] = default_grn[j]; + vc_cons[i].d->vc_palette[k++] = default_blu[j]; + } + } + set_palette() ; + } + + return 0; +} + +/* + * dummy routines for the VESA blanking code, which is VGA only, + * so we don't have to carry that stuff around for the TGA... + */ +void vesa_blank(void) +{ +} +void vesa_unblank(void) +{ +} +void set_vesa_blanking(const unsigned long arg) +{ +} + +/* + * video init code, called from withing the PCI bus probing code; + * when TGA console is configured, at the end of the probing code, + * we call here to look for a TGA device, and proceed... + */ +void +tga_console_init(void) +{ + unsigned char pci_bus, pci_devfn; + int status; + + /* + * first, find the TGA among the PCI devices... + */ + status = pcibios_find_device (PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TGA, + 0, &pci_bus, &pci_devfn); + if (status == PCIBIOS_DEVICE_NOT_FOUND) { + /* PANIC!!! */ + printk("tga_console_init: TGA not found!!! :-(\n"); + return; + } + + /* + * read BASE_REG_0 for memory address + */ + pcibios_read_config_dword(pci_bus, pci_devfn, + PCI_BASE_ADDRESS_0, &tga_mem_base); + tga_mem_base &= ~15; +#ifdef DEBUG + printk("tga_console_init: mem_base 0x%x\n", tga_mem_base); +#endif /* DEBUG */ + + tga_type = (readl((unsigned long)tga_mem_base) >> 12) & 0x0f; + if (tga_type != 0 && tga_type != 1 && tga_type != 3) { + printk("TGA type (0x%x) unrecognized!\n", tga_type); + return; + } + tga_init_video(); + tga_clear_screen(); + + /* + * FINALLY, we can register TGA as console (whew!) + */ + register_console(console_print); +} + +unsigned char PLLbits[7] = { 0x80, 0x04, 0x00, 0x24, 0x44, 0x80, 0xb8 }; + +const unsigned long bt485_cursor_source[64] = { + 0x00000000000000ff,0x00000000000000ff,0x00000000000000ff,0x00000000000000ff, + 0x00000000000000ff,0x00000000000000ff,0x00000000000000ff,0x00000000000000ff, + 0x00000000000000ff,0x00000000000000ff,0x00000000000000ff,0x00000000000000ff, + 0x00000000000000ff,0x00000000000000ff,0x00000000000000ff,0x00000000000000ff, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +const unsigned int bt463_cursor_source[256] = { + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +}; + +void +tga_init_video() +{ + int i, j, temp; + unsigned char *cbp; + + tga_regs_base = ((unsigned long)tga_mem_base + TGA_REGS_OFFSET); + tga_fb_base = + ((unsigned long)tga_mem_base + fb_offset_presets[tga_type]); + + /* first, disable video timing */ + TGA_WRITE_REG(0x03, TGA_VALID_REG); /* SCANNING and BLANK */ + + /* write the DEEP register */ + while (TGA_READ_REG(TGA_CMD_STAT_REG) & 1) /* wait for not busy */ + continue; + + mb(); + TGA_WRITE_REG(deep_presets[tga_type], TGA_DEEP_REG); + while (TGA_READ_REG(TGA_CMD_STAT_REG) & 1) /* wait for not busy */ + continue; + mb(); + + /* write some more registers */ + TGA_WRITE_REG(rasterop_presets[tga_type], TGA_RASTEROP_REG); + TGA_WRITE_REG(mode_presets[tga_type], TGA_MODE_REG); + TGA_WRITE_REG(base_addr_presets[tga_type], TGA_BASE_ADDR_REG); + + /* write the PLL for 640x480 @ 60Hz */ + for (i = 0; i <= 6; i++) { + for (j = 0; j <= 7; j++) { + temp = (PLLbits[i] >> (7-j)) & 1; + if (i == 6 && j == 7) + temp |= 2; + TGA_WRITE_REG(temp, TGA_CLOCK_REG); + } + } + + /* write some more registers */ + TGA_WRITE_REG(0xffffffff, TGA_PLANEMASK_REG); + TGA_WRITE_REG(0xffffffff, TGA_PIXELMASK_REG); + TGA_WRITE_REG(0x12345678, TGA_BLOCK_COLOR0_REG); + TGA_WRITE_REG(0x12345678, TGA_BLOCK_COLOR1_REG); + + /* init video timeing regs for 640x480 @ 60 Hz */ + TGA_WRITE_REG(0x018608a0, TGA_HORIZ_REG); + TGA_WRITE_REG(0x084251e0, TGA_VERT_REG); + + if (tga_type == 0) { /* 8-plane */ + + tga_bpp = 1; + + /* init BT485 RAMDAC registers */ + BT485_WRITE(0xa2, BT485_CMD_0); + BT485_WRITE(0x01, BT485_ADDR_PAL_WRITE); + BT485_WRITE(0x14, BT485_CMD_3); /* cursor 64x64 */ + BT485_WRITE(0x40, BT485_CMD_1); + BT485_WRITE(0x22, BT485_CMD_2); /* WIN cursor type */ + BT485_WRITE(0xff, BT485_PIXEL_MASK); + + /* fill palette registers */ + BT485_WRITE(0x00, BT485_ADDR_PAL_WRITE); + TGA_WRITE_REG(BT485_DATA_PAL, TGA_RAMDAC_SETUP_REG); + + for (i = 0; i < 16; i++) { + j = color_table[i]; + TGA_WRITE_REG(default_red[j]|(BT485_DATA_PAL<<8), + TGA_RAMDAC_REG); + TGA_WRITE_REG(default_grn[j]|(BT485_DATA_PAL<<8), + TGA_RAMDAC_REG); + TGA_WRITE_REG(default_blu[j]|(BT485_DATA_PAL<<8), + TGA_RAMDAC_REG); + } + for (i = 0; i < 240*3; i += 4) { + TGA_WRITE_REG(0x55|(BT485_DATA_PAL<<8), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT485_DATA_PAL<<8), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT485_DATA_PAL<<8), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT485_DATA_PAL<<8), TGA_RAMDAC_REG); + } + + /* initialize RAMDAC cursor colors */ + BT485_WRITE(0, BT485_ADDR_CUR_WRITE); + + BT485_WRITE(0xaa, BT485_DATA_CUR); /* overscan WHITE */ + BT485_WRITE(0xaa, BT485_DATA_CUR); /* overscan WHITE */ + BT485_WRITE(0xaa, BT485_DATA_CUR); /* overscan WHITE */ + + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 1 BLACK */ + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 1 BLACK */ + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 1 BLACK */ + + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 2 BLACK */ + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 2 BLACK */ + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 2 BLACK */ + + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 3 BLACK */ + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 3 BLACK */ + BT485_WRITE(0x00, BT485_DATA_CUR); /* color 3 BLACK */ + + /* initialize RAMDAC cursor RAM */ + BT485_WRITE(0x00, BT485_ADDR_PAL_WRITE); + cbp = (unsigned char *)bt485_cursor_source; + for (i = 0; i < 512; i++) { + BT485_WRITE(*cbp++, BT485_CUR_RAM); + } + for (i = 0; i < 512; i++) { + BT485_WRITE(0xff, BT485_CUR_RAM); + } + + } else { /* 24-plane or 24plusZ */ + + tga_bpp = 4; + + TGA_WRITE_REG(0x01, TGA_VALID_REG); /* SCANNING */ + + /* + * init some registers + */ + BT463_WRITE(BT463_REG_ACC, BT463_CMD_REG_0, 0x40); + BT463_WRITE(BT463_REG_ACC, BT463_CMD_REG_1, 0x08); + BT463_WRITE(BT463_REG_ACC, BT463_CMD_REG_2, 0x40); + + BT463_WRITE(BT463_REG_ACC, BT463_READ_MASK_0, 0xff); + BT463_WRITE(BT463_REG_ACC, BT463_READ_MASK_1, 0xff); + BT463_WRITE(BT463_REG_ACC, BT463_READ_MASK_2, 0xff); + BT463_WRITE(BT463_REG_ACC, BT463_READ_MASK_3, 0x0f); + + BT463_WRITE(BT463_REG_ACC, BT463_BLINK_MASK_0, 0x00); + BT463_WRITE(BT463_REG_ACC, BT463_BLINK_MASK_1, 0x00); + BT463_WRITE(BT463_REG_ACC, BT463_BLINK_MASK_2, 0x00); + BT463_WRITE(BT463_REG_ACC, BT463_BLINK_MASK_3, 0x00); + + /* + * fill the palette + */ + BT463_LOAD_ADDR(0x0000); + TGA_WRITE_REG((BT463_PALETTE<<2), TGA_RAMDAC_REG); + + for (i = 0; i < 16; i++) { + j = color_table[i]; + TGA_WRITE_REG(default_red[j]|(BT463_PALETTE<<10), + TGA_RAMDAC_REG); + TGA_WRITE_REG(default_grn[j]|(BT463_PALETTE<<10), + TGA_RAMDAC_REG); + TGA_WRITE_REG(default_blu[j]|(BT463_PALETTE<<10), + TGA_RAMDAC_REG); + } + for (i = 0; i < 512*3; i += 4) { + TGA_WRITE_REG(0x55|(BT463_PALETTE<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT463_PALETTE<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT463_PALETTE<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT463_PALETTE<<10), TGA_RAMDAC_REG); + } + + /* + * fill window type table after start of vertical retrace + */ + while (!(TGA_READ_REG(TGA_INTR_STAT_REG) & 0x01)) + continue; + TGA_WRITE_REG(0x01, TGA_INTR_STAT_REG); + mb(); + while (!(TGA_READ_REG(TGA_INTR_STAT_REG) & 0x01)) + continue; + TGA_WRITE_REG(0x01, TGA_INTR_STAT_REG); + + BT463_LOAD_ADDR(BT463_WINDOW_TYPE_BASE); + TGA_WRITE_REG((BT463_REG_ACC<<2), TGA_RAMDAC_SETUP_REG); + + for (i = 0; i < 16; i++) { + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x01|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x80|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + } + + /* + * init cursor colors + */ + BT463_LOAD_ADDR(BT463_CUR_CLR_0); + + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); /* background */ + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); /* background */ + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); /* background */ + + TGA_WRITE_REG(0xff|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); /* foreground */ + TGA_WRITE_REG(0xff|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); /* foreground */ + TGA_WRITE_REG(0xff|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); /* foreground */ + + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + TGA_WRITE_REG(0x00|(BT463_REG_ACC<<10), TGA_RAMDAC_REG); + + /* + * finally, init the cursor shape + */ + temp = tga_fb_base - 1024; /* this assumes video starts at base + and base is beyond memory start*/ + + for (i = 0; i < 256; i++) { + writel(bt463_cursor_source[i], temp + i*4); + } + TGA_WRITE_REG(temp & 0x000fffff, TGA_CURSOR_BASE_REG); + } + + /* finally, enable video scan & cursor + (and pray for the monitor... :-) */ + TGA_WRITE_REG(0x05, TGA_VALID_REG); /* SCANNING and CURSOR */ + + /* oh, and set the globals describing the resolution... :-) */ + tga_fb_width = 640 * tga_bpp; + tga_fb_height = 480; + tga_fb_stride = tga_fb_width / sizeof(int); +} + +void +tga_clear_screen() +{ + register int i, j; + register unsigned int *dst; + + dst = (unsigned int *) ((unsigned long)tga_fb_base); + for (i = 0; i < tga_fb_height; i++, dst += tga_fb_stride) { + for (j = 0; j < tga_fb_stride; j++) { + writel(0, (dst+j)); + } + } + + /* also clear out the "shadow" screen memory */ + memset((char *)video_mem_base, 0, (video_mem_term - video_mem_base)); +} + +/* + * tga_blitc + * + * Displays an ASCII character at a specified character cell + * position. + * + * Called from scr_writew() when the destination is + * the "shadow" screen + */ +static unsigned int +fontmask_bits[16] = { + 0x00000000, + 0xff000000, + 0x00ff0000, + 0xffff0000, + 0x0000ff00, + 0xff00ff00, + 0x00ffff00, + 0xffffff00, + 0x000000ff, + 0xff0000ff, + 0x00ff00ff, + 0xffff00ff, + 0x0000ffff, + 0xff00ffff, + 0x00ffffff, + 0xffffffff +}; + +int +tga_blitc(unsigned int charattr, unsigned long addr) +{ + int row, col, temp, c, attrib; + register unsigned int fgmask, bgmask, data, rowbits; + register unsigned int *dst; + register unsigned char *font_row; + register int i, j, stride; + + c = charattr & 0x00ff; + attrib = (charattr >> 8) & 0x00ff; + + /* + * extract foreground and background indices + * NOTE: we always treat blink/underline bits as color for now... + */ + fgmask = attrib & 0x0f; + bgmask = (attrib >> 4) & 0x0f; + + i = (c & 0xff) << 4; /* NOTE: assumption of 16 bytes per character bitmap */ + + /* + * calculate (row,col) from addr and video_mem_base + */ + temp = (addr - video_mem_base) >> 1; + col = temp % 80; + row = (temp - col) / 80; + + /* + * calculate destination address + */ + dst = (unsigned int *) ( (unsigned long)tga_fb_base + + ( row * tga_fb_width * TGA_F_HEIGHT_PADDED ) + + ( col * TGA_F_WIDTH * tga_bpp) ); + + font_row = (unsigned char *)&tga_builtin_font[i]; + stride = tga_fb_stride; + + if (tga_type == 0) { /* 8-plane */ + + fgmask = fgmask << 8 | fgmask; + fgmask |= fgmask << 16; + bgmask = bgmask << 8 | bgmask; + bgmask |= bgmask << 16; + + for ( j = 0; j < TGA_F_HEIGHT_PADDED; j++ ) { + if (j < TGA_F_HEIGHT) { + rowbits = *font_row++; + data = fontmask_bits[(rowbits>>4)&0xf]; + data = (data & fgmask) | (~data & bgmask); + writel(data, dst); + data = fontmask_bits[rowbits&0xf]; + data = (data & fgmask) | (~data & bgmask); + writel(data, (dst+1)); + } else { + writel(bgmask, dst); + writel(bgmask, (dst+1)); + } + dst += stride; + } + } else { /* 24-plane */ + + fgmask = (default_red[fgmask] << 16) | + (default_grn[fgmask] << 8) | + (default_blu[fgmask] << 0); + bgmask = (default_red[bgmask] << 16) | + (default_grn[bgmask] << 8) | + (default_blu[bgmask] << 0); + + for ( i = 0; i < TGA_F_HEIGHT_PADDED; i++ ) { + if (i < TGA_F_HEIGHT) { + rowbits = *font_row++; + data = 1 << (TGA_F_WIDTH - 1); + for (j = 0; j < TGA_F_WIDTH; j++, data >>= 1) { + if (rowbits & data) + writel(fgmask, (dst+j)); + else + writel(bgmask, (dst+j)); + } + } else { + for (j = 0; j < TGA_F_WIDTH; j++) { + writel(bgmask, (dst+j)); + } + } + dst += stride; + } + } + return (0); +} + +/* + * font table of displayable characters. + */ +char tga_builtin_font[]={ +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, +0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff, +0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, +0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00, +0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, +0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xe6, 0x66, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc3, 0xe7, 0xff, 0xff, 0xdb, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00, +0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xff, 0xdb, 0x99, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x66, 0xc3, 0xc3, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xff, 0xc3, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc1, 0xc3, 0xff, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, +0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00, +0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00, +0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0xff, 0xdb, 0xdb, 0xdb, 0xdb, 0xdb, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x66, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xc3, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0xc3, 0xc3, 0xdb, 0xdb, 0xff, 0x66, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0xc3, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00, +0x00, 0x00, 0xcc, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xcc, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00, +0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x66, 0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0xc6, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, +0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, +0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x6e, 0x3b, 0x1b, 0x7e, 0xd8, 0xdc, 0x77, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00, +0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc6, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc6, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00, +0x00, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x18, 0x18, 0x7e, 0xc3, 0xc0, 0xc0, 0xc0, 0xc3, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xc3, 0x66, 0x3c, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0xfc, 0x66, 0x66, 0x7c, 0x62, 0x66, 0x6f, 0x66, 0x66, 0x66, 0xf3, 0x00, 0x00, 0x00, 0x00, +0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00, +0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, +0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x9b, 0x06, 0x0c, 0x1f, 0x00, 0x00, +0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x96, 0x3e, 0x06, 0x06, 0x00, 0x00, +0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x6c, 0xd8, 0x6c, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0x6c, 0x36, 0x6c, 0xd8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, +0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, +0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, +0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, +0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, +0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, +0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0xd8, 0xcc, 0xc6, 0xc6, 0xc6, 0xcc, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xdb, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, +0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, +0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x70, 0xd8, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; diff -u --recursive --new-file v1.3.37/linux/drivers/char/vga.c linux/drivers/char/vga.c --- v1.3.37/linux/drivers/char/vga.c Thu Jan 1 02:00:00 1970 +++ linux/drivers/char/vga.c Tue Nov 7 13:48:23 1995 @@ -0,0 +1,571 @@ +/* + * linux/drivers/char/vga.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + * 1995 Jay Estabrook + */ + +/* + * vga.c + * + * This module exports the console low-level io support for VGA + * + * 'int con_get_font(char *data)' + * 'int con_set_font(char *data, int ch512)' + * 'int con_adjust_height(int fontheight)' + * + * 'int con_get_cmap(char *)' + * 'int con_set_cmap(char *)' + * + * 'int reset_palette(int currcons)' + * 'void set_palette(void)' + * + * User definable mapping table and font loading by Eugene G. Crosser, + * + * + * Improved loadable font/UTF-8 support by H. Peter Anvin + * Feb-Sep 1995 + * + * improved scrollback, plus colour palette handling, by Simon Tatham + * 17-Jun-95 + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "kbd_kern.h" +#include "vt_kern.h" +#include "consolemap.h" +#include "selection.h" +#include "console_struct.h" + +#define CAN_LOAD_EGA_FONTS /* undefine if the user must not do this */ +#define CAN_LOAD_PALETTE /* undefine if the user must not do this */ + +#define dac_reg (0x3c8) +#define dac_val (0x3c9) + + +void +set_palette (void) +{ + int i, j ; + + if (video_type != VIDEO_TYPE_VGAC || console_blanked || + vt_cons[fg_console]->vc_mode == KD_GRAPHICS) + return ; + + for (i=j=0; i<16; i++) { + outb_p (color_table[i], dac_reg) ; + outb_p (vc_cons[fg_console].d->vc_palette[j++]>>2, dac_val) ; + outb_p (vc_cons[fg_console].d->vc_palette[j++]>>2, dac_val) ; + outb_p (vc_cons[fg_console].d->vc_palette[j++]>>2, dac_val) ; + } +} + +void +__set_origin(unsigned short offset) +{ + unsigned long flags; + + clear_selection(); + + save_flags(flags); cli(); + __origin = offset; + outb_p(12, video_port_reg); + outb_p(offset >> 8, video_port_val); + outb_p(13, video_port_reg); + outb_p(offset, video_port_val); + restore_flags(flags); +} + +/* + * Put the cursor just beyond the end of the display adaptor memory. + */ +void +hide_cursor(void) +{ + /* This is inefficient, we could just put the cursor at 0xffff, + but perhaps the delays due to the inefficiency are useful for + some hardware... */ + outb_p(14, video_port_reg); + outb_p(0xff&((video_mem_term-video_mem_base)>>9), video_port_val); + outb_p(15, video_port_reg); + outb_p(0xff&((video_mem_term-video_mem_base)>>1), video_port_val); +} + +void +set_cursor(int currcons) +{ + unsigned long flags; + + if (currcons != fg_console || console_blanked || vcmode == KD_GRAPHICS) + return; + if (__real_origin != __origin) + __set_origin(__real_origin); + save_flags(flags); cli(); + if (deccm) { + outb_p(14, video_port_reg); + outb_p(0xff&((pos-video_mem_base)>>9), video_port_val); + outb_p(15, video_port_reg); + outb_p(0xff&((pos-video_mem_base)>>1), video_port_val); + } else + hide_cursor(); + restore_flags(flags); +} + +unsigned long +con_type_init(unsigned long kmem_start, char *display_desc) +{ + if (ORIG_VIDEO_MODE == 7) /* Is this a monochrome display? */ + { + video_mem_base = 0xb0000; + video_port_reg = 0x3b4; + video_port_val = 0x3b5; + if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) + { + video_type = VIDEO_TYPE_EGAM; + video_mem_term = 0xb8000; + display_desc = "EGA+"; + request_region(0x3b0,16,"ega"); + } + else + { + video_type = VIDEO_TYPE_MDA; + video_mem_term = 0xb2000; + display_desc = "*MDA"; + request_region(0x3b0,12,"mda"); + request_region(0x3bf, 1,"mda"); + } + } + else /* If not, it is color. */ + { + can_do_color = 1; + video_mem_base = 0xb8000; + video_port_reg = 0x3d4; + video_port_val = 0x3d5; + if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) + { + int i ; + + video_mem_term = 0xc0000; + + if (!ORIG_VIDEO_ISVGA) { + video_type = VIDEO_TYPE_EGAC; + display_desc = "EGA"; + request_region(0x3c0,32,"ega"); + } else { + video_type = VIDEO_TYPE_VGAC; + display_desc = "VGA+"; + request_region(0x3c0,32,"vga+"); + +#ifdef VGA_CAN_DO_64KB + /* + * get 64K rather than 32K of video RAM. + * This doesn't actually work on all "VGA" + * controllers (it seems like setting MM=01 + * and COE=1 isn't necessarily a good idea) + */ + video_mem_base = 0xa0000 ; + video_mem_term = 0xb0000 ; + outb_p (6, 0x3ce) ; + outb_p (6, 0x3cf) ; +#endif + + /* normalise the palette registers, to point the + * 16 screen colours to the first 16 DAC entries */ + + for (i=0; i<16; i++) { + inb_p (0x3da) ; + outb_p (i, 0x3c0) ; + outb_p (i, 0x3c0) ; + } + outb_p (0x20, 0x3c0) ; + + /* now set the DAC registers back to their default + * values */ + + for (i=0; i<16; i++) { + outb_p (color_table[i], 0x3c8) ; + outb_p (default_red[i], 0x3c9) ; + outb_p (default_grn[i], 0x3c9) ; + outb_p (default_blu[i], 0x3c9) ; + } + } + } + else + { + video_type = VIDEO_TYPE_CGA; + video_mem_term = 0xba000; + display_desc = "*CGA"; + request_region(0x3d4,2,"cga"); + } + } + return kmem_start; +} + +void +get_scrmem(int currcons) +{ + memcpyw((unsigned short *)vc_scrbuf[currcons], + (unsigned short *)origin, video_screen_size); + __scrollback_mode = 0 ; + origin = video_mem_start = (unsigned long)vc_scrbuf[currcons]; + scr_end = video_mem_end = video_mem_start + video_screen_size; + pos = origin + y*video_size_row + (x<<1); +} + +void +set_scrmem(int currcons, long offset) +{ +#ifdef CONFIG_HGA + /* This works with XFree86 1.2, 1.3 and 2.0 + This code could be extended and made more generally useful if we could + determine the actual video mode. It appears that this should be + possible on a genuine Hercules card, but I (WM) haven't been able to + read from any of the required registers on my clone card. + */ + /* This code should work with Hercules and MDA cards. */ + if (video_type == VIDEO_TYPE_MDA) + { + if (vcmode == KD_TEXT) + { + /* Ensure that the card is in text mode. */ + int i; + static char herc_txt_tbl[12] = { + 0x61,0x50,0x52,0x0f,0x19,6,0x19,0x19,2,0x0d,0x0b,0x0c }; + outb_p(0, 0x3bf); /* Back to power-on defaults */ + outb_p(0, 0x3b8); /* Blank the screen, select page 0, etc */ + for ( i = 0 ; i < 12 ; i++ ) + { + outb_p(i, 0x3b4); + outb_p(herc_txt_tbl[i], 0x3b5); + } + } +#define HGA_BLINKER_ON 0x20 +#define HGA_SCREEN_ON 8 + /* Make sure that the hardware is not blanked */ + outb_p(HGA_BLINKER_ON | HGA_SCREEN_ON, 0x3b8); + } +#endif CONFIG_HGA + + if (video_mem_term - video_mem_base < offset + video_screen_size) + offset = 0; /* strange ... */ + memcpyw((unsigned short *)(video_mem_base + offset), + (unsigned short *) origin, video_screen_size); + video_mem_start = video_mem_base; + video_mem_end = video_mem_term; + origin = video_mem_base + offset; + scr_end = origin + video_screen_size; + pos = origin + y*video_size_row + (x<<1); +} + +/* + * PIO_FONT support. + * + * The font loading code goes back to the codepage package by + * Joel Hoffman (joel@wam.umd.edu). (He reports that the original + * reference is: "From: p. 307 of _Programmer's Guide to PC & PS/2 + * Video Systems_ by Richard Wilton. 1987. Microsoft Press".) + * + * Change for certain monochrome monitors by Yury Shevchuck + * (sizif@botik.yaroslavl.su). + */ + +#define colourmap ((char *)0xa0000) +/* Pauline Middelink reports that we + should use 0xA0000 for the bwmap as well.. */ +#define blackwmap ((char *)0xa0000) +#define cmapsz 8192 +#define attrib_port (0x3c0) +#define seq_port_reg (0x3c4) +#define seq_port_val (0x3c5) +#define gr_port_reg (0x3ce) +#define gr_port_val (0x3cf) + +int +set_get_font(char * arg, int set, int ch512) +{ +#ifdef CAN_LOAD_EGA_FONTS + int i; + char *charmap; + int beg; + unsigned short video_port_status = video_port_reg + 6; + int font_select = 0x00; + + /* no use to "load" CGA... */ + + if (video_type == VIDEO_TYPE_EGAC || video_type == VIDEO_TYPE_VGAC) { + charmap = colourmap; + beg = 0x0e; +#ifdef VGA_CAN_DO_64KB + if (video_type == VIDEO_TYPE_VGAC) + beg = 0x06; +#endif + } else if (video_type == VIDEO_TYPE_EGAM) { + charmap = blackwmap; + beg = 0x0a; + } else + return -EINVAL; + + if (arg) + { + i = verify_area(set ? VERIFY_READ : VERIFY_WRITE, (void *)arg, + ch512 ? 2*cmapsz : cmapsz); + if (i) + return i; + } + else + ch512 = 0; /* Default font is always 256 */ + +#ifdef BROKEN_GRAPHICS_PROGRAMS + /* + * All fonts are loaded in slot 0 (0:1 for 512 ch) + */ + + if (!arg) + return -EINVAL; /* Return to default font not supported */ + + video_font_is_default = 0; + font_select = ch512 ? 0x04 : 0x00; +#else + /* + * The default font is kept in slot 0 and is never touched. + * A custom font is loaded in slot 2 (256 ch) or 2:3 (512 ch) + */ + + if (set) + { + video_font_is_default = !arg; + font_select = arg ? (ch512 ? 0x0e : 0x0a) : 0x00; + } + + if ( !video_font_is_default ) + charmap += 4*cmapsz; +#endif + + cli(); + outb_p( 0x00, seq_port_reg ); /* First, the sequencer */ + outb_p( 0x01, seq_port_val ); /* Synchronous reset */ + outb_p( 0x02, seq_port_reg ); + outb_p( 0x04, seq_port_val ); /* CPU writes only to map 2 */ + outb_p( 0x04, seq_port_reg ); + outb_p( 0x07, seq_port_val ); /* Sequential addressing */ + outb_p( 0x00, seq_port_reg ); + outb_p( 0x03, seq_port_val ); /* Clear synchronous reset */ + + outb_p( 0x04, gr_port_reg ); /* Now, the graphics controller */ + outb_p( 0x02, gr_port_val ); /* select map 2 */ + outb_p( 0x05, gr_port_reg ); + outb_p( 0x00, gr_port_val ); /* disable odd-even addressing */ + outb_p( 0x06, gr_port_reg ); + outb_p( 0x00, gr_port_val ); /* map start at A000:0000 */ + sti(); + + if (arg) + { + if (set) + for (i=0; i 32 || (video_type != VIDEO_TYPE_VGAC && + video_type != VIDEO_TYPE_EGAC && video_type != VIDEO_TYPE_EGAM)) + return -EINVAL; + + if ( fontheight == video_font_height || fontheight == 0 ) + return 0; + + video_font_height = fontheight; + + rows = video_scan_lines/fontheight; /* Number of video rows we end up with */ + maxscan = rows*fontheight - 1; /* Scan lines to actually display-1 */ + + /* Reprogram the CRTC for the new font size + Note: the attempt to read the overflow register will fail + on an EGA, but using 0xff for the previous value appears to + be OK for EGA text modes in the range 257-512 scan lines, so I + guess we don't need to worry about it. + + The same applies for the spill bits in the font size and cursor + registers; they are write-only on EGA, but it appears that they + are all don't care bits on EGA, so I guess it doesn't matter. */ + + cli(); + outb_p( 0x07, video_port_reg ); /* CRTC overflow register */ + ovr = inb_p(video_port_val); + outb_p( 0x09, video_port_reg ); /* Font size register */ + fsr = inb_p(video_port_val); + outb_p( 0x0a, video_port_reg ); /* Cursor start */ + curs = inb_p(video_port_val); + outb_p( 0x0b, video_port_reg ); /* Cursor end */ + cure = inb_p(video_port_val); + sti(); + + vde = maxscan & 0xff; /* Vertical display end reg */ + ovr = (ovr & 0xbd) + /* Overflow register */ + ((maxscan & 0x100) >> 7) + + ((maxscan & 0x200) >> 3); + fsr = (fsr & 0xe0) + (fontheight-1); /* Font size register */ + curs = (curs & 0xc0) + fontheight - (fontheight < 10 ? 2 : 3); + cure = (cure & 0xe0) + fontheight - (fontheight < 10 ? 1 : 2); + + cli(); + outb_p( 0x07, video_port_reg ); /* CRTC overflow register */ + outb_p( ovr, video_port_val ); + outb_p( 0x09, video_port_reg ); /* Font size */ + outb_p( fsr, video_port_val ); + outb_p( 0x0a, video_port_reg ); /* Cursor start */ + outb_p( curs, video_port_val ); + outb_p( 0x0b, video_port_reg ); /* Cursor end */ + outb_p( cure, video_port_val ); + outb_p( 0x12, video_port_reg ); /* Vertical display limit */ + outb_p( vde, video_port_val ); + sti(); + + if ( rows == video_num_lines ) { + /* Change didn't affect number of lines -- no need to scare + the rest of the world */ + return 0; + } + + vc_resize(rows, 0); /* Adjust console size */ + + return rows; +} + +int +set_get_cmap(unsigned char * arg, int set) { +#ifdef CAN_LOAD_PALETTE + int i; + + /* no use to set colourmaps in less than colour VGA */ + + if (video_type != VIDEO_TYPE_VGAC) + return -EINVAL; + + i = verify_area(set ? VERIFY_READ : VERIFY_WRITE, (void *)arg, 16*3); + if (i) + return i; + + for (i=0; i<16; i++) { + if (set) { + default_red[i] = get_user(arg++) ; + default_grn[i] = get_user(arg++) ; + default_blu[i] = get_user(arg++) ; + } else { + put_user (default_red[i], arg++) ; + put_user (default_grn[i], arg++) ; + put_user (default_blu[i], arg++) ; + } + } + if (set) { + for (i=0; ivc_palette[k++] = default_red[j]; + vc_cons[i].d->vc_palette[k++] = default_grn[j]; + vc_cons[i].d->vc_palette[k++] = default_blu[j]; + } + } + set_palette() ; + } + + return 0; +#else + return -EINVAL; +#endif +} diff -u --recursive --new-file v1.3.37/linux/drivers/net/3c507.c linux/drivers/net/3c507.c --- v1.3.37/linux/drivers/net/3c507.c Tue Oct 10 18:46:35 1995 +++ linux/drivers/net/3c507.c Mon Oct 30 10:24:05 1995 @@ -27,12 +27,7 @@ "3c507.c:v1.10 9/23/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; -#ifdef MODULE #include -#include -#endif - -#include /* Sources: @@ -884,7 +879,6 @@ lp->rx_tail = rx_tail; } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device dev_3c507 = { devicename, /* device name is inserted by linux/drivers/net/net_init.c */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/at1700.c linux/drivers/net/at1700.c --- v1.3.37/linux/drivers/net/at1700.c Tue Oct 10 18:46:35 1995 +++ linux/drivers/net/at1700.c Mon Oct 30 10:24:33 1995 @@ -31,12 +31,7 @@ static const char *version = "at1700.c:v1.12 1/18/95 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; -#ifdef MODULE #include -#include -#endif - -#include #include #include @@ -638,7 +633,6 @@ outb(2, ioaddr + RX_MODE); /* Disable promiscuous, use normal mode */ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device dev_at1700 = { devicename, /* device name is inserted by linux/drivers/net/net_init.c */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/bsd_comp.c linux/drivers/net/bsd_comp.c --- v1.3.37/linux/drivers/net/bsd_comp.c Tue Oct 10 18:46:35 1995 +++ linux/drivers/net/bsd_comp.c Tue Nov 7 18:32:38 1995 @@ -57,7 +57,6 @@ #endif #include -#include #include #include @@ -1185,8 +1184,6 @@ /************************************************************* * Module support routines *************************************************************/ - -char kernel_version[] = UTS_RELEASE; int init_module(void) diff -u --recursive --new-file v1.3.37/linux/drivers/net/de4x5.c linux/drivers/net/de4x5.c --- v1.3.37/linux/drivers/net/de4x5.c Sat Sep 9 15:26:52 1995 +++ linux/drivers/net/de4x5.c Tue Nov 7 09:18:35 1995 @@ -143,14 +143,7 @@ static const char *version = "de4x5.c:v0.32 6/26/95 davies@wanton.lkg.dec.com\n"; -#include -#ifdef MODULE #include -#include -#else -#define MOD_INC_USE_COUNT -#define MOD_DEC_USE_COUNT -#endif /* MODULE */ #include #include @@ -1837,13 +1830,23 @@ dce_ms_delay(500); linkBad = ping_media(dev); if (linkBad && (lp->autosense == AUTO)) { + lp->media = EXT_SIA; + dc21040_autoconf(dev); + } + break; + + case EXT_SIA: + reset_init_sia(dev, 0x3041, 0x0000, 0x0006); + dce_ms_delay(500); + linkBad = ping_media(dev); + if (linkBad && (lp->autosense == AUTO)) { lp->media = NC; dc21040_autoconf(dev); } break; case NC: -#ifdef i386 +#ifndef __alpha__ reset_init_sia(dev, 0x8f01, 0xffff, 0x0000); break; #else @@ -2736,7 +2739,6 @@ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device thisDE4X5 = { devicename, /* device name is inserted by linux/drivers/net/net_init.c */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/de4x5.h linux/drivers/net/de4x5.h --- v1.3.37/linux/drivers/net/de4x5.h Thu Jun 29 19:02:41 1995 +++ linux/drivers/net/de4x5.h Tue Nov 7 09:18:35 1995 @@ -563,6 +563,7 @@ #define AUI 0x0008 /* Thickwire */ #define BNC_AUI 0x0010 /* BNC/AUI on DC21040 indistinguishable */ #define ANS 0x0020 /* Intermediate AutoNegotiation State */ +#define EXT_SIA 0x0400 /* external SIA (as on DEC MULTIA) */ #define _10Mb 0x0040 /* 10Mb/s Ethernet */ #define _100Mb 0x0080 /* 100Mb/s Ethernet */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/depca.c linux/drivers/net/depca.c --- v1.3.37/linux/drivers/net/depca.c Sat Sep 9 15:26:52 1995 +++ linux/drivers/net/depca.c Mon Oct 30 10:27:10 1995 @@ -188,14 +188,7 @@ static const char *version = "depca.c:v0.41 5/26/95 davies@wanton.lkg.dec.com\n"; -#include -#ifdef MODULE #include -#include -#else -#define MOD_INC_USE_COUNT -#define MOD_DEC_USE_COUNT -#endif /* MODULE */ #include #include @@ -1818,7 +1811,6 @@ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device thisDepca = { devicename, /* device name is inserted by linux/drivers/net/net_init.c */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/dummy.c linux/drivers/net/dummy.c --- v1.3.37/linux/drivers/net/dummy.c Wed Sep 13 12:45:30 1995 +++ linux/drivers/net/dummy.c Tue Nov 7 18:33:47 1995 @@ -31,10 +31,7 @@ /* To have statistics (just packets sent) define this */ #undef DUMMY_STATS -#ifdef MODULE #include -#include -#endif #include #include @@ -73,7 +70,6 @@ MOD_DEC_USE_COUNT; return 0; } - #endif @@ -135,7 +131,6 @@ #endif #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static int dummy_probe(struct device *dev) { diff -u --recursive --new-file v1.3.37/linux/drivers/net/eepro.c linux/drivers/net/eepro.c --- v1.3.37/linux/drivers/net/eepro.c Tue Oct 10 18:46:35 1995 +++ linux/drivers/net/eepro.c Mon Oct 30 10:27:11 1995 @@ -54,14 +54,7 @@ static const char *version = "eepro.c: v0.07a 6/5/95 Bao C. Ha (bao@saigon.async.com)\n"; -/* Always include 'config.h' first in case the user wants to turn on - or override something. */ -#include - -#ifdef MODULE #include -#include -#endif /* Sources: @@ -1138,7 +1131,6 @@ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device dev_eepro = { devicename, /* device name is inserted by linux/drivers/net/net_init.c */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/eexpress.c linux/drivers/net/eexpress.c --- v1.3.37/linux/drivers/net/eexpress.c Tue Oct 10 18:46:35 1995 +++ linux/drivers/net/eexpress.c Mon Oct 30 10:27:11 1995 @@ -24,8 +24,6 @@ static const char *version = "eexpress.c:v0.07 1/19/94 Donald Becker (becker@super.org)\n"; -#include - /* Sources: This driver wouldn't have been written with the availability of the @@ -37,10 +35,7 @@ info that the casual reader might think that it documents the i82586. */ -#ifdef MODULE #include -#include -#endif #include #include @@ -1003,7 +998,6 @@ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device dev_eexpress = { devicename, /* device name is inserted by linux/drivers/net/net_init.c */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/eql.c linux/drivers/net/eql.c --- v1.3.37/linux/drivers/net/eql.c Mon Oct 23 18:02:06 1995 +++ linux/drivers/net/eql.c Mon Oct 30 10:27:11 1995 @@ -102,12 +102,8 @@ * */ -#ifdef MODULE #include -#include -#endif -#include #include #include #include @@ -1192,7 +1188,6 @@ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static struct device dev_eql = { "eql", 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, eql_init }; diff -u --recursive --new-file v1.3.37/linux/drivers/net/hp100.c linux/drivers/net/hp100.c --- v1.3.37/linux/drivers/net/hp100.c Tue Oct 10 18:46:36 1995 +++ linux/drivers/net/hp100.c Mon Oct 30 10:28:30 1995 @@ -82,10 +82,7 @@ * */ -#ifdef MODULE #include -#include -#endif /* MODULE */ #include #include @@ -104,6 +101,7 @@ #include #include +#include /* for CONFIG_PCI */ #include "hp100.h" @@ -1124,8 +1122,6 @@ */ #ifdef MODULE - -char kernel_version[] = UTS_RELEASE; static int hp100_port = -1; diff -u --recursive --new-file v1.3.37/linux/drivers/net/ibmtr.c linux/drivers/net/ibmtr.c --- v1.3.37/linux/drivers/net/ibmtr.c Sat Sep 9 15:26:52 1995 +++ linux/drivers/net/ibmtr.c Mon Nov 6 12:29:40 1995 @@ -75,7 +75,6 @@ 0x03, 0x05, 0x03, 0x01, 0x03, 0x08, 0x02, 0x00}; -#include #include #include #include @@ -106,13 +105,9 @@ { switch (type) { - case 'f': - case 'F' : return "Adapter/A"; - case 'e': - case 'E' : return "16/4 Adapter/II"; - default : - printk("Unknow adapter %c\n", type); - return "adapter"; + case 0xF : return "Adapter/A"; + case 0xE : return "16/4 Adapter/II"; + default : return "adapter"; }; }; #endif @@ -1017,7 +1012,9 @@ struct tok_info *ti; ti=(struct tok_info *) dev->priv; +#ifndef TR_NEWFORMAT DPRINTK("now opening the board...\n"); +#endif *(unsigned char *)(ti->mmio + ACA_OFFSET + ACA_RESET + ISRP_ODD)=~(SRB_RESP_INT); *(unsigned char *)(ti->mmio + ACA_OFFSET + ACA_RESET + ISRA_ODD)=~(CMD_IN_SRB); diff -u --recursive --new-file v1.3.37/linux/drivers/net/ne.c linux/drivers/net/ne.c --- v1.3.37/linux/drivers/net/ne.c Tue Oct 10 18:46:36 1995 +++ linux/drivers/net/ne.c Mon Oct 30 10:33:03 1995 @@ -48,13 +48,13 @@ /* Some defines that people can play with if so inclined. */ /* Do we support clones that don't adhere to 14,15 of the SAprom ? */ -#define CONFIG_NE_BAD_CLONES +#define SUPPORT_NE_BAD_CLONES /* Do we perform extra sanity checks on stuff ? */ -/* #define CONFIG_NE_SANITY */ +/* #define NE_SANITY_CHECK */ /* Do we implement the read before write bugfix ? */ -/* #define CONFIG_NE_RW_BUGFIX */ +/* #define NE_RW_BUGFIX */ /* ---- No user-serviceable parts below ---- */ @@ -62,7 +62,7 @@ static unsigned int netcard_portlist[] = { 0x300, 0x280, 0x320, 0x340, 0x360, 0}; -#ifdef CONFIG_NE_BAD_CLONES +#ifdef SUPPORT_NE_BAD_CLONES /* A list of bad clones that we none-the-less recognize. */ static struct { const char *name8, *name16; unsigned char SAprefix[4];} bad_clone_list[] = { @@ -255,7 +255,7 @@ start_page = 0x01; stop_page = (wordlength == 2) ? 0x40 : 0x20; } else { -#ifdef CONFIG_NE_BAD_CLONES +#ifdef SUPPORT_NE_BAD_CLONES /* Ack! Well, there might be a *bad* NE*000 clone there. Check for total bogus addresses. */ for (i = 0; bad_clone_list[i].name8; i++) { @@ -412,7 +412,7 @@ static void ne_block_input(struct device *dev, int count, struct sk_buff *skb, int ring_offset) { -#ifdef CONFIG_NE_SANITY +#ifdef NE_SANITY_CHECK int xfer_count = count; #endif int nic_base = dev->base_addr; @@ -437,7 +437,7 @@ insw(NE_BASE + NE_DATAPORT,buf,count>>1); if (count & 0x01) { buf[count-1] = inb(NE_BASE + NE_DATAPORT); -#ifdef CONFIG_NE_SANITY +#ifdef NE_SANITY_CHECK xfer_count++; #endif } @@ -445,7 +445,7 @@ insb(NE_BASE + NE_DATAPORT, buf, count); } -#ifdef CONFIG_NE_SANITY +#ifdef NE_SANITY_CHECK /* This was for the ALPHA version only, but enough people have been encountering problems so it is still here. If you see this message you either 1) have a slightly incompatible clone @@ -477,7 +477,7 @@ { int nic_base = NE_BASE; unsigned long dma_start; -#ifdef CONFIG_NE_SANITY +#ifdef NE_SANITY_CHECK int retries = 0; #endif @@ -499,7 +499,7 @@ /* We should already be in page 0, but to be safe... */ outb_p(E8390_PAGE0+E8390_START+E8390_NODMA, nic_base + NE_CMD); -#ifdef CONFIG_NE_SANITY +#ifdef NE_SANITY_CHECK retry: #endif @@ -536,7 +536,7 @@ dma_start = jiffies; -#ifdef CONFIG_NE_SANITY +#ifdef NE_SANITY_CHECK /* This was for the ALPHA version only, but enough people have been encountering problems so it is still here. */ if (ei_debug > 1) { /* DMA termination address check... */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/net_init.c linux/drivers/net/net_init.c --- v1.3.37/linux/drivers/net/net_init.c Sun Oct 29 11:38:49 1995 +++ linux/drivers/net/net_init.c Mon Nov 6 12:59:00 1995 @@ -18,6 +18,8 @@ Modifications by Wolfgang Walter Use dev_close cleanly so we always shut things down tidily. + + Changed 29/10/95, Alan Cox to pass sockaddr's around for mac addresses. */ #include @@ -130,13 +132,11 @@ } -static int eth_mac_addr(struct device *dev, void * addr) +static int eth_mac_addr(struct device *dev, struct sockaddr *addr) { - struct ifreq * ifr = (struct ifreq *) addr; - if(dev->start) return -EBUSY; - memcpy(dev->dev_addr, ifr->ifr_hwaddr.sa_data,dev->hard_header_len); + memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); return 0; } @@ -247,6 +247,7 @@ for (i = 0; i < MAX_ETH_CARDS; ++i) if (ethdev_index[i] == NULL) { sprintf(dev->name, "eth%d", i); + printk("loading device '%s'...\n", dev->name); ethdev_index[i] = dev; break; } diff -u --recursive --new-file v1.3.37/linux/drivers/net/pi2.c linux/drivers/net/pi2.c --- v1.3.37/linux/drivers/net/pi2.c Fri Oct 13 14:44:33 1995 +++ linux/drivers/net/pi2.c Mon Nov 6 12:59:00 1995 @@ -50,7 +50,9 @@ when changing the baud rate or clock mode. version 0.8 ALPHA July 17, 1995 (ac) Finally polishing of AX25.030+ support - + Oct 29, 1995 (ac) A couple of minor fixes before this, and this release changes + to the proper set_mac_address semantics which will break + a few programs I suspect. */ /* The following #define invokes a hack that will improve performance (baud) @@ -92,7 +94,6 @@ #include #endif -#include #include #include #include @@ -1274,10 +1275,10 @@ return 0; } -static int pi_set_mac_address(struct device *dev, void *addr) +static int pi_set_mac_address(struct device *dev, struct sockaddr *sa) { - memcpy(dev->dev_addr, addr, 7); /* addr is an AX.25 shifted ASCII */ - return 0; /* mac address */ + memcpy(dev->dev_addr, sa->sa_data, dev->addr_len); /* addr is an AX.25 shifted ASCII */ + return 0; /* mac address */ } /* Allocate a buffer which does not cross a DMA page boundary */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/ppp.c linux/drivers/net/ppp.c --- v1.3.37/linux/drivers/net/ppp.c Sun Oct 29 11:38:49 1995 +++ linux/drivers/net/ppp.c Mon Oct 30 08:12:03 1995 @@ -69,7 +69,6 @@ #include #ifdef MODULE -#include #define STATIC #else #define STATIC static diff -u --recursive --new-file v1.3.37/linux/drivers/net/seeq8005.c linux/drivers/net/seeq8005.c --- v1.3.37/linux/drivers/net/seeq8005.c Tue Oct 10 18:46:36 1995 +++ linux/drivers/net/seeq8005.c Mon Oct 30 10:35:26 1995 @@ -17,10 +17,6 @@ static const char *version = "seeq8005.c:v1.00 8/07/95 Hamish Coleman (hamish@zot.apana.org.au)\n"; -/* Always include 'config.h' first in case the user wants to turn on - or override something. */ -#include - /* Sources: SEEQ 8005 databook diff -u --recursive --new-file v1.3.37/linux/drivers/net/skeleton.c linux/drivers/net/skeleton.c --- v1.3.37/linux/drivers/net/skeleton.c Tue Oct 10 18:46:37 1995 +++ linux/drivers/net/skeleton.c Mon Oct 30 10:35:26 1995 @@ -24,10 +24,6 @@ static const char *version = "skeleton.c:v1.51 9/24/94 Donald Becker (becker@cesdis.gsfc.nasa.gov)\n"; -/* Always include 'config.h' first in case the user wants to turn on - or override something. */ -#include - /* Sources: List your sources of programming information to document that diff -u --recursive --new-file v1.3.37/linux/drivers/net/tulip.c linux/drivers/net/tulip.c --- v1.3.37/linux/drivers/net/tulip.c Tue Oct 10 18:46:37 1995 +++ linux/drivers/net/tulip.c Mon Oct 30 10:35:26 1995 @@ -16,12 +16,8 @@ static const char *version = "tulip.c:v0.05 1/20/95 becker@cesdis.gsfc.nasa.gov\n"; -#ifdef MODULE #include -#include -#endif -#include #include #include #include @@ -741,7 +737,6 @@ } #ifdef MODULE -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device dev_tulip = { devicename, /* device name is inserted by linux/drivers/net/net_init.c */ diff -u --recursive --new-file v1.3.37/linux/drivers/net/wavelan.c linux/drivers/net/wavelan.c --- v1.3.37/linux/drivers/net/wavelan.c Sat Sep 9 15:26:53 1995 +++ linux/drivers/net/wavelan.c Mon Oct 30 10:35:26 1995 @@ -4,12 +4,7 @@ * controlled by an Intel 82586 coprocessor. */ -#include - -#if defined(MODULE) #include -#include -#endif /* defined(MODULE) */ #include #include @@ -2175,7 +2170,6 @@ } #if defined(MODULE) -char kernel_version[] = UTS_RELEASE; static char devicename[9] = { 0, }; static struct device dev_wavelan = { diff -u --recursive --new-file v1.3.37/linux/drivers/pci/pci.c linux/drivers/pci/pci.c --- v1.3.37/linux/drivers/pci/pci.c Sun Oct 29 11:38:49 1995 +++ linux/drivers/pci/pci.c Tue Nov 7 09:18:35 1995 @@ -61,6 +61,7 @@ DEVICE( WEITEK, WEITEK_P9100, "P9100"), BRIDGE( DEC, DEC_BRD, "DC21050", 0x00), DEVICE( DEC, DEC_TULIP, "DC21040"), + DEVICE( DEC, DEC_TGA, "DC21030"), DEVICE( DEC, DEC_TULIP_FAST, "DC21140"), DEVICE( DEC, DEC_FDDI, "DEFPA"), DEVICE( DEC, DEC_TULIP_PLUS, "DC21041"), diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/Makefile linux/drivers/scsi/Makefile --- v1.3.37/linux/drivers/scsi/Makefile Wed Sep 27 15:59:58 1995 +++ linux/drivers/scsi/Makefile Mon Nov 6 18:00:27 1995 @@ -37,8 +37,8 @@ ifdef CONFIG_MODVERSIONS # Create this before we build anything else. SCSI_MODULE_VER := scsi_syms.ver - SYMTAB_OBJS := scsi_syms.o - endif + endif + SYMTAB_OBJS := scsi_syms.o M_OBJS += scsi_mod.o endif endif diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/NCR53c406a.c linux/drivers/scsi/NCR53c406a.c --- v1.3.37/linux/drivers/scsi/NCR53c406a.c Mon Oct 23 18:02:07 1995 +++ linux/drivers/scsi/NCR53c406a.c Mon Oct 30 10:40:59 1995 @@ -37,10 +37,7 @@ /* ============= End of user configurable parameters ============= */ -#ifdef MODULE -#include #include -#endif #include #include diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/aha152x.c linux/drivers/scsi/aha152x.c --- v1.3.37/linux/drivers/scsi/aha152x.c Mon Oct 23 18:02:07 1995 +++ linux/drivers/scsi/aha152x.c Mon Oct 30 10:40:59 1995 @@ -204,10 +204,7 @@ #define MODULE #endif -#ifdef MODULE -#include #include -#endif #ifdef PCMCIA #undef MODULE diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/aic7xxx.c linux/drivers/scsi/aic7xxx.c --- v1.3.37/linux/drivers/scsi/aic7xxx.c Mon Oct 23 18:02:08 1995 +++ linux/drivers/scsi/aic7xxx.c Mon Oct 30 10:40:59 1995 @@ -64,7 +64,9 @@ #include "scsi.h" #include "hosts.h" #include "aic7xxx.h" -#include +#include + +#include /* for CONFIG_PCI */ struct proc_dir_entry proc_scsi_aic7xxx = { PROC_SCSI_AIC7XXX, 7, "aic7xxx", @@ -3976,10 +3978,10 @@ while (!done) { if ((!pcibios_find_device(PCI_VENDOR_ID_ADAPTEC, - PCI_DEVICE_ID_ADAPTEC_294x, + PCI_DEVICE_ID_ADAPTEC_7870, index, &pci_bus, &pci_device_fn)) || (!pcibios_find_device(PCI_VENDOR_ID_ADAPTEC, - PCI_DEVICE_ID_ADAPTEC_2940, + PCI_DEVICE_ID_ADAPTEC_7871, index, &pci_bus, &pci_device_fn))) { type = AIC_7870; diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/eata_dma.c linux/drivers/scsi/eata_dma.c --- v1.3.37/linux/drivers/scsi/eata_dma.c Mon Oct 23 18:02:11 1995 +++ linux/drivers/scsi/eata_dma.c Mon Nov 6 12:45:53 1995 @@ -48,15 +48,12 @@ * Thanks also to Greg Hosler who did a lot of testing and * * found quite a number of bugs during the development. * ************************************************************ - * last change: 95/09/17 OS: Linux 1.3.28 * + * last change: 95/11/03 OS: Linux 1.3.37 * ************************************************************/ /* Look in eata_dma.h for configuration and revision information */ -#ifdef MODULE #include -#include -#endif #include #include @@ -79,7 +76,8 @@ #include "eata_dma.h" #include "eata_dma_proc.h" -#include +#include +#include /* for CONFIG_PCI */ struct proc_dir_entry proc_scsi_eata_dma = { PROC_SCSI_EATA, 8, "eata_dma", @@ -144,7 +142,7 @@ } if (SD(sh)->channel == 0) { - if (sh->dma_channel != 0xff) free_dma(sh->dma_channel); + if (sh->dma_channel != BUSMASTER) free_dma(sh->dma_channel); if (sh->io_port && sh->n_io_port) release_region(sh->io_port, sh->n_io_port); } @@ -178,7 +176,13 @@ sp=&SD(sh)->sp; - cp = sp->ccb; /* Has been passed thru, no conversion needed */ + if((cp = sp->ccb) == NULL) { + eata_stat = inb(base + HA_RSTATUS); + printk("eata_dma: Board: %x Spurious IRQ %lx " + "received. CCB pointer not set.\n", base, (long)cp); + restore_flags(flags); + return; + } cmd = cp->cmd; base = (uint) cmd->host->base; @@ -373,7 +377,7 @@ printk(KERN_EMERG "eata_dma: run out of queue slots cmdno:%ld" " intrno: %ld, can_queue: %d, x: %d, y: %d\n", queue_counter, int_counter, sh->can_queue, x, y); - printk(KERN_EMERG "List of free queueslots:"); + printk(KERN_EMERG "Status of queueslots:"); for(z = 0; z < sh->can_queue; z +=2) { switch(hd->ccb[z].status) { case FREE: @@ -499,20 +503,22 @@ cp->cp_statDMA = htonl(virt_to_bus(&(hd->sp))); - cp->cp_viraddr = cp; /* This will be passed thru, so we don't need to convert it */ + cp->cp_viraddr = cp; /* This will be passed thru, so we don't need to + * convert it */ cp->cmd = cmd; cmd->host_scribble = (char *)&hd->ccb[y]; if(eata_send_command((u32) cp, (u32) sh->base, EATA_CMD_DMA_SEND_CP) == FALSE) { cmd->result = DID_BUS_BUSY << 16; - printk("eata_queue target %d, pid %ld, HBA busy, returning DID_BUS_BUSY\n", - cmd->target, cmd->pid); + DBG(DBG_QUEUE && DBG_ABNORM, + printk("eata_queue target %d, pid %ld, HBA busy, " + "returning DID_BUS_BUSY\n",cmd->target, cmd->pid)); done(cmd); - cp->status = FREE; /* Hmmm..... */ + cp->status = FREE; restore_flags(flags); return(0); } - DBG(DBG_QUEUE,printk("Queued base %#.4x pid: %ld target: %x lun: %x " + DBG(DBG_QUEUE, printk("Queued base %#.4x pid: %ld target: %x lun: %x " "slot %d irq %d\n", (s32)sh->base, cmd->pid, cmd->target, cmd->lun, y, sh->irq)); DBG(DBG_QUEUE && DBG_DELAY, DEL2(200)); @@ -1042,8 +1048,9 @@ if(hd->bustype != IS_ISA) sh->cmd_per_lun = sh->can_queue/C_P_L_DIV; else - sh->cmd_per_lun = 8; /* We artificially limit this to conserve memory, - * which would be needed for ISA bounce buffers */ + sh->cmd_per_lun = 8; /* We artificially limit this to conserve + * memory, which would be needed for ISA + * bounce buffers */ } else sh->cmd_per_lun = 1; @@ -1118,9 +1125,9 @@ pal2 = inb((u16)base - 7); pal3 = inb((u16)base - 6); - if (((pal1 == 0x12) && (pal2 == 0x14)) || - ((pal1 == 0x38) && (pal2 == 0xa3) && (pal3 == 0x82)) || - ((pal1 == 0x06) && (pal2 == 0x94) && (pal3 == 0x24))) { + if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) || + ((pal1 == NEC_ID1) && (pal2 == NEC_ID2) && (pal3 == NEC_ID3))|| + ((pal1 == ATT_ID1) && (pal2 == ATT_ID2) && (pal3 == ATT_ID3))){ DBG(DBG_PROBE, printk("EISA EATA id tags found: %x %x %x \n", (int)pal1, (int)pal2, (int)pal3)); #endif @@ -1133,7 +1140,7 @@ } else { if (check_blink_state(base)) printk("HBA is in BLINK state. Consult your HBAs " - " Manual to correct this.\n"); + "Manual to correct this.\n"); } /* Nothing found here so we take it from the list */ EISAbases[i] = 0; @@ -1224,9 +1231,11 @@ pal1 = inb(base); pal2 = inb(base + 1); pal3 = inb(base + 2); - if (((pal1 == 0x12) && (pal2 == 0x14)) || - ((pal1 == 0x38) && (pal2 == 0xa3) && (pal3 == 0x82)) || - ((pal1 == 0x06) && (pal2 == 0x94) && (pal3 == 0x24))) + if (((pal1 == DPT_ID1) && (pal2 == DPT_ID2)) || + ((pal1 == NEC_ID1) && (pal2 == NEC_ID2) && + (pal3 == NEC_ID3)) || + ((pal1 == ATT_ID1) && (pal2 == ATT_ID2) && + (pal3 == ATT_ID3))) base += 0x08; else base += 0x10; /* Now, THIS is the real address */ diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/eata_dma_proc.c linux/drivers/scsi/eata_dma_proc.c --- v1.3.37/linux/drivers/scsi/eata_dma_proc.c Mon Oct 16 18:38:23 1995 +++ linux/drivers/scsi/eata_dma_proc.c Mon Nov 6 12:45:53 1995 @@ -13,12 +13,12 @@ do { sp = (u16 *)lp; /* Convert SubHeader */ - *sp = ntohs(*sp); - bp = (u8 *) lp; - y = *(bp + 3); - lp++; - for (h_lp = (u32)lp; (u32)lp < h_lp + ((u32)*(bp + 3)); lp++) - *lp = ntohl(*lp); + *sp = ntohs(*sp); + bp = (u8 *) lp; + y = *(bp + 3); + lp++; + for (h_lp = (u32)lp; (u32)lp < h_lp + ((u32)*(bp + 3)); lp++) + *lp = ntohl(*lp); }while ((u32)lp < ((u32)p) + 4 + h_sp); } diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/eata_generic.h linux/drivers/scsi/eata_generic.h --- v1.3.37/linux/drivers/scsi/eata_generic.h Wed Oct 4 14:14:32 1995 +++ linux/drivers/scsi/eata_generic.h Mon Nov 6 12:45:53 1995 @@ -44,6 +44,19 @@ #define PIO 0xfe #define EATA_SIGNATURE 0x45415441 /* BIG ENDIAN coded "EATA" sig. */ + +#define DPT_ID1 0x12 +#define DPT_ID2 0x14 + +#define ATT_ID1 0x06 +#define ATT_ID2 0x94 +#define ATT_ID3 0x0 + +#define NEC_ID1 0x38 +#define NEC_ID2 0xa3 +#define NEC_ID3 0x82 + + #define EATA_CP_SIZE 44 #define MAX_PCI_DEVICES 32 /* Maximum # Of Devices Per Bus */ @@ -109,14 +122,13 @@ #define ECS_EMULATE_SENSE 0xd4 - -#define GENERIC_ABORT 0x00 -#define SPECIFIC_RESET 0x01 -#define BUS_RESET 0x02 -#define SPECIFIC_ABORT 0x03 -#define QUIET_INTR 0x04 -#define COLD_BOOT_HBA 0x06 /* Only as a last resort */ -#define FORCE_IO 0x07 +#define EATA_GENERIC_ABORT 0x00 +#define EATA_SPECIFIC_RESET 0x01 +#define EATA_BUS_RESET 0x02 +#define EATA_SPECIFIC_ABORT 0x03 +#define EATA_QUIET_INTR 0x04 +#define EATA_COLD_BOOT_HBA 0x06 /* Only as a last resort */ +#define EATA_FORCE_IO 0x07 #define HA_WCOMMAND 0x07 /* command register offset */ diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/eata_pio.c linux/drivers/scsi/eata_pio.c --- v1.3.37/linux/drivers/scsi/eata_pio.c Wed Oct 4 14:14:32 1995 +++ linux/drivers/scsi/eata_pio.c Mon Oct 30 10:47:08 1995 @@ -37,10 +37,7 @@ /* Look in eata_pio.h for configuration information */ -#ifdef MODULE #include -#include -#endif #include #include @@ -57,7 +54,9 @@ #include "scsi.h" #include "sd.h" -#include +#include +#include /* for CONFIG_PCI */ + struct proc_dir_entry proc_scsi_eata_pio = { PROC_SCSI_EATA_PIO, 9, "eata_pio", S_IFDIR | S_IRUGO | S_IXUGO, 2 diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/fdomain.c linux/drivers/scsi/fdomain.c --- v1.3.37/linux/drivers/scsi/fdomain.c Mon Oct 23 18:02:11 1995 +++ linux/drivers/scsi/fdomain.c Mon Oct 30 10:47:09 1995 @@ -211,6 +211,8 @@ #include #include +#include /* for CONFIG_PCI */ + struct proc_dir_entry proc_scsi_fdomain = { PROC_SCSI_FDOMAIN, 7, "fdomain", S_IFDIR | S_IRUGO | S_IXUGO, 2 diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/qlogic.c linux/drivers/scsi/qlogic.c --- v1.3.37/linux/drivers/scsi/qlogic.c Mon Oct 23 18:02:11 1995 +++ linux/drivers/scsi/qlogic.c Mon Oct 30 10:48:39 1995 @@ -110,10 +110,7 @@ #define MODULE #endif -#if defined(MODULE) -#include #include -#endif #ifdef PCMCIA #undef MODULE diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/scsi.c linux/drivers/scsi/scsi.c --- v1.3.37/linux/drivers/scsi/scsi.c Mon Oct 23 18:02:11 1995 +++ linux/drivers/scsi/scsi.c Mon Nov 6 18:00:28 1995 @@ -20,19 +20,13 @@ * Native multichannel and wide scsi support added * by Michael Neuffer neuffer@goofy.zdv.uni-mainz.de */ -#ifdef MODULE + /* * Don't import our own symbols, as this would severely mess up our * symbol tables. */ #define _SCSI_SYMS_VER_ -#include #include -#include -#else -#define MOD_INC_USE_COUNT -#define MOD_DEC_USE_COUNT -#endif #include #include @@ -50,6 +44,7 @@ #include "hosts.h" #include "constants.h" +#include #undef USE_STATIC_SCSI_MEMORY @@ -2148,7 +2143,7 @@ restore_flags(flags); dma_free_sectors -= nbits; #ifdef DEBUG - printk("SMalloc: %d %p ",len, dma_malloc_pages[i] + (j << 9)); + printk("SMalloc: %d %p\n",len, dma_malloc_pages[i] + (j << 9)); #endif return (void *) ((unsigned long) dma_malloc_pages[i] + (j << 9)); } @@ -2499,7 +2494,7 @@ * Free up the DMA pool. */ if( dma_free_sectors != dma_sectors ) - panic("SCSI DMA pool memory leak\n"); + panic("SCSI DMA pool memory leak %d %d\n",dma_free_sectors,dma_sectors); for(i=0; i < dma_sectors >> 3; i++) scsi_init_free(dma_malloc_pages[i], PAGE_SIZE); @@ -3062,12 +3057,8 @@ #ifdef MODULE - -char kernel_version[] = UTS_RELEASE; - extern struct symbol_table scsi_symbol_table; - int init_module(void) { /* * This makes /proc/scsi visible. @@ -3080,6 +3071,7 @@ scsi_loadable_module_flag = 1; dma_sectors = PAGE_SIZE / 512; + dma_free_sectors= dma_sectors; /* * Set up a minimal DMA buffer list - this will be used during scan_scsis * in some cases. @@ -3100,8 +3092,6 @@ void cleanup_module( void) { - int i; - if (MOD_IN_USE) { printk(KERN_INFO __FILE__ ": module is in use, remove rejected\n"); return; diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/scsi_syms.c linux/drivers/scsi/scsi_syms.c --- v1.3.37/linux/drivers/scsi/scsi_syms.c Mon Oct 23 18:02:11 1995 +++ linux/drivers/scsi/scsi_syms.c Mon Oct 30 10:47:09 1995 @@ -1,6 +1,3 @@ - -#include - /* * We should not even be trying to compile this if we are not doing * a module. @@ -17,19 +14,20 @@ #undef MODULE #include -#include -#include +#include #include #include #include #include -#include -#include #include #include - #include + +#include +#include +#include + #include "scsi.h" #include "scsi_ioctl.h" #include "hosts.h" diff -u --recursive --new-file v1.3.37/linux/drivers/scsi/st.c linux/drivers/scsi/st.c --- v1.3.37/linux/drivers/scsi/st.c Mon Oct 23 18:02:12 1995 +++ linux/drivers/scsi/st.c Mon Nov 6 12:29:40 1995 @@ -11,7 +11,7 @@ Copyright 1992, 1993, 1994, 1995 Kai Makisara email Kai.Makisara@metla.fi - Last modified: Tue Oct 17 21:46:26 1995 by root@kai.makisara.fi + Last modified: Sat Nov 4 22:23:54 1995 by root@kai.makisara.fi Some small formal changes - aeb, 950809 */ #ifdef MODULE @@ -212,7 +212,6 @@ STp->write_pending = 0; #endif up(SCpnt->request.sem); - SCpnt->request.sem = NULL; } #if DEBUG else if (debugging) diff -u --recursive --new-file v1.3.37/linux/drivers/sound/.blurb linux/drivers/sound/.blurb --- v1.3.37/linux/drivers/sound/.blurb Fri Oct 13 14:44:33 1995 +++ linux/drivers/sound/.blurb Tue Nov 7 10:14:16 1995 @@ -6,7 +6,3 @@ * Readme.cards (this directory) contains some card * * specific instructions. * ********************************************************* -* NOTE!!!! THIS IS AN _EXPERIMENTAL_ ALPHA TEST VERSION * -* WHICH CERTAINLY HAS BUGS AND MAY SERIOUSLY DAMAGE YOUR* -* SYSTEM. YOU HAVE A CHANCE TO HIT CTRL-C NOW!!!!!!!! * -********************************************************* diff -u --recursive --new-file v1.3.37/linux/drivers/sound/.objects linux/drivers/sound/.objects --- v1.3.37/linux/drivers/sound/.objects Mon Oct 23 18:02:13 1995 +++ linux/drivers/sound/.objects Tue Nov 7 10:14:16 1995 @@ -80,6 +80,10 @@ OBJS := $(OBJS) sequencer.o endif +ifdef CONFIG_PNP + OBJS := $(OBJS) sound_pnp.o +endif + ifdef CONFIG_SEQUENCER OBJS := $(OBJS) sound_timer.o endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/.version linux/drivers/sound/.version --- v1.3.37/linux/drivers/sound/.version Mon Oct 23 18:02:13 1995 +++ linux/drivers/sound/.version Tue Nov 7 10:14:16 1995 @@ -1 +1,2 @@ -3.5-alpha3 +3.5-alpha5 +0x030505 diff -u --recursive --new-file v1.3.37/linux/drivers/sound/Makefile linux/drivers/sound/Makefile --- v1.3.37/linux/drivers/sound/Makefile Mon Oct 23 18:02:13 1995 +++ linux/drivers/sound/Makefile Tue Nov 7 10:14:16 1995 @@ -5,10 +5,11 @@ # # -VERSION = `cat .version` +VERSION = `head -1 .version` TARGET_OS = linux USRINCDIR = /usr/include MODULEDIR = /lib/modules/misc + FIXEDOBJS = soundcard.o dev_table.o sound_switch.o ifeq (.defines,$(wildcard .defines)) @@ -21,7 +22,7 @@ gus_midi.o gus_vol.o patmgr.o sb_mixer.o sb16_dsp.o sb_midi.o \ sb16_midi.o midi_synth.o uart6850.o sound_timer.o \ sys_timer.o ics2101.o ad1848.o pss.o sscape.o trix.o aedsp16.o \ - mad16.o mad16_sb_midi.o cs4232.o maui.o + mad16.o mad16_sb_midi.o cs4232.o maui.o sound_pnp.o endif ifndef HOSTCC @@ -32,6 +33,7 @@ HOSTCC = gcc CFLAGS = -D__KERNEL__ -DMODULE -I/usr/src/linux/include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -pipe -m486 + build: @echo Compiling modularized sound driver @make sound.o @@ -72,8 +74,14 @@ $(MAKE) setup-$(TARGET_OS) $(MAKE) oldconfig $(MAKE) dep - @echo You have to restart make. This ensures that options are read corrrectly. - exit -1 + @echo + @echo + @echo + @echo NOTE! Object file dependencies may not be up to date. Run + @echo make again if kernel/driver doesn't link properly. Restarting + @echo it now may save some time. + @echo + @echo config: configure @$(MAKE) setup-$(TARGET_OS) @@ -85,7 +93,7 @@ @echo \#define SOUND_UNAME_A \"`uname -a`\" >> local.h oldconfig: setup-$(TARGET_OS) configure - @./configure /etc/soundconf > local.h + @./configure -o > local.h @echo \#define SOUND_CONFIG_DATE \"`date`\" >> local.h @echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local.h # @echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local.h 2>/dev/null diff -u --recursive --new-file v1.3.37/linux/drivers/sound/Readme linux/drivers/sound/Readme --- v1.3.37/linux/drivers/sound/Readme Mon Oct 23 18:02:13 1995 +++ linux/drivers/sound/Readme Tue Nov 7 10:14:16 1995 @@ -1,5 +1,5 @@ -VoxWare v3.5-alpha3 release notes +VoxWare v3.5-alpha5 release notes --------------------------------- IMPORTANT! This version of the driver is compatible only with Linux versions @@ -41,7 +41,7 @@ your kernel version, please use the sound driver version included in your kernel. -You will need the snd-util-2.5.tar.gz and snd-data-0.1.tar.Z +You will need the snd-util-3.0.tar.gz and snd-data-0.1.tar.Z packages to use this driver. They should be in the same ftp site or BBS from where you got this driver. For example at nic.funet.fi:pub/OS/Linux/*. diff -u --recursive --new-file v1.3.37/linux/drivers/sound/Readme.cards linux/drivers/sound/Readme.cards --- v1.3.37/linux/drivers/sound/Readme.cards Fri Oct 13 14:44:33 1995 +++ linux/drivers/sound/Readme.cards Tue Nov 7 10:14:16 1995 @@ -127,6 +127,17 @@ Audio Excell DSP16 Support for this card is made by Riccardo Faccetti (riccardo@cdc8g5.cdc.polimi.it). See aedsp16.c for more info. + +Crystal CS4232 based cards such as AcerMagic S23 + CS4232 is a PnP multimedia chip which contains a CS3231A codec, + SB and MPU401 emulations. There is support for OPL3 too. + (Unfortunately the MPU401 mode doesn't work). + +Turtle Beach Maui and Tropez + VoxWare supports sample, parch and program loading commands + described in the Maui/Tropez User's manual. There is no initialization + code for Maui so it must be initialized using DOS. Audio side of Tropez + is based on the MAD16 chip (see above). Jumpers and software configuration ---------------------------------- diff -u --recursive --new-file v1.3.37/linux/drivers/sound/ad1848.c linux/drivers/sound/ad1848.c --- v1.3.37/linux/drivers/sound/ad1848.c Fri Oct 13 14:44:33 1995 +++ linux/drivers/sound/ad1848.c Tue Nov 7 10:14:16 1995 @@ -1635,6 +1635,9 @@ InitAEDSP16_MSS (hw_config); #endif + if (hw_config->card_subtype == 1) /* Has IRQ/DMA registers */ + return ad1848_detect (hw_config->io_base + 4, NULL, hw_config->osp); + /* * Check if the IO port returns valid signature. The original MS Sound * system returns 0x04 while some cards (AudioTriX Pro for example) diff -u --recursive --new-file v1.3.37/linux/drivers/sound/ad1848_mixer.h linux/drivers/sound/ad1848_mixer.h --- v1.3.37/linux/drivers/sound/ad1848_mixer.h Fri Oct 13 14:44:33 1995 +++ linux/drivers/sound/ad1848_mixer.h Tue Nov 7 10:14:16 1995 @@ -131,7 +131,7 @@ 0x4b4b, /* Output gain */ 0x4040, /* Line1 */ 0x4040, /* Line2 */ - 0x2020 /* Line3 (usually line in)*/ + 0x1515 /* Line3 (usually line in)*/ }; #define LEFT_CHN 0 diff -u --recursive --new-file v1.3.37/linux/drivers/sound/adlib_card.c linux/drivers/sound/adlib_card.c --- v1.3.37/linux/drivers/sound/adlib_card.c Mon Oct 23 18:02:13 1995 +++ linux/drivers/sound/adlib_card.c Tue Nov 7 10:14:16 1995 @@ -60,4 +60,5 @@ release_region (hw_config->io_base, 4); } + #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/audio.c linux/drivers/sound/audio.c --- v1.3.37/linux/drivers/sound/audio.c Sun Oct 29 11:38:49 1995 +++ linux/drivers/sound/audio.c Tue Nov 7 10:14:16 1995 @@ -154,7 +154,7 @@ DMAbuf_release (dev, mode); } -#if !defined(i386) +#if defined(NO_INLINE_ASM) || !defined(i386) static void translate_bytes (const unsigned char *table, unsigned char *buff, int n) { @@ -182,6 +182,7 @@ : "bx", "cx", "di", "si", "ax"); } } + #endif int @@ -262,7 +263,7 @@ /* * This just allows interrupts while the conversion is running */ - sti(); + sti (); translate_bytes (ulaw_dsp, (unsigned char *) &wr_dma_buf[dev][wr_buff_ptr[dev]], l); } @@ -337,7 +338,7 @@ /* * This just allows interrupts while the conversion is running */ - sti(); + sti (); translate_bytes (dsp_ulaw, (unsigned char *) dmabuf, l); } @@ -501,7 +502,9 @@ return 0; /* Wrong direction */ if (wr_buff_no[dev] != -1) - return 1; /* There is space in the current buffer */ + { + return 1; /* There is space in the current buffer */ + } return DMAbuf_select (dev, file, sel_type, wait); break; @@ -514,52 +517,5 @@ } -#else /* EXCLUDE_AUDIO */ -/* - * Stub versions - */ - -int -audio_read (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) -{ - return -EIO; -} - -int -audio_write (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) -{ - return -EIO; -} - -int -audio_open (int dev, struct fileinfo *file) -{ - return -ENXIO; -} - -void -audio_release (int dev, struct fileinfo *file) -{ -}; -int -audio_ioctl (int dev, struct fileinfo *file, - unsigned int cmd, unsigned int arg) -{ - return -EIO; -} - -int -audio_lseek (int dev, struct fileinfo *file, off_t offset, int orig) -{ - return -EIO; -} - -long -audio_init (long mem_start) -{ - return mem_start; -} - #endif - #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/configure.c linux/drivers/sound/configure.c --- v1.3.37/linux/drivers/sound/configure.c Mon Oct 23 18:02:13 1995 +++ linux/drivers/sound/configure.c Tue Nov 7 10:14:16 1995 @@ -143,7 +143,7 @@ {B (OPT_SB) | B (OPT_SBPRO), B (OPT_PAS), "SB16", 1, 0, 1}, {B (OPT_SBPRO) | B (OPT_MSS) | B (OPT_MPU401), 0, "AEDSP16", 1, 0, 0}, {AUDIO_CARDS, 0, "AUDIO", 1, 0, 1}, - {B (OPT_MPU401), 0, "MIDI_AUTO", 0, OPT_MIDI, 0}, + {B (OPT_MPU401) | B (OPT_MAUI), 0, "MIDI_AUTO", 0, OPT_MIDI, 0}, {MIDI_CARDS, 0, "MIDI", 1, 0, 1}, {B (OPT_ADLIB), 0, "YM3812_AUTO", 0, OPT_YM3812, 0}, {B (OPT_PSS) | B (OPT_SB) | B (OPT_PAS) | B (OPT_ADLIB) | B (OPT_MSS) | B (OPT_PSS), B (OPT_YM3812_AUTO), "YM3812", 1, 0, 1}, @@ -201,6 +201,8 @@ } }; +char *oldconf = "/etc/soundconf"; + int old_config_used = 0; unsigned long selected_options = 0; @@ -506,19 +508,34 @@ int i, num, def_size, full_driver = 1; char answ[10]; int sb_base = 0; + char old_config_file[200]; fprintf (stderr, "\nConfiguring the sound support\n\n"); + if (getuid () != 0) /* Not root */ + { + char *home; + + if ((home = getenv ("HOME")) != NULL) + { + sprintf (old_config_file, "%s/.soundconf", home); + oldconf = old_config_file; + } + } + if (argc > 1) { - if (use_old_config (argv[1])) + if (strcmp (argv[1], "-o") == 0 && + use_old_config (oldconf)) exit (0); } - else if (access ("/etc/soundconf", R_OK) == 0) + + if (access (oldconf, R_OK) == 0) { - fprintf (stderr, "Old configuration exists in /etc/soundconf. Use it (y/n) ? "); - if (think_positively (0)) - if (use_old_config ("/etc/soundconf")) + fprintf (stderr, "Old configuration exists in %s. Use it (y/n) ? ", + oldconf); + if (think_positively (1)) + if (use_old_config (oldconf)) exit (0); } @@ -1701,12 +1718,16 @@ if (!old_config_used) { - fprintf (stderr, "Save this configuration to /etc/soundconf (y/n)"); + fprintf (stderr, "Save copy of this configuration to %s (y/n)", oldconf); if (think_positively (1)) { + char cmd[200]; + + sprintf (cmd, "cp local.h %s", oldconf); + fclose (stdout); - if (system ("cp local.h /etc/soundconf") != 0) - perror ("'cp local.h /etc/soundconf'"); + if (system (cmd) != 0) + perror (cmd); } } exit (0); diff -u --recursive --new-file v1.3.37/linux/drivers/sound/cs4232.c linux/drivers/sound/cs4232.c --- v1.3.37/linux/drivers/sound/cs4232.c Fri Oct 13 14:44:33 1995 +++ linux/drivers/sound/cs4232.c Tue Nov 7 10:14:16 1995 @@ -196,6 +196,7 @@ hw_config2.name = NULL; hw_config2.driver_use_1 = 0; hw_config2.driver_use_2 = 0; + hw_config2.card_subtype = 0; hw_config2.osp = hw_config->osp; if (probe_mpu401 (&hw_config2)) @@ -240,6 +241,7 @@ hw_config2.name = NULL; hw_config2.driver_use_1 = 0; hw_config2.driver_use_2 = 0; + hw_config2.card_subtype = 0; hw_config2.osp = hw_config->osp; unload_mpu401 (&hw_config2); @@ -252,5 +254,6 @@ { /* Not required. Handled by cs4232_unload */ } + #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/dev_table.c linux/drivers/sound/dev_table.c --- v1.3.37/linux/drivers/sound/dev_table.c Mon Oct 23 18:02:13 1995 +++ linux/drivers/sound/dev_table.c Tue Nov 7 10:14:16 1995 @@ -32,6 +32,10 @@ #ifdef CONFIGURE_SOUNDCARD +int sound_started = 0; + +int sndtable_get_cardcount (void); + int snd_find_driver (int type) { @@ -41,17 +45,17 @@ if (sound_drivers[i].card_type == type) return i; - return -1; /* - * Not found - */ + return -1; } -long -sndtable_init (long mem_start) + +static long +start_cards (long mem_start) { int i, n = num_sound_cards; int drv; + sound_started = 1; printk ("Sound initialization started\n"); /* @@ -67,19 +71,34 @@ snd_installed_cards[i].for_driver_use = NULL; if ((drv = snd_find_driver (snd_installed_cards[i].card_type)) == -1) - snd_installed_cards[i].enabled = 0; /* - * Mark as not detected - */ - else if (sound_drivers[drv].probe (&snd_installed_cards[i].config)) { + snd_installed_cards[i].enabled = 0; /* + * Mark as not detected + */ + continue; + } + + snd_installed_cards[i].config.card_subtype = + sound_drivers[drv].card_subtype; + + if (sound_drivers[drv].probe (&snd_installed_cards[i].config)) + { + int tmp; + printk ("snd%d", snd_installed_cards[i].card_type); mem_start = sound_drivers[drv].attach (mem_start, &snd_installed_cards[i].config); - printk (" at 0x%x irq %d drq %d", - snd_installed_cards[i].config.io_base, - snd_installed_cards[i].config.irq, - snd_installed_cards[i].config.dma); + printk (" at 0x%x", + snd_installed_cards[i].config.io_base); + + if ((tmp = snd_installed_cards[i].config.irq) != 0) + printk (" irq %d", + (tmp > 0) ? tmp : -tmp); + + if (snd_installed_cards[i].config.dma >= 0) + printk (" drq %d", + snd_installed_cards[i].config.dma); if (snd_installed_cards[i].config.dma2 != -1) printk (",%d\n", snd_installed_cards[i].config.dma2); @@ -96,23 +115,68 @@ return mem_start; } +long +sndtable_init (long mem_start) +{ + return start_cards (mem_start); +} + void sound_unload_drivers (void) { int i, n = num_sound_cards; int drv; + if (!sound_started) + return; + printk ("Sound unload started\n"); for (i = 0; i < n && snd_installed_cards[i].card_type; i++) if (snd_installed_cards[i].enabled) if ((drv = snd_find_driver (snd_installed_cards[i].card_type)) != -1) if (sound_drivers[drv].unload) - sound_drivers[drv].unload (&snd_installed_cards[i].config); + { + sound_drivers[drv].unload (&snd_installed_cards[i].config); + snd_installed_cards[i].enabled = 0; + } printk ("Sound unload complete\n"); } +void +sound_unload_driver (int type) +{ + int i, drv = -1, n = num_sound_cards; + + unsigned long flags; + + DDB (printk ("unload driver %d: ", type)); + + for (i = 0; i < n && snd_installed_cards[i].card_type; i++) + if (snd_installed_cards[i].card_type == type) + { + if (snd_installed_cards[i].enabled) + { + if ((drv = snd_find_driver (type)) != -1) + { + if (sound_drivers[drv].unload) + { + sound_drivers[drv].unload (&snd_installed_cards[i].config); + snd_installed_cards[i].enabled = 0; + } + } + } + } + + save_flags (flags); + cli (); + + restore_flags (flags); + +} + + int sndtable_probe (int unit, struct address_info *hw_config) { @@ -121,6 +185,8 @@ if (!unit) return TRUE; + sound_started = 1; + for (i = 0; i < n && sel == -1 && snd_installed_cards[i].card_type; i++) if (snd_installed_cards[i].enabled) if (snd_installed_cards[i].card_type == unit) @@ -145,11 +211,24 @@ snd_installed_cards[sel].config.irq = hw_config->irq; snd_installed_cards[sel].config.dma = hw_config->dma; snd_installed_cards[sel].config.dma2 = hw_config->dma2; + snd_installed_cards[sel].config.name = hw_config->name; + snd_installed_cards[sel].config.always_detect = hw_config->always_detect; + snd_installed_cards[sel].config.driver_use_1 = hw_config->driver_use_1; + snd_installed_cards[sel].config.driver_use_2 = hw_config->driver_use_2; + snd_installed_cards[sel].config.card_subtype = hw_config->card_subtype; + snd_installed_cards[sel].config.osp = hw_config->osp; + if ((drv = snd_find_driver (snd_installed_cards[sel].card_type)) == -1) { snd_installed_cards[sel].enabled = 0; + return FALSE; } - else if (sound_drivers[drv].probe (hw_config)) + + + snd_installed_cards[sel].config.card_subtype = + sound_drivers[drv].card_subtype; + + if (sound_drivers[drv].probe (hw_config)) return TRUE; snd_installed_cards[sel].enabled = 0; /* @@ -184,6 +263,12 @@ snd_installed_cards[i].config.irq = hw_config->irq; snd_installed_cards[i].config.dma = hw_config->dma; snd_installed_cards[i].config.dma2 = hw_config->dma2; + snd_installed_cards[i].config.name = hw_config->name; + snd_installed_cards[i].config.always_detect = hw_config->always_detect; + snd_installed_cards[i].config.driver_use_1 = hw_config->driver_use_1; + snd_installed_cards[i].config.driver_use_2 = hw_config->driver_use_2; + snd_installed_cards[i].config.card_subtype = hw_config->card_subtype; + snd_installed_cards[i].config.osp = hw_config->osp; if ((drv = snd_find_driver (snd_installed_cards[i].card_type)) == -1) snd_installed_cards[i].enabled = 0; /* @@ -300,12 +385,19 @@ snd_installed_cards[ptr].config.irq = irq; snd_installed_cards[ptr].config.dma = dma; snd_installed_cards[ptr].config.dma2 = -1; + snd_installed_cards[ptr].config.name = NULL; + snd_installed_cards[ptr].config.always_detect = 0; + snd_installed_cards[ptr].config.driver_use_1 = 0; + snd_installed_cards[ptr].config.driver_use_2 = 0; + snd_installed_cards[ptr].config.card_subtype = 0; + snd_installed_cards[ptr].config.osp = NULL; } } } -struct address_info * +struct address_info + * sound_getconf (int card_type) { int j, ptr; @@ -322,11 +414,6 @@ return &snd_installed_cards[ptr].config; } -#else -void -sound_setup (char *str, int *ints) -{ -} #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/dev_table.h linux/drivers/sound/dev_table.h --- v1.3.37/linux/drivers/sound/dev_table.h Mon Oct 23 18:02:14 1995 +++ linux/drivers/sound/dev_table.h Tue Nov 7 10:14:16 1995 @@ -40,9 +40,12 @@ * NOTE! NOTE! NOTE! NOTE! */ +extern int sound_started; + struct driver_info { char *driver_id; - int card_type; /* From soundcard.h */ + int card_subtype; /* Driver spesific. Usually 0 */ + int card_type; /* From soundcard.h */ char *name; long (*attach) (long mem_start, struct address_info *hw_config); int (*probe) (struct address_info *hw_config); @@ -279,69 +282,75 @@ struct driver_info sound_drivers[] = { #ifndef EXCLUDE_PSS - {"PSSECHO", SNDCARD_PSS, "Echo Personal Sound System PSS (ESC614)", attach_pss, probe_pss, unload_pss}, - {"PSSMPU", SNDCARD_PSS_MPU, "PSS-MPU", attach_pss_mpu, probe_pss_mpu, unload_pss_mpu}, - {"PSSMSS", SNDCARD_PSS_MSS, "PSS-MSS", attach_pss_mss, probe_pss_mss, unload_pss_mss}, + {"PSSECHO", 0, SNDCARD_PSS, "Echo Personal Sound System PSS (ESC614)", attach_pss, probe_pss, unload_pss}, + {"PSSMPU", 0, SNDCARD_PSS_MPU, "PSS-MPU", attach_pss_mpu, probe_pss_mpu, unload_pss_mpu}, + {"PSSMSS", 0, SNDCARD_PSS_MSS, "PSS-MSS", attach_pss_mss, probe_pss_mss, unload_pss_mss}, #endif #ifndef EXCLUDE_MSS - {"MSS", SNDCARD_MSS, "MS Sound System", attach_ms_sound, probe_ms_sound, unload_ms_sound}, - {"PCXBJ", SNDCARD_MSS, "MS Sound System", attach_ms_sound, probe_ms_sound, unload_ms_sound}, + {"MSS", 0, SNDCARD_MSS, "MS Sound System", attach_ms_sound, probe_ms_sound, unload_ms_sound}, + /* MSS without IRQ/DMA config registers (for DEC Alphas) */ + {"PCXBJ", 1, SNDCARD_PSEUDO_MSS, "MS Sound System", attach_ms_sound, probe_ms_sound, unload_ms_sound}, #endif #ifndef EXCLUDE_MAD16 - {"MAD16", SNDCARD_MAD16, "MAD16/Mozart (MSS)", attach_mad16, probe_mad16, unload_mad16}, - {"MAD16MPU", SNDCARD_MAD16_MPU, "MAD16/Mozart (MPU)", attach_mad16_mpu, probe_mad16_mpu, unload_mad16_mpu}, + {"MAD16", 0, SNDCARD_MAD16, "MAD16/Mozart (MSS)", attach_mad16, probe_mad16, unload_mad16}, + {"MAD16MPU", 0, SNDCARD_MAD16_MPU, "MAD16/Mozart (MPU)", attach_mad16_mpu, probe_mad16_mpu, unload_mad16_mpu}, #endif #ifndef EXCLUDE_CS4232 - {"CS4232", SNDCARD_CS4232, "CS4232", attach_cs4232, probe_cs4232, unload_cs4232}, - {"CS4232MPU", SNDCARD_CS4232_MPU, "CS4232 MIDI", attach_cs4232_mpu, probe_cs4232_mpu, unload_cs4232_mpu}, + {"CS4232", 0, SNDCARD_CS4232, "CS4232", attach_cs4232, probe_cs4232, unload_cs4232}, + {"CS4232MPU", 0, SNDCARD_CS4232_MPU, "CS4232 MIDI", attach_cs4232_mpu, probe_cs4232_mpu, unload_cs4232_mpu}, #endif #ifndef EXCLUDE_YM3812 - {"OPL3", SNDCARD_ADLIB, "OPL-2/OPL-3 FM", attach_adlib_card, probe_adlib, unload_adlib}, + {"OPL3", 0, SNDCARD_ADLIB, "OPL-2/OPL-3 FM", attach_adlib_card, probe_adlib, unload_adlib}, #endif #ifndef EXCLUDE_PAS - {"PAS16", SNDCARD_PAS, "ProAudioSpectrum", attach_pas_card, probe_pas, unload_pas}, + {"PAS16", 0, SNDCARD_PAS, "ProAudioSpectrum", attach_pas_card, probe_pas, unload_pas}, #endif #if !defined(EXCLUDE_MPU401) && !defined(EXCLUDE_MIDI) - {"MPU401", SNDCARD_MPU401,"Roland MPU-401", attach_mpu401, probe_mpu401, unload_mpu401}, + {"MPU401", 0, SNDCARD_MPU401,"Roland MPU-401", attach_mpu401, probe_mpu401, unload_mpu401}, #endif #if !defined(EXCLUDE_MAUI) - {"MAUI", SNDCARD_MAUI,"TB Maui", attach_maui, probe_maui, unload_maui}, + {"MAUI", 0, SNDCARD_MAUI,"TB Maui", attach_maui, probe_maui, unload_maui}, #endif #if !defined(EXCLUDE_UART6850) && !defined(EXCLUDE_MIDI) - {"MIDI6850", SNDCARD_UART6850,"6860 UART Midi", attach_uart6850, probe_uart6850, unload_uart6850}, + {"MIDI6850", 0, SNDCARD_UART6850,"6860 UART Midi", attach_uart6850, probe_uart6850, unload_uart6850}, #endif #ifndef EXCLUDE_SB - {"SBLAST", SNDCARD_SB, "SoundBlaster", attach_sb_card, probe_sb, unload_sb}, + {"SBLAST", 0, SNDCARD_SB, "SoundBlaster", attach_sb_card, probe_sb, unload_sb}, #endif #if !defined(EXCLUDE_SB) && !defined(EXCLUDE_SB16) #ifndef EXCLUDE_AUDIO - {"SB16", SNDCARD_SB16, "SoundBlaster16", sb16_dsp_init, sb16_dsp_detect, unload_sb16}, + {"SB16", 0, SNDCARD_SB16, "SoundBlaster16", sb16_dsp_init, sb16_dsp_detect, unload_sb16}, #endif #ifndef EXCLUDE_MIDI - {"SB16MIDI", SNDCARD_SB16MIDI,"SB16 MIDI", attach_sb16midi, probe_sb16midi, unload_sb16midi}, + {"SB16MIDI", 0, SNDCARD_SB16MIDI,"SB16 MIDI", attach_sb16midi, probe_sb16midi, unload_sb16midi}, #endif #endif #ifndef EXCLUDE_GUS16 - {"GUS16", SNDCARD_GUS16, "Ultrasound 16-bit opt.", attach_gus_db16, probe_gus_db16, unload_gus_db16}, + {"GUS16", 0, SNDCARD_GUS16, "Ultrasound 16-bit opt.", attach_gus_db16, probe_gus_db16, unload_gus_db16}, #endif #ifndef EXCLUDE_GUS - {"GUS", SNDCARD_GUS, "Gravis Ultrasound", attach_gus_card, probe_gus, unload_gus}, + {"GUS", 0, SNDCARD_GUS, "Gravis Ultrasound", attach_gus_card, probe_gus, unload_gus}, #endif #ifndef EXCLUDE_SSCAPE - {"SSCAPE", SNDCARD_SSCAPE, "Ensoniq Soundscape", attach_sscape, probe_sscape, unload_sscape}, - {"SCAPEMSS", SNDCARD_SSCAPE_MSS, "MS Sound System (SoundScape)", attach_ss_ms_sound, probe_ss_ms_sound, unload_ss_ms_sound}, + {"SSCAPE", 0, SNDCARD_SSCAPE, "Ensoniq Soundscape", attach_sscape, probe_sscape, unload_sscape}, + {"SSCAPEMSS", 0, SNDCARD_SSCAPE_MSS, "MS Sound System (SoundScape)", attach_ss_ms_sound, probe_ss_ms_sound, unload_ss_ms_sound}, #endif #ifndef EXCLUDE_TRIX - {"TRXPRO", SNDCARD_TRXPRO, "MediaTriX AudioTriX Pro", attach_trix_wss, probe_trix_wss, unload_trix_wss}, - {"TRXPROSB", SNDCARD_TRXPRO_SB, "AudioTriX (SB mode)", attach_trix_sb, probe_trix_sb, unload_trix_sb}, - {"TRXPROMPU", SNDCARD_TRXPRO_MPU, "AudioTriX MIDI", attach_trix_mpu, probe_trix_mpu, unload_trix_mpu}, + {"TRXPRO", 0, SNDCARD_TRXPRO, "MediaTriX AudioTriX Pro", attach_trix_wss, probe_trix_wss, unload_trix_wss}, + {"TRXPROSB", 0, SNDCARD_TRXPRO_SB, "AudioTriX (SB mode)", attach_trix_sb, probe_trix_sb, unload_trix_sb}, + {"TRXPROMPU", 0, SNDCARD_TRXPRO_MPU, "AudioTriX MIDI", attach_trix_mpu, probe_trix_mpu, unload_trix_mpu}, #endif #ifndef EXCLUDE_PNP - {"AD1848", 1000, "PnP MSS", attach_pnp_ad1848, probe_pnp_ad1848, unload_pnp_ad1848}, + {"AD1848", 0, 500, "PnP MSS", attach_pnp_ad1848, probe_pnp_ad1848, unload_pnp_ad1848}, #endif - {NULL, 0, "*?*", NULL, NULL, NULL} + {NULL, 0, 0, "*?*", NULL, NULL, NULL} }; + int num_sound_drivers = + sizeof(sound_drivers) / sizeof (struct driver_info); + int max_sound_drivers = + sizeof(sound_drivers) / sizeof (struct driver_info); + #ifndef FULL_SOUND /* @@ -388,7 +397,11 @@ #endif #ifndef EXCLUDE_MSS +# ifdef PSEUDO_MSS {SNDCARD_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE}, +# else + {SNDCARD_PSEUDO_MSS, {MSS_BASE, MSS_IRQ, MSS_DMA, -1}, SND_DEFAULT_ENABLE}, +# endif # ifdef MSS2_BASE {SNDCARD_MSS, {MSS2_BASE, MSS2_IRQ, MSS2_DMA, -1}, SND_DEFAULT_ENABLE}, # endif @@ -460,18 +473,16 @@ int max_sound_cards = 20; #endif - int num_sound_drivers = - sizeof(sound_drivers) / sizeof (struct driver_info); - #else extern struct audio_operations * audio_devs[MAX_AUDIO_DEV]; int num_audiodevs; extern struct mixer_operations * mixer_devs[MAX_MIXER_DEV]; extern int num_mixers; extern struct synth_operations * synth_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV]; extern int num_synths; extern struct midi_operations * midi_devs[MAX_MIDI_DEV]; extern int num_midis; - extern struct sound_timer_operations * sound_timer_devs[MAX_SYNTH_DEV+MAX_MIDI_DEV]; extern int num_sound_timers; + extern struct sound_timer_operations * sound_timer_devs[MAX_TIMER_DEV]; extern int num_sound_timers; extern struct driver_info sound_drivers[]; extern int num_sound_drivers; + extern int max_sound_drivers; extern struct card_info snd_installed_cards[]; extern int num_sound_cards; extern int max_sound_cards; @@ -482,6 +493,7 @@ void sound_chconf(int card_type, int ioaddr, int irq, int dma); int snd_find_driver(int type); void sound_unload_drivers(void); +void sound_unload_driver(int type); int sndtable_identify_card(char *name); void sound_setup (char *str, int *ints); @@ -492,6 +504,10 @@ int sndtable_probe (int unit, struct address_info *hw_config); int sndtable_init_card (int unit, struct address_info *hw_config); void sound_timer_init (struct sound_lowlev_timer *t, char *name); +int sound_start_dma ( int dev, struct dma_buffparms *dmap, int chan, + unsigned long physaddr, + int count, int dma_mode, int autoinit); +void sound_dma_intr (int dev, struct dma_buffparms *dmap, int chan); #endif /* _DEV_TABLE_C_ */ #endif /* _DEV_TABLE_H_ */ diff -u --recursive --new-file v1.3.37/linux/drivers/sound/dmabuf.c linux/drivers/sound/dmabuf.c --- v1.3.37/linux/drivers/sound/dmabuf.c Mon Oct 23 18:02:14 1995 +++ linux/drivers/sound/dmabuf.c Tue Nov 7 10:14:16 1995 @@ -155,16 +155,10 @@ { if (dmap == audio_devs[dev]->dmap_out) { - { - out_sleep_flag[dev].aborting = 0; - out_sleep_flag[dev].mode = WK_NONE; - }; + out_sleep_flag[dev].mode = WK_NONE; } else - { - in_sleep_flag[dev].aborting = 0; - in_sleep_flag[dev].mode = WK_NONE; - }; + in_sleep_flag[dev].mode = WK_NONE; dmap->flags = DMA_BUSY; /* Other flags off */ dmap->qlen = dmap->qhead = dmap->qtail = 0; @@ -341,7 +335,7 @@ save_flags (flags); cli (); - while (!((current->signal & ~current->blocked)) + while (!(current->signal & ~current->blocked) && audio_devs[dev]->dmap_out->qlen) { @@ -349,16 +343,14 @@ unsigned long tl; if (10 * HZ) - tl = current->timeout = jiffies + (10 * HZ); + current->timeout = tl = jiffies + (10 * HZ); else tl = 0xffffffff; out_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&out_sleeper[dev]); if (!(out_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - out_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) out_sleep_flag[dev].mode |= WK_TIMEOUT; } out_sleep_flag[dev].mode &= ~WK_SLEEP; @@ -380,7 +372,7 @@ cli (); if (audio_devs[dev]->local_qlen) /* Device has hidden buffers */ { - while (!(((current->signal & ~current->blocked))) + while (!((current->signal & ~current->blocked)) && audio_devs[dev]->local_qlen (dev)) { @@ -388,16 +380,14 @@ unsigned long tl; if (HZ) - tl = current->timeout = jiffies + (HZ); + current->timeout = tl = jiffies + (HZ); else tl = 0xffffffff; out_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&out_sleeper[dev]); if (!(out_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - out_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) out_sleep_flag[dev].mode |= WK_TIMEOUT; } out_sleep_flag[dev].mode &= ~WK_SLEEP; @@ -414,7 +404,7 @@ { unsigned long flags; - if (!(((current->signal & ~current->blocked))) + if (!((current->signal & ~current->blocked)) && (audio_devs[dev]->dmap_out->dma_mode == DMODE_OUTPUT)) { dma_sync (dev); @@ -495,12 +485,7 @@ save_flags (flags); cli (); - if (audio_devs[dev]->dmap_in->mapping_flags & DMA_MAP_MAPPED) - { - printk ("Sound: Can't read from mmapped device (1)\n"); - return -EINVAL; - } - else if (!dmap->qlen) + if (!dmap->qlen) { int timeout; @@ -535,16 +520,14 @@ unsigned long tl; if (timeout) - tl = current->timeout = jiffies + (timeout); + current->timeout = tl = jiffies + (timeout); else tl = 0xffffffff; in_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&in_sleeper[dev]); if (!(in_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - in_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) in_sleep_flag[dev].mode |= WK_TIMEOUT; } in_sleep_flag[dev].mode &= ~WK_SLEEP; @@ -553,7 +536,7 @@ { printk ("Sound: DMA (input) timed out - IRQ/DRQ config error?\n"); err = EIO; - in_sleep_flag[dev].aborting = 1; + ; } else err = EINTR; @@ -576,12 +559,7 @@ int p = dmap->counts[dmap->qhead] + c; - if (audio_devs[dev]->dmap_in->mapping_flags & DMA_MAP_MAPPED) - { - printk ("Sound: Can't read from mmapped device (2)\n"); - return -EINVAL; - } - else if (p >= dmap->fragment_size) + if (p >= dmap->fragment_size) { /* This buffer is completely empty */ dmap->counts[dmap->qhead] = 0; if (dmap->qlen <= 0 || dmap->qlen > dmap->nbufs) @@ -761,8 +739,6 @@ if (cmd == SNDCTL_DSP_GETISPACE && audio_devs[dev]->flags & DMA_DUPLEX) dmap = dmap_in; - if (dmap->mapping_flags & DMA_MAP_MAPPED) - return -EINVAL; if (!(dmap->flags & DMA_ALLOC_DONE)) reorganize_buffers (dev, dmap); @@ -833,16 +809,6 @@ activate_recording (dev, dmap_in); } - if ((changed & bits) & PCM_ENABLE_OUTPUT && - dmap_out->mapping_flags & DMA_MAP_MAPPED && - audio_devs[dev]->go) - { - if (!(dmap_out->flags & DMA_ALLOC_DONE)) - reorganize_buffers (dev, dmap_out); - - dmap_out->counts[dmap_out->qhead] = dmap_out->fragment_size; - DMAbuf_start_output (dev, 0, dmap_out->fragment_size); - } audio_devs[dev]->enable_bits = bits; if (changed && audio_devs[dev]->trigger) @@ -866,8 +832,6 @@ info.bytes += info.ptr; memcpy_tofs ((&((char *) arg)[0]), (char *) &info, sizeof (info)); - if (audio_devs[dev]->dmap_in->mapping_flags & DMA_MAP_MAPPED) - audio_devs[dev]->dmap_in->qlen = 0; /* Acknowledge interrupts */ restore_flags (flags); return 0; } @@ -886,8 +850,6 @@ info.bytes += info.ptr; memcpy_tofs ((&((char *) arg)[0]), (char *) &info, sizeof (info)); - if (audio_devs[dev]->dmap_out->mapping_flags & DMA_MAP_MAPPED) - audio_devs[dev]->dmap_out->qlen = 0; /* Acknowledge interrupts */ restore_flags (flags); return 0; } @@ -959,11 +921,6 @@ int abort, err = EIO; struct dma_buffparms *dmap = audio_devs[dev]->dmap_out; - if (audio_devs[dev]->dmap_out->mapping_flags & DMA_MAP_MAPPED) - { - printk ("Sound: Can't write to mmapped device (3)\n"); - return -EINVAL; - } if (dmap->dma_mode == DMODE_INPUT) /* Direction change */ { @@ -1026,16 +983,14 @@ unsigned long tl; if (timeout) - tl = current->timeout = jiffies + (timeout); + current->timeout = tl = jiffies + (timeout); else tl = 0xffffffff; out_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&out_sleeper[dev]); if (!(out_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - out_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) out_sleep_flag[dev].mode |= WK_TIMEOUT; } out_sleep_flag[dev].mode &= ~WK_SLEEP; @@ -1045,9 +1000,9 @@ printk ("Sound: DMA (output) timed out - IRQ/DRQ config error?\n"); err = EIO; abort = 1; - out_sleep_flag[dev].aborting = 1; + ; } - else if (((current->signal & ~current->blocked))) + else if ((current->signal & ~current->blocked)) { err = EINTR; abort = 1; @@ -1076,14 +1031,7 @@ * Bypass buffering if using mmaped access */ - if (audio_devs[dev]->dmap_out->mapping_flags & DMA_MAP_MAPPED) - { - l = dmap->fragment_size; - dmap->counts[dmap->qtail] = l; - dmap->flags &= ~DMA_RESTART; - dmap->qtail = (dmap->qtail + 1) % dmap->nbufs; - } - else + if (dmap != NULL) { if (buff_no != dmap->qtail) @@ -1219,35 +1167,11 @@ dmap->byte_counter += dmap->counts[dmap->qhead]; +#ifdef OS_DMA_INTR + sound_dma_intr (dev, audio_devs[dev]->dmap_out, audio_devs[dev]->dmachan1); +#endif - if (dmap->mapping_flags & DMA_MAP_MAPPED) - { - /* mmapped access */ - - int p = dmap->fragment_size * dmap->qhead; - - memset (dmap->raw_buf + p, - dmap->neutral_byte, - dmap->fragment_size); - - dmap->qhead = (dmap->qhead + 1) % dmap->nbufs; - dmap->qlen++; /* Yes increment it (don't decrement) */ - dmap->flags &= ~DMA_ACTIVE; - dmap->counts[dmap->qhead] = dmap->fragment_size; - - if (!(audio_devs[dev]->flags & DMA_AUTOMODE)) - { - audio_devs[dev]->output_block (dev, dmap->raw_buf_phys + - dmap->qhead * dmap->fragment_size, - dmap->counts[dmap->qhead], 1, - !(audio_devs[dev]->flags & DMA_AUTOMODE)); - if (audio_devs[dev]->trigger) - audio_devs[dev]->trigger (dev, - audio_devs[dev]->enable_bits * audio_devs[dev]->go); - } - dmap->flags |= DMA_ACTIVE; - } - else if (event_type != 2) + if (event_type != 2) { if (dmap->qlen <= 0 || dmap->qlen > dmap->nbufs) { @@ -1311,26 +1235,11 @@ dmap->byte_counter += dmap->fragment_size; +#ifdef OS_DMA_INTR + sound_dma_intr (dev, audio_devs[dev]->dmap_in, audio_devs[dev]->dmachan2); +#endif - if (dmap->mapping_flags & DMA_MAP_MAPPED) - { - dmap->qtail = (dmap->qtail + 1) % dmap->nbufs; - dmap->qlen++; - - if (!(audio_devs[dev]->flags & DMA_AUTOMODE)) - { - audio_devs[dev]->start_input (dev, dmap->raw_buf_phys + - dmap->qtail * dmap->fragment_size, - dmap->fragment_size, 1, - !(audio_devs[dev]->flags & DMA_AUTOMODE)); - if (audio_devs[dev]->trigger) - audio_devs[dev]->trigger (dev, - audio_devs[dev]->enable_bits * audio_devs[dev]->go); - } - - dmap->flags |= DMA_ACTIVE; - } - else if (dmap->qlen == (dmap->nbufs - 1)) + if (dmap->qlen == (dmap->nbufs - 1)) { printk ("Sound: Recording overrun\n"); dmap->underrun_count++; @@ -1453,6 +1362,7 @@ case SEL_IN: dmap = audio_devs[dev]->dmap_in; + if (dmap->dma_mode != DMODE_INPUT) { if ((audio_devs[dev]->flags & DMA_DUPLEX) && !dmap->qlen && @@ -1483,6 +1393,8 @@ case SEL_OUT: dmap = audio_devs[dev]->dmap_out; + + if (dmap->dma_mode == DMODE_INPUT) { return 0; diff -u --recursive --new-file v1.3.37/linux/drivers/sound/gus_card.c linux/drivers/sound/gus_card.c --- v1.3.37/linux/drivers/sound/gus_card.c Fri Oct 13 14:44:33 1995 +++ linux/drivers/sound/gus_card.c Tue Nov 7 10:14:17 1995 @@ -144,6 +144,8 @@ void unload_gus (struct address_info *hw_config) { + DDB (printk ("unload_gus(%x)\n", hw_config->io_base)); + gus_wave_unload (); release_region (hw_config->io_base, 16); diff -u --recursive --new-file v1.3.37/linux/drivers/sound/gus_midi.c linux/drivers/sound/gus_midi.c --- v1.3.37/linux/drivers/sound/gus_midi.c Fri Oct 13 14:44:34 1995 +++ linux/drivers/sound/gus_midi.c Tue Nov 7 10:14:17 1995 @@ -81,7 +81,7 @@ } outb (gus_midi_control, u_MidiControl); /* - * Enable + * Enable */ midi_busy = 1; diff -u --recursive --new-file v1.3.37/linux/drivers/sound/gus_wave.c linux/drivers/sound/gus_wave.c --- v1.3.37/linux/drivers/sound/gus_wave.c Mon Oct 23 18:02:14 1995 +++ linux/drivers/sound/gus_wave.c Tue Nov 7 10:14:17 1995 @@ -827,8 +827,8 @@ mix_image &= ~0x02; /* Enable line out */ mix_image |= 0x08; /* Enable IRQ */ outb (mix_image, u_Mixer); /* - * Turn mixer channels on - * Note! Mic in is left off. + * Turn mixer channels on + * Note! Mic in is left off. */ gus_select_voice (0); /* This disables writes to IRQ/DMA reg */ @@ -1484,10 +1484,7 @@ else gus_no_dma = 0; - { - dram_sleep_flag.aborting = 0; - dram_sleep_flag.mode = WK_NONE; - }; + dram_sleep_flag.mode = WK_NONE; gus_busy = 1; active_device = GUS_DEV_WAVE; @@ -1737,16 +1734,14 @@ unsigned long tl; if (HZ) - tl = current->timeout = jiffies + (HZ); + current->timeout = tl = jiffies + (HZ); else tl = 0xffffffff; dram_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&dram_sleeper); if (!(dram_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - dram_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) dram_sleep_flag.mode |= WK_TIMEOUT; } dram_sleep_flag.mode &= ~WK_SLEEP; @@ -2458,8 +2453,8 @@ } else { - int in_left = useroffs / 2; - int in_right = useroffs / 2 + 1; + int in_left = useroffs; + int in_right = useroffs + 2; short *out_left, *out_right; int i; @@ -2471,10 +2466,10 @@ for (i = 0; i < len; i++) { - *out_left++ = get_fs_word (&(((short *) userbuf)[in_left])); - in_left += 2; - *out_right++ = get_fs_word (&(((short *) userbuf)[in_right])); - in_right += 2; + *out_left++ = get_fs_word (&((userbuf)[in_left])); + in_left += 4; + *out_right++ = get_fs_word (&((userbuf)[in_right])); + in_right += 4; } } } diff -u --recursive --new-file v1.3.37/linux/drivers/sound/ics2101.c linux/drivers/sound/ics2101.c --- v1.3.37/linux/drivers/sound/ics2101.c Fri Oct 13 14:44:34 1995 +++ linux/drivers/sound/ics2101.c Tue Nov 7 10:14:17 1995 @@ -37,6 +37,7 @@ SOUND_MASK_SYNTH| \ SOUND_MASK_CD | SOUND_MASK_VOLUME) +extern sound_os_info *gus_osp; extern int gus_base; static int volumes[ICS_MIXDEVS]; static int left_fix[ICS_MIXDEVS] = diff -u --recursive --new-file v1.3.37/linux/drivers/sound/mad16_sb_midi.c linux/drivers/sound/mad16_sb_midi.c --- v1.3.37/linux/drivers/sound/mad16_sb_midi.c Fri Oct 13 14:44:34 1995 +++ linux/drivers/sound/mad16_sb_midi.c Tue Nov 7 10:14:17 1995 @@ -118,12 +118,12 @@ tenmicrosec (); for (loopc = 0; loopc < 1000 && !(inb (DSP_DATA_AVAIL) & 0x80); loopc++); /* - * Wait - * for - * data - * * - * available - * status + * Wait + * for + * data + * * + * available + * status */ if (inb (DSP_READ) != 0xAA) diff -u --recursive --new-file v1.3.37/linux/drivers/sound/maui.c linux/drivers/sound/maui.c --- v1.3.37/linux/drivers/sound/maui.c Mon Oct 23 18:02:14 1995 +++ linux/drivers/sound/maui.c Tue Nov 7 10:14:17 1995 @@ -265,4 +265,5 @@ snd_release_irq (irq); } + #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/midi_synth.c linux/drivers/sound/midi_synth.c --- v1.3.37/linux/drivers/sound/midi_synth.c Mon Oct 23 18:02:14 1995 +++ linux/drivers/sound/midi_synth.c Tue Nov 7 10:14:17 1995 @@ -47,6 +47,9 @@ {0}; static unsigned char prev_out_status[MAX_MIDI_DEV]; +#ifdef EXCLUDE_SEQUENCER +#define STORE(cmd) +#else #define STORE(cmd) \ { \ int len; \ @@ -54,6 +57,8 @@ cmd; \ seq_input_event(obuf, len); \ } +#endif + #define _seqbuf obuf #define _seqbufptr 0 #define _SEQ_ADVBUF(x) len=x @@ -538,12 +543,9 @@ left = sysex.len; src_offs = 0; - { - sysex_sleep_flag.aborting = 0; - sysex_sleep_flag.mode = WK_NONE; - }; + sysex_sleep_flag.mode = WK_NONE; - for (i = 0; i < left && !((current->signal & ~current->blocked)); i++) + for (i = 0; i < left && !(current->signal & ~current->blocked); i++) { unsigned char data; @@ -564,22 +566,20 @@ } while (!midi_devs[orig_dev]->putc (orig_dev, (unsigned char) (data & 0xff)) && - !((current->signal & ~current->blocked))) + !(current->signal & ~current->blocked)) { unsigned long tl; if (1) - tl = current->timeout = jiffies + (1); + current->timeout = tl = jiffies + (1); else tl = 0xffffffff; sysex_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&sysex_sleeper); if (!(sysex_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - sysex_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) sysex_sleep_flag.mode |= WK_TIMEOUT; } sysex_sleep_flag.mode &= ~WK_SLEEP; diff -u --recursive --new-file v1.3.37/linux/drivers/sound/midibuf.c linux/drivers/sound/midibuf.c --- v1.3.37/linux/drivers/sound/midibuf.c Mon Oct 23 18:02:14 1995 +++ linux/drivers/sound/midibuf.c Tue Nov 7 10:14:17 1995 @@ -106,23 +106,21 @@ */ if (midi_devs[dev]->buffer_status != NULL) - while (!((current->signal & ~current->blocked)) && + while (!(current->signal & ~current->blocked) && midi_devs[dev]->buffer_status (dev)) { unsigned long tl; if (HZ / 10) - tl = current->timeout = jiffies + (HZ / 10); + current->timeout = tl = jiffies + (HZ / 10); else tl = 0xffffffff; midi_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&midi_sleeper[dev]); if (!(midi_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - midi_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) midi_sleep_flag[dev].mode |= WK_TIMEOUT; } midi_sleep_flag[dev].mode &= ~WK_SLEEP; @@ -237,14 +235,8 @@ parms[dev].prech_timeout = 0; - { - midi_sleep_flag[dev].aborting = 0; - midi_sleep_flag[dev].mode = WK_NONE; - }; - { - input_sleep_flag[dev].aborting = 0; - input_sleep_flag[dev].mode = WK_NONE; - }; + midi_sleep_flag[dev].mode = WK_NONE; + input_sleep_flag[dev].mode = WK_NONE; midi_in_buf[dev] = (struct midi_buf *) kmalloc (sizeof (struct midi_buf), GFP_KERNEL); @@ -306,23 +298,21 @@ * devices */ - while (!((current->signal & ~current->blocked)) && + while (!(current->signal & ~current->blocked) && DATA_AVAIL (midi_out_buf[dev])) { unsigned long tl; if (0) - tl = current->timeout = jiffies + (0); + current->timeout = tl = jiffies + (0); else tl = 0xffffffff; midi_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&midi_sleeper[dev]); if (!(midi_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - midi_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) midi_sleep_flag[dev].mode |= WK_TIMEOUT; } midi_sleep_flag[dev].mode &= ~WK_SLEEP; @@ -375,21 +365,19 @@ unsigned long tl; if (0) - tl = current->timeout = jiffies + (0); + current->timeout = tl = jiffies + (0); else tl = 0xffffffff; midi_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&midi_sleeper[dev]); if (!(midi_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - midi_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) midi_sleep_flag[dev].mode |= WK_TIMEOUT; } midi_sleep_flag[dev].mode &= ~WK_SLEEP; }; - if (((current->signal & ~current->blocked))) + if ((current->signal & ~current->blocked)) { restore_flags (flags); return -EINTR; @@ -403,7 +391,7 @@ for (i = 0; i < n; i++) { - memcpy_fromfs (&tmp_data, &((buf)[c]), 1); + memcpy_fromfs ((char *) &tmp_data, &((buf)[c]), 1); QUEUE_BYTE (midi_out_buf[dev], tmp_data); c++; } @@ -436,21 +424,19 @@ unsigned long tl; if (parms[dev].prech_timeout) - tl = current->timeout = jiffies + (parms[dev].prech_timeout); + current->timeout = tl = jiffies + (parms[dev].prech_timeout); else tl = 0xffffffff; input_sleep_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&input_sleeper[dev]); if (!(input_sleep_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - input_sleep_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) input_sleep_flag[dev].mode |= WK_TIMEOUT; } input_sleep_flag[dev].mode &= ~WK_SLEEP; }; - if (((current->signal & ~current->blocked))) + if ((current->signal & ~current->blocked)) c = -EINTR; /* * The user is getting restless */ @@ -468,7 +454,7 @@ while (c < n) { REMOVE_BYTE (midi_in_buf[dev], tmp_data); - memcpy_tofs (&((buf)[c]), &tmp_data, 1); + memcpy_tofs (&((buf)[c]), (char *) &tmp_data, 1); c++; } } diff -u --recursive --new-file v1.3.37/linux/drivers/sound/mpu401.c linux/drivers/sound/mpu401.c --- v1.3.37/linux/drivers/sound/mpu401.c Mon Oct 23 18:02:14 1995 +++ linux/drivers/sound/mpu401.c Tue Nov 7 10:14:17 1995 @@ -41,8 +41,12 @@ #include "coproc.h" static int init_sequence[20]; /* NOTE! pos 0 = len, start pos 1. */ + +#ifndef EXCLUDE_SEQUENCER static int timer_mode = TMR_INTERNAL, timer_caps = TMR_INTERNAL; +#endif + struct mpu_config { int base; /* @@ -112,6 +116,7 @@ static int reset_mpu401 (struct mpu_config *devc); static void set_uart_mode (int dev, struct mpu_config *devc, int arg); + static void mpu_timer_init (int midi_dev); static void mpu_timer_interrupt (void); static void timer_ext_event (struct mpu_config *devc, int event, int parm); @@ -148,6 +153,9 @@ 0 /* Fx */ }; +#ifdef EXCLUDE_SEQUENCER +#define STORE(cmd) +#else #define STORE(cmd) \ { \ int len; \ @@ -155,6 +163,8 @@ cmd; \ seq_input_event(obuf, len); \ } +#endif + #define _seqbuf obuf #define _seqbufptr 0 #define _SEQ_ADVBUF(x) len=x @@ -1815,6 +1825,8 @@ } #endif + + #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/opl3.c linux/drivers/sound/opl3.c --- v1.3.37/linux/drivers/sound/opl3.c Mon Oct 23 18:02:16 1995 +++ linux/drivers/sound/opl3.c Tue Nov 7 10:14:17 1995 @@ -229,7 +229,7 @@ tenmicrosec (); stat2 = inb (ioaddr); /* - * Read status after timers have expired + * Read status after timers have expired */ /* @@ -887,7 +887,7 @@ return -EINVAL; } - memcpy_fromfs (&((char *) &ins)[offs], &(((char *) addr)[offs]), sizeof (ins) - offs); + memcpy_fromfs (&((char *) &ins)[offs], &((addr)[offs]), sizeof (ins) - offs); if (ins.channel < 0 || ins.channel >= SBFM_MAXINSTR) { diff -u --recursive --new-file v1.3.37/linux/drivers/sound/os.h linux/drivers/sound/os.h --- v1.3.37/linux/drivers/sound/os.h Mon Oct 23 18:02:16 1995 +++ linux/drivers/sound/os.h Tue Nov 7 12:08:41 1995 @@ -1,14 +1,9 @@ - #define ALLOW_SELECT -#define ALLOW_BUFFER_MAPPING +#undef ALLOW_BUFFER_MAPPING #undef NO_INLINE_ASM #undef SHORT_BANNERS -#ifdef MODULE -#include #include -#include -#endif #include #include @@ -29,6 +24,7 @@ #include #include + #include typedef char snd_rw_buf; @@ -38,7 +34,7 @@ #define TRUE 1 struct snd_wait { - int mode; int aborting; + int mode; }; extern int sound_alloc_dma(int chn, char *deviceID); @@ -50,7 +46,5 @@ extern caddr_t sound_mem_blocks[1024]; extern int sound_num_blocks; - -#define SND_SA_INTERRUPT typedef int sound_os_info; diff -u --recursive --new-file v1.3.37/linux/drivers/sound/pas2_card.c linux/drivers/sound/pas2_card.c --- v1.3.37/linux/drivers/sound/pas2_card.c Fri Oct 13 14:44:34 1995 +++ linux/drivers/sound/pas2_card.c Tue Nov 7 10:14:17 1995 @@ -321,10 +321,10 @@ */ outb (0xBC, MASTER_DECODE); /* - * Talk to first board + * Talk to first board */ outb (hw_config->io_base >> 2, MASTER_DECODE); /* - * Set base address + * Set base address */ translat_code = PAS_DEFAULT_BASE ^ hw_config->io_base; pas_write (1, WAIT_STATE); /* @@ -387,9 +387,6 @@ */ #endif -#ifndef EXCLUDE_YM3812 - enable_opl3_mode (0x388, 0x38a, 0); -#endif #ifndef EXCLUDE_MIDI mem_start = pas_midi_init (mem_start); diff -u --recursive --new-file v1.3.37/linux/drivers/sound/patmgr.c linux/drivers/sound/patmgr.c --- v1.3.37/linux/drivers/sound/patmgr.c Mon Oct 23 18:02:16 1995 +++ linux/drivers/sound/patmgr.c Tue Nov 7 10:14:17 1995 @@ -63,10 +63,7 @@ return -EBUSY; pmgr_opened[dev] = 1; - { - server_wait_flag[dev].aborting = 0; - server_wait_flag[dev].mode = WK_NONE; - }; + server_wait_flag[dev].mode = WK_NONE; return 0; } @@ -105,29 +102,27 @@ return -EIO; } - while (!ok && !((current->signal & ~current->blocked))) + while (!ok && !(current->signal & ~current->blocked)) { save_flags (flags); cli (); while (!(mbox[dev] && msg_direction[dev] == A_TO_S) && - !((current->signal & ~current->blocked))) + !(current->signal & ~current->blocked)) { { unsigned long tl; if (0) - tl = current->timeout = jiffies + (0); + current->timeout = tl = jiffies + (0); else tl = 0xffffffff; server_wait_flag[dev].mode = WK_SLEEP; interruptible_sleep_on (&server_procs[dev]); if (!(server_wait_flag[dev].mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - server_wait_flag[dev].aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) server_wait_flag[dev].mode |= WK_TIMEOUT; } server_wait_flag[dev].mode &= ~WK_SLEEP; @@ -161,7 +156,7 @@ return -EIO; } - memcpy_fromfs (mbox[dev], &((buf)[0]), 4); + memcpy_fromfs ((char *) mbox[dev], &((buf)[0]), 4); if (*(unsigned char *) mbox[dev] == SEQ_FULLSIZE) { @@ -238,16 +233,14 @@ unsigned long tl; if (0) - tl = current->timeout = jiffies + (0); + current->timeout = tl = jiffies + (0); else tl = 0xffffffff; appl_wait_flag.mode = WK_SLEEP; interruptible_sleep_on (&appl_proc); if (!(appl_wait_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - appl_wait_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) appl_wait_flag.mode |= WK_TIMEOUT; } appl_wait_flag.mode &= ~WK_SLEEP; @@ -318,16 +311,14 @@ unsigned long tl; if (0) - tl = current->timeout = jiffies + (0); + current->timeout = tl = jiffies + (0); else tl = 0xffffffff; appl_wait_flag.mode = WK_SLEEP; interruptible_sleep_on (&appl_proc); if (!(appl_wait_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - appl_wait_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) appl_wait_flag.mode |= WK_TIMEOUT; } appl_wait_flag.mode &= ~WK_SLEEP; diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sb16_dsp.c linux/drivers/sound/sb16_dsp.c --- v1.3.37/linux/drivers/sound/sb16_dsp.c Mon Oct 23 18:02:16 1995 +++ linux/drivers/sound/sb16_dsp.c Tue Nov 7 10:14:17 1995 @@ -49,7 +49,7 @@ static int dsp_current_speed = 8000; static int dsp_busy = 0; static int dma16, dma8; -static int trigger_bits = 0x7fffffff; +static int trigger_bits = 0; static unsigned long dsp_count = 0; static int irq_mode = IMODE_NONE; @@ -233,7 +233,7 @@ irq_mode = IMODE_NONE; dsp_busy = 1; - trigger_bits = irq_mode; + trigger_bits = 0; return 0; } @@ -385,6 +385,8 @@ audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8; dsp_count = 0; dsp_cleanup (); + sb_dsp_command (0xd0); /* Halt DMA until trigger() is called */ + trigger_bits = 0; return 0; } @@ -394,12 +396,17 @@ audio_devs[my_dev]->dmachan1 = dsp_16bit ? dma16 : dma8; dsp_count = 0; dsp_cleanup (); + sb_dsp_command (0xd0); /* Halt DMA until trigger() is called */ + trigger_bits = 0; return 0; } static void sb16_dsp_trigger (int dev, int bits) { + if (bits != 0) + bits = 1; + if (bits == trigger_bits) /* No change */ return; @@ -572,7 +579,7 @@ int data; data = inb (DSP_DATA_AVL16); /* - * Interrupt acknowledge + * Interrupt acknowledge */ if (intr_active) diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sb_card.c linux/drivers/sound/sb_card.c --- v1.3.37/linux/drivers/sound/sb_card.c Fri Oct 13 14:44:43 1995 +++ linux/drivers/sound/sb_card.c Tue Nov 7 10:14:17 1995 @@ -34,6 +34,8 @@ #if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_SB) +#include "sb.h" + long attach_sb_card (long mem_start, struct address_info *hw_config) { diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sb_dsp.c linux/drivers/sound/sb_dsp.c --- v1.3.37/linux/drivers/sound/sb_dsp.c Mon Oct 23 18:02:16 1995 +++ linux/drivers/sound/sb_dsp.c Tue Nov 7 10:14:17 1995 @@ -51,6 +51,7 @@ int Jazz16_detected = 0; int sb_no_recording = 0; static int dsp_count = 0; +static int trigger_bits; /* * The DSP channel can be used either for input or output. Variable @@ -514,10 +515,15 @@ static void sb_dsp_trigger (int dev, int bits) { + if (bits == trigger_bits) + return; + if (!bits) sb_dsp_command (0xd0); /* Halt DMA */ else if (bits & sb_irq_mode) sb_dsp_command (0xd4); /* Continue DMA */ + + trigger_bits = bits; } static void @@ -558,6 +564,8 @@ * #channels * changes */ } + trigger_bits = 0; + sb_dsp_command (0xd0); /* Halt DMA */ return 0; } @@ -591,6 +599,8 @@ */ } #endif + trigger_bits = 0; + sb_dsp_command (0xd0); /* Halt DMA */ return 0; } @@ -686,6 +696,7 @@ /* DMAbuf_close_dma (dev); */ sb_free_irq (); + /* sb_dsp_command (0xd4); */ dsp_cleanup (); dsp_speaker (OFF); sb_dsp_busy = 0; @@ -822,14 +833,6 @@ * E-Mail: rvranken@polaris.informatik.uni-essen.de */ - -#ifndef MPU_BASE /* take default values if not specified */ -#define MPU_BASE 0 -#endif -#ifndef MPU_IRQ -#define MPU_IRQ 0 -#endif - unsigned int get_sb_byte (void) { @@ -887,33 +890,35 @@ return val; } -static int -initialize_smw (void) -{ #ifdef SMW_MIDI0001_INCLUDED #include "smw-midi0001.h" #else - unsigned char smw_ucode[1]; - int smw_ucodeLen = 0; +unsigned char *smw_ucode = NULL; +int smw_ucodeLen = 0; #endif - int mp_base = MPU_BASE + 4; /* Microcontroller base */ +static int +initialize_smw (int mpu_base) +{ + + int mp_base = mpu_base + 4; /* Microcontroller base */ int i; unsigned char control; + /* * Reset the microcontroller so that the RAM can be accessed */ - control = inb (MPU_BASE + 7); - outb (control | 3, MPU_BASE + 7); /* Set last two bits to 1 (?) */ - outb ((control & 0xfe) | 2, MPU_BASE + 7); /* xxxxxxx0 resets the mc */ + control = inb (mpu_base + 7); + outb (control | 3, mpu_base + 7); /* Set last two bits to 1 (?) */ + outb ((control & 0xfe) | 2, mpu_base + 7); /* xxxxxxx0 resets the mc */ for (i = 0; i < 300; i++) /* Wait at least 1ms */ tenmicrosec (); - outb (control & 0xfc, MPU_BASE + 7); /* xxxxxx00 enables RAM */ + outb (control & 0xfc, mpu_base + 7); /* xxxxxx00 enables RAM */ /* * Detect microcontroller by probing the 8k RAM area @@ -933,32 +938,32 @@ * There is RAM so assume it's really a SM Wave */ -#ifdef SMW_MIDI0001_INCLUDED - if (smw_ucodeLen != 8192) + if (smw_ucodeLen > 0) { - printk ("\nSM Wave: Invalid microcode (MIDI0001.BIN) length\n"); - return 1; - } - - /* - * Download microcode - */ + if (smw_ucodeLen != 8192) + { + printk ("\nSM Wave: Invalid microcode (MIDI0001.BIN) length\n"); + return 1; + } - for (i = 0; i < 8192; i++) - smw_putmem (mp_base, i, smw_ucode[i]); + /* + * Download microcode + */ - /* - * Verify microcode - */ + for (i = 0; i < 8192; i++) + smw_putmem (mp_base, i, smw_ucode[i]); - for (i = 0; i < 8192; i++) - if (smw_getmem (mp_base, i) != smw_ucode[i]) - { - printk ("SM Wave: Microcode verification failed\n"); - return 0; - } + /* + * Verify microcode + */ -#endif + for (i = 0; i < 8192; i++) + if (smw_getmem (mp_base, i) != smw_ucode[i]) + { + printk ("SM Wave: Microcode verification failed\n"); + return 0; + } + } control = 0; #ifdef SMW_SCSI_IRQ @@ -988,7 +993,7 @@ /* control |= 0x20; Uncomment this if you want to use IRQ7 */ #endif - outb (control | 0x03, MPU_BASE + 7); /* xxxxxx11 restarts */ + outb (control | 0x03, mpu_base + 7); /* xxxxxx11 restarts */ return 1; } @@ -1002,11 +1007,25 @@ {0, 0, 2, 3, 0, 1, 0, 4, 0, 2, 5, 0, 0, 0, 0, 6}, dma_translat[8] = {0, 1, 0, 2, 0, 3, 0, 4}; + struct address_info *mpu_config; + + int mpu_base, mpu_irq; + + if ((mpu_config = sound_getconf (SNDCARD_MPU401))) + { + mpu_base = mpu_config->io_base; + mpu_irq = mpu_config->irq; + } + else + { + mpu_base = mpu_irq = 0; + } + outb (0xAF, 0x201); /* ProSonic/Jazz16 wakeup */ for (x = 0; x < 1000; ++x) /* wait 10 milliseconds */ tenmicrosec (); outb (0x50, 0x201); - outb ((sbc_base & 0x70) | ((MPU_BASE & 0x30) >> 4), 0x201); + outb ((sbc_base & 0x70) | ((mpu_base & 0x30) >> 4), 0x201); if (sb_reset_dsp ()) { /* OK. We have at least a SB */ @@ -1019,13 +1038,17 @@ return 1; if (sb_dsp_command (0xFB) && /* set DMA-channels and Interrupts */ - sb_dsp_command ((dma_translat[JAZZ_DMA16] << 4) | dma_translat[SBC_DMA]) && - sb_dsp_command ((int_translat[MPU_IRQ] << 4) | int_translat[sbc_irq])) + sb_dsp_command ((dma_translat[JAZZ_DMA16] << 4) | dma_translat[dma8]) && + sb_dsp_command ((int_translat[mpu_irq] << 4) | int_translat[sbc_irq])) { Jazz16_detected = 1; + if (mpu_base == 0) + printk ("Jazz16: No MPU401 devices configured - MIDI port not initialized\n"); + #ifdef SM_WAVE - if (initialize_smw ()) - Jazz16_detected = 2; + if (mpu_base != 0) + if (initialize_smw (mpu_base)) + Jazz16_detected = 2; #endif sb_dsp_disable_midi (); } @@ -1182,12 +1205,6 @@ printk ("\n\n\n\nNOTE! SB Pro support is required with your soundcard!\n\n\n"); #endif -#ifndef EXCLUDE_YM3812 - - if (sbc_major > 3 || - (sbc_major == 3 && inb (0x388) == 0x00)) /* Should be 0x06 if not OPL-3 */ - enable_opl3_mode (OPL3_LEFT, OPL3_RIGHT, OPL3_BOTH); -#endif #ifndef EXCLUDE_AUDIO if (sbc_major >= 3) @@ -1290,5 +1307,6 @@ { midi_disabled = 1; } + #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sb_mixer.c linux/drivers/sound/sb_mixer.c --- v1.3.37/linux/drivers/sound/sb_mixer.c Fri Oct 13 14:44:44 1995 +++ linux/drivers/sound/sb_mixer.c Tue Nov 7 10:14:17 1995 @@ -62,7 +62,7 @@ save_flags (flags); cli (); outb ((unsigned char) (port & 0xff), MIXER_ADDR); /* - * Select register + * Select register */ tenmicrosec (); outb ((unsigned char) (value & 0xff), MIXER_DATA); @@ -79,7 +79,7 @@ save_flags (flags); cli (); outb ((unsigned char) (port & 0xff), MIXER_ADDR); /* - * Select register + * Select register */ tenmicrosec (); val = inb (MIXER_DATA); @@ -555,7 +555,7 @@ { supported_devices = SGNXPRO_MIXER_DEVICES; supported_rec_devices = SGNXPRO_RECORDING_DEVICES; - iomap = &sgnxpro_mix[0][0]; + iomap = &sgnxpro_mix; } else #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sequencer.c linux/drivers/sound/sequencer.c --- v1.3.37/linux/drivers/sound/sequencer.c Sun Oct 29 11:38:49 1995 +++ linux/drivers/sound/sequencer.c Tue Nov 7 10:14:17 1995 @@ -29,12 +29,13 @@ #define SEQUENCER_C #include "sound_config.h" -#include "midi_ctrl.h" #ifdef CONFIGURE_SOUNDCARD #ifndef EXCLUDE_SEQUENCER +#include "midi_ctrl.h" + static int sequencer_ok = 0; static struct sound_timer_operations *tmr; static int tmr_no = -1; /* Currently selected timer */ @@ -119,7 +120,7 @@ cli (); if (!iqlen) { - if ((file->filp->f_flags & (O_NONBLOCK) ? + if ((file->flags & (O_NONBLOCK) ? 1 : 0)) { restore_flags (flags); @@ -131,16 +132,14 @@ unsigned long tl; if (pre_event_timeout) - tl = current->timeout = jiffies + (pre_event_timeout); + current->timeout = tl = jiffies + (pre_event_timeout); else tl = 0xffffffff; midi_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&midi_sleeper); if (!(midi_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - midi_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) midi_sleep_flag.mode |= WK_TIMEOUT; } midi_sleep_flag.mode &= ~WK_SLEEP; @@ -156,7 +155,7 @@ while (iqlen && c >= ev_len) { - memcpy_tofs (&((buf)[p]), &iqueue[iqhead * IEV_SZ], ev_len); + memcpy_tofs (&((buf)[p]), (char *) &iqueue[iqhead * IEV_SZ], ev_len); p += ev_len; c -= ev_len; @@ -286,7 +285,7 @@ while (c >= 4) { - memcpy_fromfs (event, &((buf)[p]), 4); + memcpy_fromfs ((char *) event, &((buf)[p]), 4); ev_code = event[0]; if (ev_code == SEQ_FULLSIZE) @@ -324,7 +323,7 @@ return count - c; } - memcpy_fromfs (&event[4], &((buf)[p + 4]), 4); + memcpy_fromfs ((char *) &event[4], &((buf)[p + 4]), 4); } else @@ -366,7 +365,7 @@ } - if (!seq_queue (event, (file->filp->f_flags & (O_NONBLOCK) ? + if (!seq_queue (event, (file->flags & (O_NONBLOCK) ? 1 : 0))) { int processed = count - c; @@ -374,7 +373,7 @@ if (!seq_playing) seq_startplay (); - if (!processed && (file->filp->f_flags & (O_NONBLOCK) ? + if (!processed && (file->flags & (O_NONBLOCK) ? 1 : 0)) return -EAGAIN; else @@ -417,16 +416,14 @@ unsigned long tl; if (0) - tl = current->timeout = jiffies + (0); + current->timeout = tl = jiffies + (0); else tl = 0xffffffff; seq_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&seq_sleeper); if (!(seq_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - seq_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) seq_sleep_flag.mode |= WK_TIMEOUT; } seq_sleep_flag.mode &= ~WK_SLEEP; @@ -1243,14 +1240,8 @@ } sequencer_busy = 1; - { - seq_sleep_flag.aborting = 0; - seq_sleep_flag.mode = WK_NONE; - }; - { - midi_sleep_flag.aborting = 0; - midi_sleep_flag.mode = WK_NONE; - }; + seq_sleep_flag.mode = WK_NONE; + midi_sleep_flag.mode = WK_NONE; output_treshold = SEQ_MAX_QUEUE / 2; for (i = 0; i < num_synths; i++) @@ -1271,7 +1262,7 @@ n = 1; - while (!((current->signal & ~current->blocked)) && n) + while (!(current->signal & ~current->blocked) && n) { n = 0; @@ -1291,16 +1282,14 @@ unsigned long tl; if (HZ / 10) - tl = current->timeout = jiffies + (HZ / 10); + current->timeout = tl = jiffies + (HZ / 10); else tl = 0xffffffff; seq_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&seq_sleeper); if (!(seq_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - seq_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) seq_sleep_flag.mode |= WK_TIMEOUT; } seq_sleep_flag.mode &= ~WK_SLEEP; @@ -1333,9 +1322,9 @@ * * Wait until the queue is empty (if we don't have nonblock) */ - if (mode != OPEN_READ && !(file->filp->f_flags & (O_NONBLOCK) ? + if (mode != OPEN_READ && !(file->flags & (O_NONBLOCK) ? 1 : 0)) - while (!((current->signal & ~current->blocked)) && qlen) + while (!(current->signal & ~current->blocked) && qlen) { seq_sync (); } @@ -1381,7 +1370,7 @@ { unsigned long flags; - if (qlen && !seq_playing && !((current->signal & ~current->blocked))) + if (qlen && !seq_playing && !(current->signal & ~current->blocked)) seq_startplay (); save_flags (flags); @@ -1393,16 +1382,14 @@ unsigned long tl; if (0) - tl = current->timeout = jiffies + (0); + current->timeout = tl = jiffies + (0); else tl = 0xffffffff; seq_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&seq_sleeper); if (!(seq_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - seq_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) seq_sleep_flag.mode |= WK_TIMEOUT; } seq_sleep_flag.mode &= ~WK_SLEEP; @@ -1440,16 +1427,14 @@ unsigned long tl; if (4) - tl = current->timeout = jiffies + (4); + current->timeout = tl = jiffies + (4); else tl = 0xffffffff; seq_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&seq_sleeper); if (!(seq_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - seq_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) seq_sleep_flag.mode |= WK_TIMEOUT; } seq_sleep_flag.mode &= ~WK_SLEEP; @@ -1620,7 +1605,7 @@ if (mode == OPEN_READ) return 0; - while (qlen && !((current->signal & ~current->blocked))) + while (qlen && !(current->signal & ~current->blocked)) seq_sync (); if (qlen) return -EINTR; @@ -2089,58 +2074,6 @@ return mem_start; } - -#else -/* - * Stub version - */ -int -sequencer_read (int dev, struct fileinfo *file, snd_rw_buf * buf, int count) -{ - return -EIO; -} - -int -sequencer_write (int dev, struct fileinfo *file, const snd_rw_buf * buf, int count) -{ - return -EIO; -} - -int -sequencer_open (int dev, struct fileinfo *file) -{ - return -ENXIO; -} - -void -sequencer_release (int dev, struct fileinfo *file) -{ -} -int -sequencer_ioctl (int dev, struct fileinfo *file, - unsigned int cmd, ioctl_arg arg) -{ - return -EIO; -} - -int -sequencer_lseek (int dev, struct fileinfo *file, off_t offset, int orig) -{ - return -EIO; -} - -long -sequencer_init (long mem_start) -{ - return mem_start; -} - -int -sequencer_select (int dev, struct fileinfo *file, int sel_type, select_table * wait) -{ - return -EIO; -} - #endif diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sound_config.h linux/drivers/sound/sound_config.h --- v1.3.37/linux/drivers/sound/sound_config.h Mon Oct 23 18:02:16 1995 +++ linux/drivers/sound/sound_config.h Tue Nov 7 10:14:17 1995 @@ -138,7 +138,8 @@ struct fileinfo { int mode; /* Open mode */ - struct file *filp; /* Reference to file-flags. OS-dependent. */ + int flags; + int dummy; /* Reference to file-flags. OS-dependent. */ }; struct address_info { @@ -151,6 +152,7 @@ int driver_use_1; /* Driver defined field 1 */ int driver_use_2; /* Driver defined field 2 */ sound_os_info *osp; /* OS spesific info */ + int card_subtype; /* Driver spesific. Usually 0 */ }; #define SYNTH_MAX_VOICES 32 diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sound_pnp.c linux/drivers/sound/sound_pnp.c --- v1.3.37/linux/drivers/sound/sound_pnp.c Fri Oct 13 14:44:44 1995 +++ linux/drivers/sound/sound_pnp.c Tue Nov 7 10:14:17 1995 @@ -116,6 +116,7 @@ hw_config.driver_use_1 = 0; hw_config.driver_use_2 = 0; hw_config.osp = NULL; + hw_config.card_subtype = 0; if (sndtable_probe (opl3_driver, &hw_config)) sndtable_init_card (opl3_driver, &hw_config); @@ -133,6 +134,7 @@ hw_config.driver_use_1 = 0; hw_config.driver_use_2 = 0; hw_config.osp = NULL; + hw_config.card_subtype = 0; if (sndtable_probe (wss_driver, &hw_config)) sndtable_init_card (wss_driver, &hw_config); diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sound_switch.c linux/drivers/sound/sound_switch.c --- v1.3.37/linux/drivers/sound/sound_switch.c Mon Oct 23 18:02:16 1995 +++ linux/drivers/sound/sound_switch.c Tue Nov 7 10:14:17 1995 @@ -131,75 +131,83 @@ if (!put_status ("\n\nInstalled drivers: \n")) return; - for (i = 0; i < (num_sound_drivers - 1); i++) - { - if (!put_status ("Type ")) - return; - if (!put_status_int (sound_drivers[i].card_type, 10)) - return; - if (!put_status (": ")) - return; - if (!put_status (sound_drivers[i].name)) - return; + for (i = 0; i < num_sound_drivers; i++) + if (sound_drivers[i].card_type != 0) + { + if (!put_status ("Type ")) + return; + if (!put_status_int (sound_drivers[i].card_type, 10)) + return; + if (!put_status (": ")) + return; + if (!put_status (sound_drivers[i].name)) + return; - if (!put_status ("\n")) - return; - } + if (!put_status ("\n")) + return; + } if (!put_status ("\n\nCard config: \n")) return; - for (i = 0; i < (num_sound_cards - 1); i++) - { - int drv, tmp; + for (i = 0; i < num_sound_cards; i++) + if (snd_installed_cards[i].card_type != 0) + { + int drv, tmp; - if (!snd_installed_cards[i].enabled) - if (!put_status ("(")) - return; + if (!snd_installed_cards[i].enabled) + if (!put_status ("(")) + return; + + /* + * if (!put_status_int(snd_installed_cards[i].card_type, 10)) return; + * if (!put_status (": ")) return; + */ - /* - * if (!put_status_int(snd_installed_cards[i].card_type, 10)) return; - * if (!put_status (": ")) return; - */ + if ((drv = snd_find_driver (snd_installed_cards[i].card_type)) != -1) + if (!put_status (sound_drivers[drv].name)) + return; - if ((drv = snd_find_driver (snd_installed_cards[i].card_type)) != -1) - if (!put_status (sound_drivers[drv].name)) + if (!put_status (" at 0x")) + return; + if (!put_status_int (snd_installed_cards[i].config.io_base, 16)) return; - if (!put_status (" at 0x")) - return; - if (!put_status_int (snd_installed_cards[i].config.io_base, 16)) - return; + if (!put_status (" irq ")) + return; + tmp = snd_installed_cards[i].config.irq; + if (tmp < 0) + tmp = -tmp; + if (!put_status_int (tmp, 10)) + return; - if (!put_status (" irq ")) - return; - tmp = snd_installed_cards[i].config.irq; - if (tmp < 0) - tmp = -tmp; - if (!put_status_int (tmp, 10)) - return; + if (snd_installed_cards[i].config.dma != -1) + { + if (!put_status (" drq ")) + return; + if (!put_status_int (snd_installed_cards[i].config.dma, 10)) + return; + if (snd_installed_cards[i].config.dma2 != -1) + { + if (!put_status (",")) + return; + if (!put_status_int (snd_installed_cards[i].config.dma2, 10)) + return; + } + } - if (snd_installed_cards[i].config.dma != -1) - { - if (!put_status (" drq ")) - return; - if (!put_status_int (snd_installed_cards[i].config.dma, 10)) + if (!snd_installed_cards[i].enabled) + if (!put_status (")")) return; - if (snd_installed_cards[i].config.dma2 != -1) - { - if (!put_status (",")) - return; - if (!put_status_int (snd_installed_cards[i].config.dma2, 10)) - return; - } - } - if (!snd_installed_cards[i].enabled) - if (!put_status (")")) + if (!put_status ("\n")) return; + } - if (!put_status ("\n")) - return; + if (!sound_started) + { + put_status ("\n\n***** Sound driver not started *****\n\n"); + return; } #ifdef EXCLUDE_AUDIO @@ -331,16 +339,20 @@ return read_status (buf, count); break; +#ifndef EXCLUDE_AUDIO case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: return audio_read (dev, file, buf, count); break; +#endif +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_read (dev, file, buf, count); break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: @@ -363,16 +375,20 @@ switch (dev & 0x0f) { +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_write (dev, file, buf, count); break; +#endif +#ifndef EXCLUDE_AUDIO case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: return audio_write (dev, file, buf, count); break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: @@ -415,11 +431,13 @@ return 0; break; +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: if ((retval = sequencer_open (dev, file)) < 0) return retval; break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: @@ -428,12 +446,14 @@ break; #endif +#ifndef EXCLUDE_AUDIO case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: if ((retval = audio_open (dev, file)) < 0) return retval; break; +#endif default: printk ("Invalid minor device %d\n", dev); @@ -464,10 +484,12 @@ case SND_DEV_CTL: break; +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: sequencer_release (dev, file); break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: @@ -475,11 +497,13 @@ break; #endif +#ifndef EXCLUDE_AUDIO case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: audio_release (dev, file); break; +#endif default: printk ("Sound error: Releasing unknown device 0x%02x\n", dev); @@ -503,6 +527,7 @@ switch (dtype) { +#ifndef EXCLUDE_AUDIO case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: @@ -511,6 +536,7 @@ return -ENXIO; return mixer_devs[mixdev]->ioctl (mixdev, cmd, arg); break; +#endif default: return mixer_devs[0]->ioctl (0, cmd, arg); @@ -533,16 +559,20 @@ return mixer_devs[dev]->ioctl (dev, cmd, arg); break; +#ifndef EXCLUDE_SEQUENCER case SND_DEV_SEQ: case SND_DEV_SEQ2: return sequencer_ioctl (dev, file, cmd, arg); break; +#endif +#ifndef EXCLUDE_AUDIO case SND_DEV_DSP: case SND_DEV_DSP16: case SND_DEV_AUDIO: return audio_ioctl (dev, file, cmd, arg); break; +#endif #ifndef EXCLUDE_MIDI case SND_DEV_MIDIN: diff -u --recursive --new-file v1.3.37/linux/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c --- v1.3.37/linux/drivers/sound/soundcard.c Sun Oct 29 11:38:49 1995 +++ linux/drivers/sound/soundcard.c Tue Nov 7 10:14:18 1995 @@ -36,9 +36,14 @@ #include -static int soundcards_installed = 0; /* Number of installed cards */ +#ifndef EXCLUDE_PNP +#include +#endif + static int chrdev_registered = 0; +static int is_unloading = 0; + /* * Table for permanently allocated memory (used when unloading the module) */ @@ -73,6 +78,7 @@ dev = inode->i_rdev; dev = MINOR (dev); + files[dev].flags = file->f_flags; return sound_read_sw (dev, &files[dev], buf, count); } @@ -84,6 +90,7 @@ dev = inode->i_rdev; dev = MINOR (dev); + files[dev].flags = file->f_flags; return sound_write_sw (dev, &files[dev], buf, count); } @@ -100,6 +107,12 @@ int dev, retval; struct fileinfo tmp_file; + if (is_unloading) + { + printk ("Sound: Driver partially removed. Can't open device\n"); + return -EBUSY; + } + dev = inode->i_rdev; dev = MINOR (dev); @@ -110,13 +123,13 @@ } tmp_file.mode = 0; - tmp_file.filp = file; + tmp_file.flags = file->f_flags; - if ((file->f_flags & O_ACCMODE) == O_RDWR) + if ((tmp_file.flags & O_ACCMODE) == O_RDWR) tmp_file.mode = OPEN_READWRITE; - if ((file->f_flags & O_ACCMODE) == O_RDONLY) + if ((tmp_file.flags & O_ACCMODE) == O_RDONLY) tmp_file.mode = OPEN_READ; - if ((file->f_flags & O_ACCMODE) == O_WRONLY) + if ((tmp_file.flags & O_ACCMODE) == O_WRONLY) tmp_file.mode = OPEN_WRITE; if ((retval = sound_open_sw (dev, &tmp_file)) < 0) @@ -137,6 +150,7 @@ dev = inode->i_rdev; dev = MINOR (dev); + files[dev].flags = file->f_flags; sound_release_sw (dev, &files[dev]); #ifdef MODULE @@ -152,26 +166,7 @@ dev = inode->i_rdev; dev = MINOR (dev); - - if (cmd == 1) - { - int i; - - unsigned char *p; - - - if (!audio_devs[dev >> 4]->dmap_out) - return 0; - if (!audio_devs[dev >> 4]->dmap_out->raw_buf) - return 0; - - p = audio_devs[dev >> 4]->dmap_out->raw_buf; - - for (i = 0; i < 256; i++) - printk ("%02x ", p[i]); - printk ("\n"); - return 0; - } + files[dev].flags = file->f_flags; if (cmd & IOC_INOUT) { @@ -208,6 +203,7 @@ dev = inode->i_rdev; dev = MINOR (dev); + files[dev].flags = file->f_flags; DEB (printk ("sound_select(dev=%d, type=0x%x)\n", dev, sel_type)); @@ -241,91 +237,6 @@ return 0; } -static int -sound_mmap (struct inode *inode, struct file *file, struct vm_area_struct *vma) -{ - int dev, dev_class; - unsigned long size; - struct dma_buffparms *dmap = NULL; - - dev = inode->i_rdev; - dev = MINOR (dev); - - dev_class = dev & 0x0f; - dev >>= 4; - - if (dev_class != SND_DEV_DSP && dev_class != SND_DEV_DSP16 && dev_class != SND_DEV_AUDIO) - { - printk ("Sound: mmap() not supported for other than audio devices\n"); - return -EINVAL; - } - - if ((vma->vm_flags & (VM_READ | VM_WRITE)) == (VM_READ | VM_WRITE)) - { - printk ("Sound: Cannot do read/write mmap()\n"); - return -EINVAL; - } - - if (vma->vm_flags & VM_READ) - { - dmap = audio_devs[dev]->dmap_in; - } - else if (vma->vm_flags & VM_WRITE) - { - dmap = audio_devs[dev]->dmap_out; - } - else - { - printk ("Sound: Undefined mmap() access\n"); - return -EINVAL; - } - - if (dmap == NULL) - { - printk ("Sound: mmap() error. dmap == NULL\n"); - return -EIO; - } - - if (dmap->raw_buf == NULL) - { - printk ("Sound: mmap() called when raw_buf == NULL\n"); - return -EIO; - } - - if (dmap->mapping_flags) - { - printk ("Sound: mmap() called twice for the same DMA buffer\n"); - return -EIO; - } - - if (vma->vm_offset != 0) - { - printk ("Sound: mmap() offset must be 0.\n"); - return -EINVAL; - } - - size = vma->vm_end - vma->vm_start; - - if (size != dmap->bytes_in_use) - { - printk ("Sound: mmap() size = %ld. Should be %d\n", - size, dmap->bytes_in_use); - } - - if (remap_page_range (vma->vm_start, dmap->raw_buf_phys, vma->vm_end - vma->vm_start, vma->vm_page_prot)) - return -EAGAIN; - - - vma->vm_inode = inode; - inode->i_count++; - - dmap->mapping_flags |= DMA_MAP_MAPPED; - - memset (dmap->raw_buf, - dmap->neutral_byte, - dmap->bytes_in_use); - return 0; -} static struct file_operations sound_fops = { @@ -335,7 +246,7 @@ NULL, /* sound_readdir */ sound_select, sound_ioctl, - sound_mmap, + NULL, sound_open, sound_release }; @@ -352,7 +263,12 @@ sndtable_init (0); /* Initialize call tables and * detect cards */ - if (!(soundcards_installed = sndtable_get_cardcount ())) + +#ifndef EXCLUDE_PNP + sound_pnp_init (); +#endif + + if (sndtable_get_cardcount () == 0) return; /* No cards detected */ #ifndef EXCLUDE_AUDIO @@ -408,6 +324,12 @@ int ints[21]; int i; + if (0 < 0) + { + printk ("Sound: Incompatible kernel (wrapper) version\n"); + return -EINVAL; + } + /* * "sound=" command line handling by Harald Milz. */ @@ -436,6 +358,8 @@ } #ifdef MODULE + + void cleanup_module (void) { @@ -448,7 +372,9 @@ if (chrdev_registered) unregister_chrdev (SOUND_MAJOR, "sound"); +#ifndef EXCLUDE_SEQUENCER sound_stop_timer (); +#endif sound_unload_drivers (); for (i = 0; i < sound_num_blocks; i++) @@ -463,6 +389,10 @@ sound_free_dma (i); } +#ifndef EXCLUDE_PNP + sound_pnp_disconnect (); +#endif + } } #endif @@ -585,13 +515,12 @@ }; } -#endif - void sound_stop_timer (void) { del_timer (&seq_timer);; } +#endif #ifndef EXCLUDE_AUDIO @@ -667,7 +596,7 @@ if (((long) start_addr & ~(dma_pagesize - 1)) != ((long) end_addr & ~(dma_pagesize - 1)) - || end_addr >= (char *) MAX_DMA_ADDRESS) + || end_addr >= (char *) (MAX_DMA_ADDRESS)) { printk ( "sound: kmalloc returned invalid address 0x%lx for %ld Bytes DMA-buffer\n", @@ -677,15 +606,13 @@ } } dmap->raw_buf = start_addr; - dmap->raw_buf_phys = virt_to_bus((unsigned long) start_addr); + dmap->raw_buf_phys = virt_to_phys (start_addr); + + memset (dmap->raw_buf, 0x00, audio_devs[dev]->buffsize); for (i = MAP_NR (start_addr); i <= MAP_NR (end_addr); i++) { -#ifdef MAP_PAGE_RESERVED - mem_map[i] |= MAP_PAGE_RESERVED; -#else mem_map[i].reserved = 1; -#endif } return 0; @@ -709,12 +636,9 @@ for (i = MAP_NR (start_addr); i <= MAP_NR (end_addr); i++) { -#ifdef MAP_PAGE_RESERVED - mem_map[i] &= ~MAP_PAGE_RESERVED; -#else mem_map[i].reserved = 0; -#endif } + free_pages ((unsigned long) dmap->raw_buf, sz); } dmap->raw_buf = NULL; diff -u --recursive --new-file v1.3.37/linux/drivers/sound/soundvers.h linux/drivers/sound/soundvers.h --- v1.3.37/linux/drivers/sound/soundvers.h Fri Oct 13 14:44:44 1995 +++ linux/drivers/sound/soundvers.h Tue Nov 7 10:14:18 1995 @@ -1 +1,2 @@ -#define SOUND_VERSION_STRING "3.5-alpha1-951002" +#define SOUND_VERSION_STRING "3.5-alpha5-951002" +#define SOUND_INTERNAL_VERSION 0x030505 diff -u --recursive --new-file v1.3.37/linux/drivers/sound/sscape.c linux/drivers/sound/sscape.c --- v1.3.37/linux/drivers/sound/sscape.c Mon Oct 23 18:02:17 1995 +++ linux/drivers/sound/sscape.c Tue Nov 7 10:14:18 1995 @@ -449,10 +449,7 @@ #endif devc->dma_allocated = 0; } - { - sscape_sleep_flag.aborting = 0; - sscape_sleep_flag.mode = WK_NONE; - }; + sscape_sleep_flag.mode = WK_NONE; restore_flags (flags); return; @@ -514,10 +511,7 @@ /* * Wait until transfer completes. */ - { - sscape_sleep_flag.aborting = 0; - sscape_sleep_flag.mode = WK_NONE; - }; + sscape_sleep_flag.mode = WK_NONE; done = 0; timeout_val = 100; while (!done && timeout_val-- > 0) @@ -529,16 +523,14 @@ unsigned long tl; if (1) - tl = current->timeout = jiffies + (1); + current->timeout = tl = jiffies + (1); else tl = 0xffffffff; sscape_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&sscape_sleeper); if (!(sscape_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - sscape_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) sscape_sleep_flag.mode |= WK_TIMEOUT; } sscape_sleep_flag.mode &= ~WK_SLEEP; @@ -579,16 +571,14 @@ unsigned long tl; if (1) - tl = current->timeout = jiffies + (1); + current->timeout = tl = jiffies + (1); else tl = 0xffffffff; sscape_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&sscape_sleeper); if (!(sscape_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - sscape_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) sscape_sleep_flag.mode |= WK_TIMEOUT; } sscape_sleep_flag.mode &= ~WK_SLEEP; @@ -614,16 +604,14 @@ unsigned long tl; if (1) - tl = current->timeout = jiffies + (1); + current->timeout = tl = jiffies + (1); else tl = 0xffffffff; sscape_sleep_flag.mode = WK_SLEEP; interruptible_sleep_on (&sscape_sleeper); if (!(sscape_sleep_flag.mode & WK_WAKEUP)) { - if (current->signal & ~current->blocked) - sscape_sleep_flag.aborting = 1; - else if (jiffies >= tl) + if (jiffies >= tl) sscape_sleep_flag.mode |= WK_TIMEOUT; } sscape_sleep_flag.mode &= ~WK_SLEEP; diff -u --recursive --new-file v1.3.37/linux/fs/nfs/rpcsock.c linux/fs/nfs/rpcsock.c --- v1.3.37/linux/fs/nfs/rpcsock.c Mon Oct 23 18:02:17 1995 +++ linux/fs/nfs/rpcsock.c Mon Nov 6 12:59:00 1995 @@ -80,17 +80,16 @@ } static inline int -rpc_sendto(struct rpc_sock *rsock, const int *buf, int len, - struct sockaddr *sap, int salen) +rpc_sendmsg(struct rpc_sock *rsock, struct msghdr *msg, int len) { struct socket *sock = rsock->sock; unsigned long oldfs; int result; - dprintk("RPC: sending %d bytes (buf %08lx)\n", len, (long) buf); + dprintk("RPC: sending %d bytes (buf %p)\n", len, msg->msg_iov[0].iov_base); oldfs = get_fs(); set_fs(get_ds()); - result = sock->ops->sendto(sock, buf, len, 0, 0, sap, salen); + result = sock->ops->sendmsg(sock, msg, len, 0, 0); set_fs(oldfs); dprintk("RPC: result = %d\n", result); @@ -129,8 +128,7 @@ } static inline int -rpc_recvfrom(struct rpc_sock *rsock, int *buf, int len, - struct sockaddr *sap, int salen, int flags) +rpc_recvmsg(struct rpc_sock *rsock, struct msghdr *msg, int len,int flags) { struct socket *sock = rsock->sock; struct sockaddr sa; @@ -138,10 +136,10 @@ unsigned long oldfs; int result; - dprintk("RPC: receiving %d bytes max (buf %08lx)\n", len, (long) buf); + dprintk("RPC: receiving %d bytes max (buf %p)\n", len, msg->msg_iov[0].iov_base); oldfs = get_fs(); set_fs(get_ds()); - result = sock->ops->recvfrom(sock, buf, len, 1, flags, &sa, &alen); + result = sock->ops->recvmsg(sock, msg, len, 1, flags, &alen); set_fs(oldfs); dprintk("RPC: result = %d\n", result); @@ -167,6 +165,16 @@ int result; u32 xid; int safe; + struct msghdr msg; + struct iovec iov; + + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_name = (void *)sap; + msg.msg_namelen = salen; + msg.msg_accrights = NULL; + iov.iov_base = (void *)sndbuf; + iov.iov_len = slen; dprintk("RPC: placing one call, rsock = %08lx, slot = %08lx, " "sap = %08lx, salen = %d, " @@ -174,7 +182,7 @@ (long) rsock, (long) slot, (long) sap, salen, (long) sndbuf, slen, (long) rcvbuf, rlen); - result = rpc_sendto(rsock, sndbuf, slen, sap, salen); + result = rpc_sendmsg(rsock, &msg, slen); if (result < 0) return result; @@ -200,8 +208,10 @@ break; } - result = rpc_recvfrom(rsock, (int *)&xid, sizeof(xid), - sap, salen, MSG_PEEK); + iov.iov_base=(void *)&xid; + iov.iov_len=sizeof(xid); + + result = rpc_recvmsg(rsock, &msg, sizeof(xid), MSG_PEEK); if (result < 0) { switch (-result) { case EAGAIN: case ECONNREFUSED: @@ -228,15 +238,19 @@ if (!rovr || rovr->gotit) { /* bad XID or duplicate reply, discard dgram */ dprintk("RPC: bad XID or duplicate reply.\n"); - rpc_recvfrom(rsock, (int *)&xid, sizeof(xid), - sap, salen, 0); + iov.iov_base=(void *)&xid; + iov.iov_len=sizeof(xid); + rpc_recvmsg(rsock, &msg, sizeof(xid),0); continue; } rovr->gotit = 1; /* Now receive the reply */ - result = rpc_recvfrom(rsock, rovr->buf, rovr->len, - sap, salen, 0); + + iov.iov_base=rovr->buf; + iov.iov_len=rovr->len; + + result = rpc_recvmsg(rsock, &msg, rovr->len, 0); /* If this is not for ourselves, wake up the caller */ if (rovr != slot) diff -u --recursive --new-file v1.3.37/linux/fs/proc/inode.c linux/fs/proc/inode.c --- v1.3.37/linux/fs/proc/inode.c Mon Sep 18 14:54:07 1995 +++ linux/fs/proc/inode.c Mon Oct 30 08:28:32 1995 @@ -12,7 +12,6 @@ #include #include #include -#include #include #include diff -u --recursive --new-file v1.3.37/linux/fs/proc/net.c linux/fs/proc/net.c --- v1.3.37/linux/fs/proc/net.c Mon Aug 28 14:52:22 1995 +++ linux/fs/proc/net.c Mon Oct 30 08:28:50 1995 @@ -33,7 +33,6 @@ #include #include #include -#include #include #define PROC_BLOCK_SIZE (3*1024) /* 4K page size but our output routines use some slack for overruns */ diff -u --recursive --new-file v1.3.37/linux/fs/proc/scsi.c linux/fs/proc/scsi.c --- v1.3.37/linux/fs/proc/scsi.c Mon Sep 18 14:54:08 1995 +++ linux/fs/proc/scsi.c Mon Oct 30 08:29:04 1995 @@ -26,7 +26,6 @@ #include #include #include -#include #include /* forward references */ diff -u --recursive --new-file v1.3.37/linux/fs/smbfs/dir.c linux/fs/smbfs/dir.c --- v1.3.37/linux/fs/smbfs/dir.c Sat Sep 9 15:26:53 1995 +++ linux/fs/smbfs/dir.c Mon Oct 30 08:29:27 1995 @@ -5,11 +5,7 @@ * */ -#include -#ifdef MODULE #include -#include -#endif #include #include diff -u --recursive --new-file v1.3.37/linux/fs/smbfs/file.c linux/fs/smbfs/file.c --- v1.3.37/linux/fs/smbfs/file.c Mon Aug 28 14:52:22 1995 +++ linux/fs/smbfs/file.c Mon Oct 30 08:30:02 1995 @@ -5,11 +5,7 @@ * */ -#include -#ifdef MODULE #include -#include -#endif #include #include diff -u --recursive --new-file v1.3.37/linux/fs/smbfs/inode.c linux/fs/smbfs/inode.c --- v1.3.37/linux/fs/smbfs/inode.c Mon Sep 18 14:54:08 1995 +++ linux/fs/smbfs/inode.c Mon Oct 30 08:29:44 1995 @@ -5,14 +5,7 @@ * */ -#include -#ifdef MODULE #include -#include -#else -#define MOD_INC_USE_COUNT -#define MOD_DEC_USE_COUNT -#endif #include #include diff -u --recursive --new-file v1.3.37/linux/fs/smbfs/ioctl.c linux/fs/smbfs/ioctl.c --- v1.3.37/linux/fs/smbfs/ioctl.c Fri Jul 7 08:54:52 1995 +++ linux/fs/smbfs/ioctl.c Mon Oct 30 08:30:45 1995 @@ -4,14 +4,7 @@ * Copyright (C) 1995 by Volker Lendecke * */ -#include -#ifdef MODULE #include -#include -#else -#define MOD_INC_USE_COUNT -#define MOD_DEC_USE_COUNT -#endif #include #include diff -u --recursive --new-file v1.3.37/linux/fs/smbfs/mmap.c linux/fs/smbfs/mmap.c --- v1.3.37/linux/fs/smbfs/mmap.c Fri Jul 7 08:54:52 1995 +++ linux/fs/smbfs/mmap.c Mon Oct 30 08:30:59 1995 @@ -5,11 +5,7 @@ * */ -#include -#ifdef MODULE #include -#include -#endif #include #include diff -u --recursive --new-file v1.3.37/linux/fs/smbfs/proc.c linux/fs/smbfs/proc.c --- v1.3.37/linux/fs/smbfs/proc.c Mon Aug 28 14:52:22 1995 +++ linux/fs/smbfs/proc.c Mon Oct 30 08:30:29 1995 @@ -5,12 +5,7 @@ * */ -#include -#ifdef MODULE #include -#include -#endif - #include #include diff -u --recursive --new-file v1.3.37/linux/fs/smbfs/sock.c linux/fs/smbfs/sock.c --- v1.3.37/linux/fs/smbfs/sock.c Mon Aug 28 14:52:22 1995 +++ linux/fs/smbfs/sock.c Mon Oct 30 08:31:12 1995 @@ -5,11 +5,7 @@ * */ -#include -#ifdef MODULE #include -#include -#endif #include #include diff -u --recursive --new-file v1.3.37/linux/include/asm-alpha/apecs.h linux/include/asm-alpha/apecs.h --- v1.3.37/linux/include/asm-alpha/apecs.h Fri Oct 6 14:35:16 1995 +++ linux/include/asm-alpha/apecs.h Tue Nov 7 09:18:35 1995 @@ -306,42 +306,14 @@ *(vuip) (addr + APECS_DENSE_MEM) = b; } -/* - * Most of the above have so much overhead that it probably doesn't - * make sense to have them inlined (better icache behavior). - */ -extern unsigned int inb(unsigned long addr); -extern unsigned int inw(unsigned long addr); -extern unsigned int inl(unsigned long addr); - -extern void outb(unsigned char b, unsigned long addr); -extern void outw(unsigned short b, unsigned long addr); -extern void outl(unsigned int b, unsigned long addr); - -extern unsigned long readb(unsigned long addr); -extern unsigned long readw(unsigned long addr); - -extern void writeb(unsigned char b, unsigned long addr); -extern void writew(unsigned short b, unsigned long addr); - #define inb(port) \ -(__builtin_constant_p((port))?__inb(port):(inb)(port)) +(__builtin_constant_p((port))?__inb(port):_inb(port)) #define outb(x, port) \ -(__builtin_constant_p((port))?__outb((x),(port)):(outb)((x),(port))) - -#define inb_p inb -#define outb_p outb - -extern inline unsigned long readl(unsigned long addr) -{ - return __readl(addr); -} +(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port))) -extern inline void writel(unsigned int b, unsigned long addr) -{ - __writel(b, addr); -} +#define readl(a) __readl((unsigned long)(a)) +#define writel(v,a) __writel((v),(unsigned long)(a)) #undef vuip diff -u --recursive --new-file v1.3.37/linux/include/asm-alpha/errno.h linux/include/asm-alpha/errno.h --- v1.3.37/linux/include/asm-alpha/errno.h Fri Jun 2 13:51:16 1995 +++ linux/include/asm-alpha/errno.h Tue Nov 7 09:18:35 1995 @@ -91,44 +91,47 @@ #define EILSEQ 116 /* Illegal byte sequence */ /* The following are just random noise.. */ -#define ECHRNG 44 /* Channel number out of range */ -#define EL2NSYNC 45 /* Level 2 not synchronized */ -#define EL3HLT 46 /* Level 3 halted */ -#define EL3RST 47 /* Level 3 reset */ -#define ELNRNG 48 /* Link number out of range */ -#define EUNATCH 49 /* Protocol driver not attached */ -#define ENOCSI 50 /* No CSI structure available */ -#define EL2HLT 51 /* Level 2 halted */ -#define EBADE 52 /* Invalid exchange */ -#define EBADR 53 /* Invalid request descriptor */ -#define EXFULL 54 /* Exchange full */ -#define ENOANO 55 /* No anode */ -#define EBADRQC 56 /* Invalid request code */ -#define EBADSLT 57 /* Invalid slot */ -#define EDEADLOCK 58 /* File locking deadlock error */ -#define EBFONT 59 /* Bad font file format */ -#define ENONET 64 /* Machine is not on the network */ -#define ENOLINK 67 /* Link has been severed */ -#define EADV 68 /* Advertise error */ -#define ESRMNT 69 /* Srmount error */ -#define ECOMM 70 /* Communication error on send */ -#define EMULTIHOP 72 /* Multihop attempted */ -#define EDOTDOT 73 /* RFS specific error */ -#define EOVERFLOW 75 /* Value too large for defined data type */ -#define ENOTUNIQ 76 /* Name not unique on network */ -#define EBADFD 77 /* File descriptor in bad state */ -#define EREMCHG 78 /* Remote address changed */ -#define ELIBACC 79 /* Can not access a needed shared library */ -#define ELIBBAD 80 /* Accessing a corrupted shared library */ -#define ELIBSCN 81 /* .lib section in a.out corrupted */ -#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ -#define ELIBEXEC 83 /* Cannot exec a shared library directly */ -#define ERESTART 85 /* Interrupted system call should be restarted */ -#define ESTRPIPE 86 /* Streams pipe error */ +#define ECHRNG 88 /* Channel number out of range */ +#define EL2NSYNC 89 /* Level 2 not synchronized */ +#define EL3HLT 90 /* Level 3 halted */ +#define EL3RST 91 /* Level 3 reset */ + +#define ELNRNG 93 /* Link number out of range */ +#define EUNATCH 94 /* Protocol driver not attached */ +#define ENOCSI 95 /* No CSI structure available */ +#define EL2HLT 96 /* Level 2 halted */ +#define EBADE 97 /* Invalid exchange */ +#define EBADR 98 /* Invalid request descriptor */ +#define EXFULL 99 /* Exchange full */ +#define ENOANO 100 /* No anode */ +#define EBADRQC 101 /* Invalid request code */ +#define EBADSLT 102 /* Invalid slot */ +#define EDEADLOCK 103 /* File locking deadlock error */ +#define EBFONT 104 /* Bad font file format */ +#define ENONET 105 /* Machine is not on the network */ +#define ENOLINK 106 /* Link has been severed */ +#define EADV 107 /* Advertise error */ +#define ESRMNT 108 /* Srmount error */ +#define ECOMM 109 /* Communication error on send */ +#define EMULTIHOP 110 /* Multihop attempted */ +#define EDOTDOT 111 /* RFS specific error */ +#define EOVERFLOW 112 /* Value too large for defined data type */ +#define ENOTUNIQ 113 /* Name not unique on network */ +#define EBADFD 114 /* File descriptor in bad state */ +#define EREMCHG 115 /* Remote address changed */ + #define EUCLEAN 117 /* Structure needs cleaning */ #define ENOTNAM 118 /* Not a XENIX named type file */ #define ENAVAIL 119 /* No XENIX semaphores available */ #define EISNAM 120 /* Is a named type file */ #define EREMOTEIO 121 /* Remote I/O error */ + +#define ELIBACC 122 /* Can not access a needed shared library */ +#define ELIBBAD 123 /* Accessing a corrupted shared library */ +#define ELIBSCN 124 /* .lib section in a.out corrupted */ +#define ELIBMAX 125 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 126 /* Cannot exec a shared library directly */ +#define ERESTART 127 /* Interrupted system call should be restarted */ +#define ESTRPIPE 128 /* Streams pipe error */ #endif diff -u --recursive --new-file v1.3.37/linux/include/asm-alpha/io.h linux/include/asm-alpha/io.h --- v1.3.37/linux/include/asm-alpha/io.h Sun Oct 29 11:38:49 1995 +++ linux/include/asm-alpha/io.h Tue Nov 7 09:18:35 1995 @@ -63,28 +63,11 @@ */ extern void __sethae (unsigned long addr); /* syscall */ extern void _sethae (unsigned long addr); /* cached version */ -extern unsigned int _inb (unsigned long port); -extern unsigned int _inw (unsigned long port); -extern unsigned int _inl (unsigned long port); -extern void _outb (unsigned char b,unsigned long port); -extern void _outw (unsigned short w,unsigned long port); -extern void _outl (unsigned int l,unsigned long port); - -#ifndef inb -# define inb(p) _inb((p)) -# define inw(p) _inw((p)) -# define inl(p) _inl((p)) -# define outb(b,p) _outb((b),(p)) -# define outw(w,p) _outw((w),(p)) -# define outl(l,p) _outl((l),(p)) -#endif #endif /* !__KERNEL__ */ /* - * There are different version of the alpha motherboards: the - * "interesting" (read: slightly braindead) Jensen type hardware - * and the PCI version + * There are different version of the Alpha PC motherboards: */ #if defined(CONFIG_ALPHA_LCA) # include /* get chip-specific definitions */ @@ -94,6 +77,80 @@ # include #endif +/* + * The convention used for inb/outb etc. is that names starting with + * two underscores are the inline versions, names starting with a + * single underscore are proper functions, and names starting with a + * letter are macros that map in some way to inline or proper function + * versions. Not all that pretty, but before you change it, be sure + * to convince yourself that it won't break anything (in particular + * module support). + */ +extern unsigned int _inb (unsigned long port); +extern unsigned int _inw (unsigned long port); +extern unsigned int _inl (unsigned long port); +extern void _outb (unsigned char b,unsigned long port); +extern void _outw (unsigned short w,unsigned long port); +extern void _outl (unsigned int l,unsigned long port); +extern unsigned long _readb(unsigned long addr); +extern unsigned long _readw(unsigned long addr); +extern void _writeb(unsigned char b, unsigned long addr); +extern void _writew(unsigned short b, unsigned long addr); + +/* + * The platform header files may define some of these macros to use + * the inlined versions where appropriate. These macros may also be + * redefined by userlevel programs. + */ +#ifndef inb +# define inb(p) _inb((p)) +#endif +#ifndef inw +# define inw(p) _inw((p)) +#endif +#ifndef inl +# define inl(p) _inl((p)) +#endif +#ifndef outb +# define outb(b,p) _outb((b),(p)) +#endif +#ifndef outw +# define outw(w,p) _outw((w),(p)) +#endif +#ifndef outl +# define outl(l,p) _outl((l),(p)) +#endif + +#ifndef inb_p +# define inb_p inb +#endif +#ifndef outb_p +# define outb_p outb +#endif + +/* + * The "address" in IO memory space is not clearly either a integer or a + * pointer. We will accept both, thus the casts. + */ +#ifndef readb +# define readb(a) _readb((unsigned long)(a)) +#endif +#ifndef readw +# define readw(a) _readw((unsigned long)(a)) +#endif +#ifndef readl +# define readl(a) _readl((unsigned long)(a)) +#endif +#ifndef writeb +# define writeb(v,a) _writeb((v),(unsigned long)(a)) +#endif +#ifndef writew +# define writew(v,a) _writew((v),(unsigned long)(a)) +#endif +#ifndef writel +# define writel(v,a) _writel((v),(unsigned long)(a)) +#endif + #ifdef __KERNEL__ /* @@ -112,22 +169,6 @@ extern void outsb (unsigned long port, void *dst, unsigned long count); extern void outsw (unsigned long port, void *dst, unsigned long count); extern void outsl (unsigned long port, void *dst, unsigned long count); - -/* - * The "address" in IO memory space is not clearly either a integer or a - * pointer. We will accept both, thus the casts. - */ -#define readb(addr) ((unsigned char) (readb)((unsigned long)(addr))) -#define readw(addr) ((unsigned short) (readw)((unsigned long)(addr))) -#define readl(addr) ((unsigned int) (readl)((unsigned long)(addr))) - -#define writeb(b,addr) (writeb)((b),(unsigned long)(addr)) -#define writew(w,addr) (writew)((w),(unsigned long)(addr)) -#define writel(l,addr) (writel)((l),(unsigned long)(addr)) - -#define memset_io(addr,c,len) (memset_io)((unsigned long)(addr),(c),(len)) -#define memcpy_fromio(to,from,len) (memcpy_fromio)((to),(unsigned long)(from),(len)) -#define memcpy_toio(to,from,len) (memcpy_toio)((unsigned long)(to),(from),(len)) /* * XXX - We don't have csum_partial_copy_fromio() yet, so we cheat here and diff -u --recursive --new-file v1.3.37/linux/include/asm-alpha/jensen.h linux/include/asm-alpha/jensen.h --- v1.3.37/linux/include/asm-alpha/jensen.h Fri Jul 7 08:54:53 1995 +++ linux/include/asm-alpha/jensen.h Tue Nov 7 09:18:36 1995 @@ -118,8 +118,9 @@ mb(); } -extern unsigned int __bus_inb(unsigned long addr); -extern inline unsigned int ___bus_inb(unsigned long addr) +extern unsigned int _bus_inb(unsigned long addr); + +extern inline unsigned int __bus_inb(unsigned long addr) { long result; @@ -129,8 +130,9 @@ return 0xffUL & result; } -extern void __bus_outb(unsigned char b, unsigned long addr); -extern inline void ___bus_outb(unsigned char b, unsigned long addr) +extern void _bus_outb(unsigned char b, unsigned long addr); + +extern inline void __bus_outb(unsigned char b, unsigned long addr) { __set_hae(0); *(volatile unsigned int *) ((addr << 7) + EISA_IO + 0x00) = b * 0x01010101; @@ -153,7 +155,7 @@ { if (__is_local(addr)) return __local_inb(addr); - return __bus_inb(addr); + return _bus_inb(addr); } extern inline void __outb(unsigned char b, unsigned long addr) @@ -161,7 +163,7 @@ if (__is_local(addr)) __local_outb(b, addr); else - __bus_outb(b, addr); + _bus_outb(b, addr); } extern inline unsigned int __inw(unsigned long addr) @@ -251,30 +253,11 @@ * The above have so much overhead that it probably doesn't make * sense to have them inlined (better icache behaviour). */ -extern unsigned int inb(unsigned long addr); -extern unsigned int inw(unsigned long addr); -extern unsigned int inl(unsigned long addr); - -extern void outb(unsigned char b, unsigned long addr); -extern void outw(unsigned short b, unsigned long addr); -extern void outl(unsigned int b, unsigned long addr); - -extern unsigned long readb(unsigned long addr); -extern unsigned long readw(unsigned long addr); -extern unsigned long readl(unsigned long addr); - -extern void writeb(unsigned char b, unsigned long addr); -extern void writew(unsigned short b, unsigned long addr); -extern void writel(unsigned int b, unsigned long addr); - #define inb(port) \ -(__builtin_constant_p((port))?__inb(port):(inb)(port)) +(__builtin_constant_p((port))?__inb(port):_inb(port)) #define outb(x, port) \ -(__builtin_constant_p((port))?__outb((x),(port)):(outb)((x),(port))) - -#define inb_p inb -#define outb_p outb +(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port))) /* * The Alpha Jensen hardware for some rather strange reason puts diff -u --recursive --new-file v1.3.37/linux/include/asm-alpha/lca.h linux/include/asm-alpha/lca.h --- v1.3.37/linux/include/asm-alpha/lca.h Sun Oct 29 11:38:49 1995 +++ linux/include/asm-alpha/lca.h Tue Nov 7 09:18:36 1995 @@ -287,38 +287,15 @@ * Most of the above have so much overhead that it probably doesn't * make sense to have them inlined (better icache behavior). */ -extern unsigned int inb(unsigned long addr); -extern unsigned int inw(unsigned long addr); -extern unsigned int inl(unsigned long addr); - -extern void outb(unsigned char b, unsigned long addr); -extern void outw(unsigned short b, unsigned long addr); -extern void outl(unsigned int b, unsigned long addr); - -extern unsigned long readb(unsigned long addr); -extern unsigned long readw(unsigned long addr); - -extern void writeb(unsigned char b, unsigned long addr); -extern void writew(unsigned short b, unsigned long addr); #define inb(port) \ -(__builtin_constant_p((port))?__inb(port):(inb)(port)) +(__builtin_constant_p((port))?__inb(port):_inb(port)) #define outb(x, port) \ -(__builtin_constant_p((port))?__outb((x),(port)):(outb)((x),(port))) - -#define inb_p inb -#define outb_p outb - -extern inline unsigned long readl(unsigned long addr) -{ - return __readl(addr); -} +(__builtin_constant_p((port))?__outb((x),(port)):_outb((x),(port))) -extern inline void writel(unsigned int b, unsigned long addr) -{ - __writel(b, addr); -} +#define readl(a) __readl((unsigned long)(a)) +#define writel(v,a) __writel((v),(unsigned long)(a)) #undef vuip diff -u --recursive --new-file v1.3.37/linux/include/asm-alpha/page.h linux/include/asm-alpha/page.h --- v1.3.37/linux/include/asm-alpha/page.h Fri Oct 13 14:44:44 1995 +++ linux/include/asm-alpha/page.h Mon Oct 30 10:17:29 1995 @@ -8,9 +8,9 @@ #ifdef __KERNEL__ -#define CONFIG_STRICT_MM_TYPECHECKS +#define STRICT_MM_TYPECHECKS -#ifdef CONFIG_STRICT_MM_TYPECHECKS +#ifdef STRICT_MM_TYPECHECKS /* * These are used to make use of C type-checking.. */ diff -u --recursive --new-file v1.3.37/linux/include/asm-alpha/string.h linux/include/asm-alpha/string.h --- v1.3.37/linux/include/asm-alpha/string.h Sun Sep 3 12:27:01 1995 +++ linux/include/asm-alpha/string.h Sun Oct 29 20:50:09 1995 @@ -3,7 +3,21 @@ extern void * __constant_c_memset(void *, unsigned long, long); extern void * __memset(void *, char, size_t); + +/* + * Ugh. Gcc uses "bcopy()" internally for structure assignments. + */ +#define __HAVE_ARCH_BCOPY + +/* + * Define "memcpy()" to something else, otherwise gcc will + * corrupt that too into a "bcopy". Also, some day we might + * want to do a separate inlined constant-size memcpy (for 8 + * and 16 byte user<->kernel structure copying). + */ +#define __HAVE_ARCH_MEMCPY extern void * __memcpy(void *, const void *, size_t); +#define memcpy __memcpy #define __HAVE_ARCH_MEMSET #define memset(s, c, count) \ diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/bitops.h linux/include/asm-i386/bitops.h --- v1.3.37/linux/include/asm-i386/bitops.h Sun Oct 29 11:38:49 1995 +++ linux/include/asm-i386/bitops.h Mon Oct 30 10:12:26 1995 @@ -13,9 +13,7 @@ * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). */ -#include - -#ifdef CONFIG_SMP +#ifdef __SMP__ #define LOCK_PREFIX "lock ; " #else #define LOCK_PREFIX "" diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/bugs.h linux/include/asm-i386/bugs.h --- v1.3.37/linux/include/asm-i386/bugs.h Wed Feb 8 10:03:50 1995 +++ linux/include/asm-i386/bugs.h Mon Oct 30 10:13:05 1995 @@ -11,6 +11,8 @@ * void check_bugs(void); */ +#include + #define CONFIG_BUGi386 static void no_halt(char *s, int *ints) diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/delay.h linux/include/asm-i386/delay.h --- v1.3.37/linux/include/asm-i386/delay.h Wed Oct 4 14:14:33 1995 +++ linux/include/asm-i386/delay.h Mon Oct 30 10:02:27 1995 @@ -7,7 +7,7 @@ * Delay routines, using a pre-computed "loops_per_second" value. */ -#ifdef CONFIG_SMP +#ifdef __SMP__ #include #endif @@ -31,7 +31,7 @@ usecs *= 0x000010c6; /* 2**32 / 1000000 */ __asm__("mull %0" :"=d" (usecs) -#ifdef CONFIG_SMP +#ifdef __SMP__ :"a" (usecs),"0" (cpu_data[smp_processor_id()].udelay_val) #else :"a" (usecs),"0" (loops_per_sec) diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/irq.h linux/include/asm-i386/irq.h --- v1.3.37/linux/include/asm-i386/irq.h Wed Oct 4 14:14:33 1995 +++ linux/include/asm-i386/irq.h Mon Oct 30 10:01:50 1995 @@ -127,7 +127,7 @@ #define FAST_IRQ_NAME(nr) IRQ_NAME2(fast_IRQ##nr) #define BAD_IRQ_NAME(nr) IRQ_NAME2(bad_IRQ##nr) -#ifdef CONFIG_SMP +#ifdef ___SMP__ #define GET_PROCESSOR_ID \ "movl "SYMBOL_NAME_STR(apic_reg)", %edx\n\t" \ diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/page.h linux/include/asm-i386/page.h --- v1.3.37/linux/include/asm-i386/page.h Fri Oct 13 14:44:45 1995 +++ linux/include/asm-i386/page.h Mon Oct 30 10:17:13 1995 @@ -8,9 +8,9 @@ #ifdef __KERNEL__ -#define CONFIG_STRICT_MM_TYPECHECKS +#define STRICT_MM_TYPECHECKS -#ifdef CONFIG_STRICT_MM_TYPECHECKS +#ifdef STRICT_MM_TYPECHECKS /* * These are used to make use of C type-checking.. */ @@ -61,7 +61,7 @@ * ..but the i386 has somewhat limited invalidation capabilities. */ -#ifndef CONFIG_SMP +#ifndef __SMP__ #define invalidate() \ __asm__ __volatile__("movl %%cr3,%%eax\n\tmovl %%eax,%%cr3": : :"ax") diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/pgtable.h linux/include/asm-i386/pgtable.h --- v1.3.37/linux/include/asm-i386/pgtable.h Mon Sep 25 12:26:23 1995 +++ linux/include/asm-i386/pgtable.h Mon Oct 30 10:14:05 1995 @@ -2,10 +2,10 @@ #define _I386_PGTABLE_H /* - * Define CONFIG_PENTIUM_MM if you want the 4MB page table optimizations. + * Define USE_PENTIUM_MM if you want the 4MB page table optimizations. * This works only on a intel Pentium. */ -#define CONFIG_PENTIUM_MM 1 +#define USE_PENTIUM_MM 1 /* * The Linux memory management assumes a three-level page table setup. On @@ -98,7 +98,7 @@ * it will (on a i486) warn about kernel memory accesses that are * done without a 'verify_area(VERIFY_WRITE,..)' */ -#undef CONFIG_TEST_VERIFY_AREA +#undef TEST_VERIFY_AREA /* page table for 0-4MB for everybody */ extern unsigned long pg0[1024]; @@ -154,7 +154,7 @@ extern inline int pmd_none(pmd_t pmd) { return !pmd_val(pmd); } extern inline int pmd_bad(pmd_t pmd) { return (pmd_val(pmd) & ~PAGE_MASK) != _PAGE_TABLE || pmd_val(pmd) > high_memory; } extern inline int pmd_present(pmd_t pmd) { return pmd_val(pmd) & _PAGE_PRESENT; } -#ifdef CONFIG_PENTIUM_MM +#ifdef USE_PENTIUM_MM extern inline int pmd_inuse(pmd_t *pmdp) { return (pmd_val(*pmdp) & _PAGE_4M) != 0; } #else extern inline int pmd_inuse(pmd_t *pmdp) { return 0; } diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/smp.h linux/include/asm-i386/smp.h --- v1.3.37/linux/include/asm-i386/smp.h Mon Oct 23 18:02:18 1995 +++ linux/include/asm-i386/smp.h Mon Oct 30 10:03:06 1995 @@ -1,7 +1,7 @@ #ifndef __ASM_SMP_H #define __ASM_SMP_H -#ifdef CONFIG_SMP +#ifdef __SMP__ #ifndef ASSEMBLY #include diff -u --recursive --new-file v1.3.37/linux/include/asm-i386/system.h linux/include/asm-i386/system.h --- v1.3.37/linux/include/asm-i386/system.h Wed Oct 4 14:14:33 1995 +++ linux/include/asm-i386/system.h Mon Oct 30 10:02:08 1995 @@ -49,7 +49,7 @@ */ -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * Keep the lock depth straight. If we switch on an interrupt from * kernel->user task we need to lose a depth, and if we switch the diff -u --recursive --new-file v1.3.37/linux/include/asm-mips/floppy.h linux/include/asm-mips/floppy.h --- v1.3.37/linux/include/asm-mips/floppy.h Mon Oct 23 18:02:18 1995 +++ linux/include/asm-mips/floppy.h Mon Oct 30 10:16:19 1995 @@ -10,8 +10,6 @@ #ifndef __ASM_MIPS_FLOPPY_H #define __ASM_MIPS_FLOPPY_H -#include - #include #include #include diff -u --recursive --new-file v1.3.37/linux/include/asm-mips/page.h linux/include/asm-mips/page.h --- v1.3.37/linux/include/asm-mips/page.h Sun Sep 3 12:27:02 1995 +++ linux/include/asm-mips/page.h Mon Oct 30 10:15:56 1995 @@ -1,7 +1,7 @@ #ifndef __ASM_MIPS_PAGE_H #define __ASM_MIPS_PAGE_H -#define CONFIG_STRICT_MM_TYPECHECKS +#define STRICT_MM_TYPECHECKS #ifndef __ASSEMBLY__ @@ -18,7 +18,7 @@ typedef unsigned short mem_map_t; -#ifdef CONFIG_STRICT_MM_TYPECHECKS +#ifdef STRICT_MM_TYPECHECKS /* * These are used to make use of C type-checking.. */ @@ -34,7 +34,7 @@ #define __pgd(x) ((pgd_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } ) -#else /* !defined (CONFIG_STRICT_MM_TYPECHECKS) */ +#else /* !defined (STRICT_MM_TYPECHECKS) */ /* * .. while these make it easier on the compiler */ @@ -50,7 +50,7 @@ #define __pgd(x) (x) #define __pgprot(x) (x) -#endif /* !defined (CONFIG_STRICT_MM_TYPECHECKS) */ +#endif /* !defined (STRICT_MM_TYPECHECKS) */ #endif /* __ASSEMBLY__ */ /* diff -u --recursive --new-file v1.3.37/linux/include/asm-sparc/asi.h linux/include/asm-sparc/asi.h --- v1.3.37/linux/include/asm-sparc/asi.h Tue Jun 27 14:11:44 1995 +++ linux/include/asm-sparc/asi.h Mon Oct 30 10:18:12 1995 @@ -13,8 +13,6 @@ * be similar under regular sun4's. */ -#include - #define ASI_NULL1 0x0 #define ASI_NULL2 0x1 diff -u --recursive --new-file v1.3.37/linux/include/asm-sparc/page.h linux/include/asm-sparc/page.h --- v1.3.37/linux/include/asm-sparc/page.h Sun Sep 3 12:27:02 1995 +++ linux/include/asm-sparc/page.h Mon Oct 30 10:16:53 1995 @@ -38,9 +38,9 @@ extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; -#define CONFIG_STRICT_MM_TYPECHECKS +#define STRICT_MM_TYPECHECKS -#ifdef CONFIG_STRICT_MM_TYPECHECKS +#ifdef STRICT_MM_TYPECHECKS /* * These are used to make use of C type-checking.. */ diff -u --recursive --new-file v1.3.37/linux/include/linux/atalk.h linux/include/linux/atalk.h --- v1.3.37/linux/include/linux/atalk.h Sun Oct 29 11:38:49 1995 +++ linux/include/linux/atalk.h Mon Nov 6 12:59:00 1995 @@ -72,8 +72,6 @@ #ifdef __KERNEL__ -#include - struct ddpehdr { /* FIXME for bigendians */ diff -u --recursive --new-file v1.3.37/linux/include/linux/genhd.h linux/include/linux/genhd.h --- v1.3.37/linux/include/linux/genhd.h Tue Oct 10 18:46:38 1995 +++ linux/include/linux/genhd.h Mon Nov 6 12:29:40 1995 @@ -15,6 +15,10 @@ #define CONFIG_OSF_PARTITION 1 #endif +#ifdef __sparc__ +#define CONFIG_SUN_PARTITION 1 +#endif + /* These two have identical behaviour; use the second one if DOS fdisk gets confused about extended/logical partitions starting past cylinder 1023. */ #define DOS_EXTENDED_PARTITION 5 diff -u --recursive --new-file v1.3.37/linux/include/linux/module.h linux/include/linux/module.h --- v1.3.37/linux/include/linux/module.h Mon Oct 23 18:02:19 1995 +++ linux/include/linux/module.h Tue Nov 7 12:17:33 1995 @@ -7,7 +7,7 @@ #ifndef _LINUX_MODULE_H #define _LINUX_MODULE_H -#ifdef CONFIG_MODVERSIONS +#ifdef MODVERSIONS # ifndef __GENKSYMS__ # ifdef MODULE # define _set_ver(sym,vers) sym ## _R ## vers @@ -20,8 +20,8 @@ # endif /* MODULE */ # else /* __GENKSYMS__ */ # define _set_ver(sym,vers) sym -# endif /* __GENKSYMS__ */ -#endif /* CONFIG_MODVERSIONS */ +# endif /* __GENKSYMS__ */ +#endif /* MODVERSIONS */ /* values of module.state */ #define MOD_UNINITIALIZED 0 @@ -90,19 +90,28 @@ * define the count variable, and usage macros. */ -#if defined(CONFIG_MODVERSIONS) && defined(MODULE) && !defined(__GENKSYMS__) -int Using_Versions; /* gcc will handle this global (used as a flag) correctly */ -#endif - #ifdef MODULE + extern long mod_use_count_; #define MOD_INC_USE_COUNT mod_use_count_++ #define MOD_DEC_USE_COUNT mod_use_count_-- #define MOD_IN_USE (mod_use_count_ != 0) + +#ifndef __NO_VERSION__ +#include +char kernel_version[]=UTS_RELEASE; +#endif + +#if defined(MODVERSIONS) && !defined(__GENKSYMS__) +int Using_Versions; /* gcc will handle this global (used as a flag) correctly */ +#endif + #else + #define MOD_INC_USE_COUNT do { } while (0) #define MOD_DEC_USE_COUNT do { } while (0) #define MOD_IN_USE 1 + #endif #endif diff -u --recursive --new-file v1.3.37/linux/include/linux/net.h linux/include/linux/net.h --- v1.3.37/linux/include/linux/net.h Wed Sep 13 12:45:32 1995 +++ linux/include/linux/net.h Mon Nov 6 13:20:29 1995 @@ -102,23 +102,11 @@ int flags); int (*getname) (struct socket *sock, struct sockaddr *uaddr, int *usockaddr_len, int peer); - int (*read) (struct socket *sock, char *ubuf, int size, - int nonblock); - int (*write) (struct socket *sock, const char *ubuf, int size, - int nonblock); int (*select) (struct socket *sock, int sel_type, select_table *wait); int (*ioctl) (struct socket *sock, unsigned int cmd, unsigned long arg); int (*listen) (struct socket *sock, int len); - int (*send) (struct socket *sock, const void *buff, int len, int nonblock, - unsigned flags); - int (*recv) (struct socket *sock, void *buff, int len, int nonblock, - unsigned flags); - int (*sendto) (struct socket *sock, const void *buff, int len, int nonblock, - unsigned flags, struct sockaddr *, int addr_len); - int (*recvfrom) (struct socket *sock, void *buff, int len, int nonblock, - unsigned flags, struct sockaddr *, int *addr_len); int (*shutdown) (struct socket *sock, int flags); int (*setsockopt) (struct socket *sock, int level, int optname, char *optval, int optlen); diff -u --recursive --new-file v1.3.37/linux/include/linux/netdevice.h linux/include/linux/netdevice.h --- v1.3.37/linux/include/linux/netdevice.h Wed Sep 13 12:45:32 1995 +++ linux/include/linux/netdevice.h Tue Nov 7 20:04:00 1995 @@ -28,6 +28,8 @@ #include #include +#include + /* for future expansion when we will have different priorities. */ #define DEV_NUMBUFFS 3 #define MAX_ADDR_LEN 7 @@ -160,7 +162,7 @@ void (*set_multicast_list)(struct device *dev, int num_addrs, void *addrs); #define HAVE_SET_MAC_ADDR - int (*set_mac_address)(struct device *dev, void *addr); + int (*set_mac_address)(struct device *dev, struct sockaddr *addr); #define HAVE_PRIVATE_IOCTL int (*do_ioctl)(struct device *dev, struct ifreq *ifr, int cmd); #define HAVE_SET_CONFIG @@ -186,7 +188,7 @@ /* Used by dev_rint */ #define IN_SKBUFF 1 -extern volatile char in_bh; +extern volatile unsigned long in_bh; extern struct device loopback_dev; extern struct device *dev_base; diff -u --recursive --new-file v1.3.37/linux/include/linux/notifier.h linux/include/linux/notifier.h --- v1.3.37/linux/include/linux/notifier.h Sat Jan 7 12:57:54 1995 +++ linux/include/linux/notifier.h Mon Nov 6 12:59:00 1995 @@ -13,7 +13,7 @@ struct notifier_block { - int (*notifier_call)(unsigned long, void *); + int (*notifier_call)(struct notifier_block *this, unsigned long, void *); struct notifier_block *next; int priority; }; @@ -68,7 +68,7 @@ struct notifier_block *nb = *n; while(nb) { - ret=nb->notifier_call(val,v); + ret=nb->notifier_call(nb,val,v); if(ret&NOTIFY_STOP_MASK) return ret; nb=nb->next; diff -u --recursive --new-file v1.3.37/linux/include/linux/pci.h linux/include/linux/pci.h --- v1.3.37/linux/include/linux/pci.h Sun Oct 29 11:38:49 1995 +++ linux/include/linux/pci.h Tue Nov 7 09:18:36 1995 @@ -250,6 +250,7 @@ #define PCI_VENDOR_ID_DEC 0x1011 #define PCI_DEVICE_ID_DEC_BRD 0x0001 #define PCI_DEVICE_ID_DEC_TULIP 0x0002 +#define PCI_DEVICE_ID_DEC_TGA 0x0004 #define PCI_DEVICE_ID_DEC_TULIP_FAST 0x0009 #define PCI_DEVICE_ID_DEC_FDDI 0x000F #define PCI_DEVICE_ID_DEC_TULIP_PLUS 0x0014 diff -u --recursive --new-file v1.3.37/linux/include/linux/proc_fs.h linux/include/linux/proc_fs.h --- v1.3.37/linux/include/linux/proc_fs.h Wed Oct 4 14:14:34 1995 +++ linux/include/linux/proc_fs.h Mon Nov 6 13:21:08 1995 @@ -1,7 +1,6 @@ #ifndef _LINUX_PROC_FS_H #define _LINUX_PROC_FS_H -#include #include #include diff -u --recursive --new-file v1.3.37/linux/include/linux/sched.h linux/include/linux/sched.h --- v1.3.37/linux/include/linux/sched.h Mon Oct 23 18:02:19 1995 +++ linux/include/linux/sched.h Mon Nov 6 13:20:29 1995 @@ -1,8 +1,6 @@ #ifndef _LINUX_SCHED_H #define _LINUX_SCHED_H -#include - /* * define DEBUG if you want the wait-queues to have some extra * debugging code. It's not normally used, but might catch some @@ -220,7 +218,7 @@ struct mm_struct *mm; /* signal handlers */ struct signal_struct *sig; -#ifdef CONFIG_SMP +#ifdef __SMP__ int processor; int last_processor; int lock_depth; /* Lock depth. We can context switch in and out of holding a syscall kernel lock... */ diff -u --recursive --new-file v1.3.37/linux/include/linux/skbuff.h linux/include/linux/skbuff.h --- v1.3.37/linux/include/linux/skbuff.h Wed Sep 27 16:00:00 1995 +++ linux/include/linux/skbuff.h Tue Nov 7 20:04:00 1995 @@ -89,6 +89,7 @@ unsigned char *data; /* Data head pointer */ unsigned char *tail; /* Tail pointer */ unsigned char *end; /* End pointer */ + void (*destructor)(struct sk_buff *this); /* Destruct function */ }; #ifdef CONFIG_SKB_LARGE diff -u --recursive --new-file v1.3.37/linux/include/linux/smp.h linux/include/linux/smp.h --- v1.3.37/linux/include/linux/smp.h Wed Oct 4 14:14:34 1995 +++ linux/include/linux/smp.h Mon Oct 30 10:50:09 1995 @@ -6,7 +6,7 @@ * Alan Cox. */ -#ifdef CONFIG_SMP +#ifdef __SMP__ #include diff -u --recursive --new-file v1.3.37/linux/include/linux/sockios.h linux/include/linux/sockios.h --- v1.3.37/linux/include/linux/sockios.h Tue Jul 11 10:02:59 1995 +++ linux/include/linux/sockios.h Mon Nov 6 12:59:00 1995 @@ -42,7 +42,6 @@ #define SIOCSIFMEM 0x8920 /* set memory address (BSD) */ #define SIOCGIFMTU 0x8921 /* get MTU size */ #define SIOCSIFMTU 0x8922 /* set MTU size */ -#define OLD_SIOCGIFHWADDR 0x8923 /* get hardware address */ #define SIOCSIFHWADDR 0x8924 /* set hardware address (NI) */ #define SIOCGIFENCAP 0x8925 /* get/set slip encapsulation */ #define SIOCSIFENCAP 0x8926 @@ -53,10 +52,6 @@ #define SIOCADDMULTI 0x8931 #define SIOCDELMULTI 0x8932 /* end multicast support change */ - -/* Routing table calls (oldrtent - don't use) */ -#define SIOCADDRTOLD 0x8940 /* add routing table entry */ -#define SIOCDELRTOLD 0x8941 /* delete routing table entry */ /* ARP cache control calls. */ #define SIOCDARP 0x8950 /* delete ARP table entry */ diff -u --recursive --new-file v1.3.37/linux/include/linux/soundcard.h linux/include/linux/soundcard.h --- v1.3.37/linux/include/linux/soundcard.h Fri Oct 13 14:44:45 1995 +++ linux/include/linux/soundcard.h Tue Nov 7 10:14:18 1995 @@ -78,6 +78,7 @@ #define SNDCARD_CS4232 21 #define SNDCARD_CS4232_MPU 22 #define SNDCARD_MAUI 23 +#define SNDCARD_PSEUDO_MSS 24 /*********************************** * IOCTL Commands for /dev/sequencer diff -u --recursive --new-file v1.3.37/linux/include/linux/symtab_begin.h linux/include/linux/symtab_begin.h --- v1.3.37/linux/include/linux/symtab_begin.h Thu Jul 13 16:20:21 1995 +++ linux/include/linux/symtab_begin.h Tue Nov 7 20:04:01 1995 @@ -9,15 +9,15 @@ # ifdef MODULE # define _set_ver(sym,ver) \ { (void *) & sym ## _R ## ver, SYMBOL_NAME_STR(sym) "_R" #ver } -# else /* MODULE */ +# else /* !MODULE */ # define _set_ver(sym,ver) \ { (void *) & sym, SYMBOL_NAME_STR(sym) "_R" #ver } -# endif /* MODULE */ +# endif /* !MODULE */ # define X(a) a # endif /* !__GENKSYMS__ */ -#else /* CONFIG_MODVERSIONS */ +#else /* !CONFIG_MODVERSIONS */ # define X(sym) { (void *) & sym, SYMBOL_NAME_STR(sym)} -#endif /* CONFIG_MODVERSIONS */ +#endif /* !CONFIG_MODVERSIONS */ #define EMPTY {0,0} 0, 0, 0, { diff -u --recursive --new-file v1.3.37/linux/include/linux/symtab_end.h linux/include/linux/symtab_end.h --- v1.3.37/linux/include/linux/symtab_end.h Mon Jan 23 10:38:30 1995 +++ linux/include/linux/symtab_end.h Mon Oct 30 08:52:24 1995 @@ -1,11 +1,11 @@ -#ifdef CONFIG_MODVERSIONS /* CONFIG_MODVERSIONS */ +#ifdef MODVERSIONS /* MODVERSIONS */ #undef _set_ver #if defined(MODULE) && !defined(__GENKSYMS__) #define _set_ver(sym,vers) sym ## _R ## vers #else #define _set_ver(a,b) a #endif -#endif /* CONFIG_MODVERSIONS */ +#endif /* MODVERSIONS */ #undef X #undef EMPTY /* mark end of table, last entry above ended with a comma! */ diff -u --recursive --new-file v1.3.37/linux/include/linux/tasks.h linux/include/linux/tasks.h --- v1.3.37/linux/include/linux/tasks.h Wed Oct 4 14:14:34 1995 +++ linux/include/linux/tasks.h Mon Oct 30 10:00:21 1995 @@ -5,7 +5,7 @@ * This is the maximum nr of tasks - change it if you need to */ -#ifdef CONFIG_SMP +#ifdef __SMP__ #define NR_CPUS 32 /* Max processors that can be running in SMP */ #else #define NR_CPUS 1 diff -u --recursive --new-file v1.3.37/linux/include/linux/tty.h linux/include/linux/tty.h --- v1.3.37/linux/include/linux/tty.h Tue Oct 10 18:46:38 1995 +++ linux/include/linux/tty.h Tue Nov 7 09:18:36 1995 @@ -68,6 +68,8 @@ #define VIDEO_TYPE_EGAC 0x21 /* EGA in Color Mode */ #define VIDEO_TYPE_VGAC 0x22 /* VGA+ in Color Mode */ +#define VIDEO_TYPE_TGAC 0x40 /* DEC TGA */ + /* * This character is the same as _POSIX_VDISABLE: it cannot be used as * a c_cc[] character, but indicates that a particular special character @@ -279,15 +281,9 @@ extern int pty_init(void); extern int tty_init(void); extern int vcs_init(void); -#ifdef CONFIG_CYCLADES extern int cy_init(void); -#endif -#ifdef CONFIG_STALLION extern int stl_init(void); -#endif -#ifdef CONFIG_ISTALLION extern int stli_init(void); -#endif extern int tty_paranoia_check(struct tty_struct *tty, kdev_t device, const char *routine); diff -u --recursive --new-file v1.3.37/linux/include/net/netlink.h linux/include/net/netlink.h --- v1.3.37/linux/include/net/netlink.h Tue Oct 10 18:46:39 1995 +++ linux/include/net/netlink.h Tue Nov 7 20:10:17 1995 @@ -1,5 +1,8 @@ #ifndef __NET_NETLINK_H #define __NET_NETLINK_H + +#include + #define NET_MAJOR 18 /* Major 18 is reserved for networking */ #define MAX_LINKS 3 /* 18,0 for route updates, 18,1 for SKIP */ #define MAX_QBYTES 32768 /* Maximum bytes in the queue */ diff -u --recursive --new-file v1.3.37/linux/include/net/sock.h linux/include/net/sock.h --- v1.3.37/linux/include/net/sock.h Mon Oct 23 18:02:19 1995 +++ linux/include/net/sock.h Tue Nov 7 20:04:00 1995 @@ -21,6 +21,7 @@ * a socket is reset and must stay shut up * Alan Cox : New fields for options * Pauline Middelink : identd support + * Alan Cox : Eliminate low level recv/recvfrom * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -71,6 +72,19 @@ struct sock * other; }; +/* + * IP packet socket options + */ + +struct inet_packet_opt +{ + struct notifier_block notifier; /* Used when bound */ + struct device *bound_dev; + unsigned long dev_stamp; + struct packet_type *prot_hook; + char device_name[15]; +}; + /* * This structure really needs to be cleaned up. @@ -187,7 +201,7 @@ /* * This is where all the private (optional) areas that don't - * overlap will eventually live. For now just AF_UNIX is here. + * overlap will eventually live. */ union @@ -196,6 +210,9 @@ #ifdef CONFIG_ATALK struct atalk_sock af_at; #endif +#ifdef CONFIG_INET + struct inet_packet_opt af_packet; +#endif } protinfo; /* @@ -264,18 +281,6 @@ struct proto { void (*close)(struct sock *sk, int timeout); - int (*read)(struct sock *sk, unsigned char *to, - int len, int nonblock, unsigned flags); - int (*write)(struct sock *sk, const unsigned char *to, - int len, int nonblock, unsigned flags); - int (*sendto)(struct sock *sk, - const unsigned char *from, int len, - int noblock, unsigned flags, - struct sockaddr_in *usin, int addr_len); - int (*recvfrom)(struct sock *sk, - unsigned char *from, int len, int noblock, - unsigned flags, struct sockaddr_in *usin, - int *addr_len); int (*build_header)(struct sk_buff *skb, __u32 saddr, __u32 daddr, @@ -309,6 +314,7 @@ int noblock, int flags); int (*recvmsg)(struct sock *sk, struct msghdr *msg, int len, int noblock, int flags, int *addr_len); + int (*bind)(struct sock *sk, struct sockaddr *uaddr, int addr_len); unsigned short max_header; unsigned long retransmits; char name[32]; @@ -405,6 +411,16 @@ return 0; } +/* + * Recover an error report and clear atomically + */ + +extern __inline__ int sock_error(struct sock *sk) +{ + int err=xchg(&sk->err,0); + return -err; +} + /* * Declarations from timer.c */ diff -u --recursive --new-file v1.3.37/linux/init/main.c linux/init/main.c --- v1.3.37/linux/init/main.c Mon Oct 23 18:02:19 1995 +++ linux/init/main.c Mon Oct 30 09:56:12 1995 @@ -116,7 +116,7 @@ int rows, cols; int ramdisk_size; -int root_mountflags = 0; +int root_mountflags = MS_RDONLY; static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; static char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; @@ -297,7 +297,7 @@ int ticks; int loopbit; int lps_precision = LPS_PREC; -#ifdef CONFIG_SMP +#ifdef __SMP__ loops_per_sec = (1<<12); #endif @@ -418,7 +418,7 @@ extern void setup_arch(char **, unsigned long *, unsigned long *); -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * Activate a secondary processor. */ @@ -488,7 +488,7 @@ * This little check will move. */ -#ifdef CONFIG_SMP +#ifdef __SMP__ static int first_cpu=1; if(!first_cpu) @@ -545,7 +545,7 @@ check_bugs(); printk(linux_banner); -#ifdef CONFIG_SMP +#ifdef __SMP__ smp_init(); #endif /* we count on the initial thread going ok */ @@ -598,7 +598,7 @@ setup(); -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * With the devices probed and setup we can * now enter SMP mode. diff -u --recursive --new-file v1.3.37/linux/init/version.c linux/init/version.c --- v1.3.37/linux/init/version.c Fri Aug 18 08:44:58 1995 +++ linux/init/version.c Mon Oct 30 10:20:05 1995 @@ -11,6 +11,10 @@ #include #include +/* make the "checkconfig" script happy: we really need to include config.h */ +#ifdef CONFIG_BOGUS +#endif + struct new_utsname system_utsname = { UTS_SYSNAME, UTS_NODENAME, UTS_RELEASE, UTS_VERSION, UTS_MACHINE, UTS_DOMAINNAME diff -u --recursive --new-file v1.3.37/linux/kernel/exit.c linux/kernel/exit.c --- v1.3.37/linux/kernel/exit.c Fri Oct 13 14:44:45 1995 +++ linux/kernel/exit.c Mon Oct 30 08:32:25 1995 @@ -6,7 +6,6 @@ #undef DEBUG_PROC_TREE -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/kernel/fork.c linux/kernel/fork.c --- v1.3.37/linux/kernel/fork.c Fri Oct 13 14:44:45 1995 +++ linux/kernel/fork.c Mon Oct 30 10:20:26 1995 @@ -11,7 +11,6 @@ * management can be a bitch. See 'mm/mm.c': 'copy_page_tables()' */ -#include #include #include #include @@ -240,7 +239,7 @@ p->tty_old_pgrp = 0; p->utime = p->stime = 0; p->cutime = p->cstime = 0; -#ifdef CONFIG_SMP +#ifdef __SMP__ p->processor = NO_PROC_ID; p->lock_depth = 1; #endif diff -u --recursive --new-file v1.3.37/linux/kernel/ksyms.c linux/kernel/ksyms.c --- v1.3.37/linux/kernel/ksyms.c Sun Oct 29 11:38:49 1995 +++ linux/kernel/ksyms.c Tue Nov 7 09:18:36 1995 @@ -134,12 +134,12 @@ /* platform dependent support */ #ifdef __alpha__ - X(inb), - X(inw), - X(inl), - X(outb), - X(outw), - X(outl), + X(_inb), + X(_inw), + X(_inl), + X(_outb), + X(_outw), + X(_outl), X(bcopy), /* generated by gcc-2.7.0 for string assignments */ X(hwrpb), X(__divl), @@ -206,6 +206,7 @@ X(vfree), X(mem_map), X(remap_page_range), + X(high_memory), /* filesystem internal functions */ X(getname), @@ -326,7 +327,7 @@ X(interruptible_sleep_on), X(schedule), X(current_set), -#if defined(__i386__) && defined(CONFIG_SMP) +#if defined(__i386__) && defined(__SMP__) X(apic_reg), /* Needed internally for the I386 inlines */ #endif X(jiffies), @@ -534,6 +535,8 @@ X(proc_unregister), X(in_group_p), X(generate_cluster), + X(proc_scsi), + X(proc_scsi_inode_operations), #endif /******************************************************** * Do not add anything below this line, diff -u --recursive --new-file v1.3.37/linux/kernel/sched.c linux/kernel/sched.c --- v1.3.37/linux/kernel/sched.c Sun Oct 29 11:38:49 1995 +++ linux/kernel/sched.c Mon Oct 30 10:20:26 1995 @@ -11,7 +11,6 @@ * current-task */ -#include #include #include #include @@ -183,7 +182,7 @@ { int weight; -#ifdef CONFIG_SMP +#ifdef __SMP__ /* We are not permitted to run a task someone else is running */ if (p->processor != NO_PROC_ID) return -1000; @@ -199,7 +198,7 @@ weight = p->counter; if (weight) { -#ifdef CONFIG_SMP +#ifdef __SMP__ /* Give a largish advantage to the same processor... */ /* (this is equivalent to penalizing other processors) */ if (p->last_processor == this_cpu) @@ -261,7 +260,7 @@ p = init_task.next_run; sti(); -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * This is safe as we do not permit re-entry of schedule() */ @@ -288,7 +287,7 @@ for_each_task(p) p->counter = (p->counter >> 1) + p->priority; } -#ifdef CONFIG_SMP +#ifdef __SMP__ /* * Context switching between two idle threads is pointless. @@ -519,7 +518,7 @@ (*p)->state == TASK_UNINTERRUPTIBLE || (*p)->state == TASK_SWAPPING)) nr += FIXED_1; -#ifdef CONFIG_SMP +#ifdef __SMP__ nr-=(smp_num_cpus-1)*FIXED_1; #endif return nr; @@ -978,7 +977,7 @@ */ int cpu=smp_processor_id(); current_set[cpu]=&init_task; -#ifdef CONFIG_SMP +#ifdef __SMP__ init_task.processor=cpu; #endif bh_base[TIMER_BH].routine = timer_bh; diff -u --recursive --new-file v1.3.37/linux/mm/filemap.c linux/mm/filemap.c --- v1.3.37/linux/mm/filemap.c Mon Oct 23 18:02:20 1995 +++ linux/mm/filemap.c Mon Nov 6 16:05:07 1995 @@ -279,7 +279,7 @@ } /* - * This handles partial area unmaps.. + * This handles (potentially partial) area unmaps.. */ static void filemap_unmap(struct vm_area_struct *vma, unsigned long start, size_t len) { @@ -287,23 +287,15 @@ } /* - * This handles complete area closes.. - */ -static void filemap_close(struct vm_area_struct * vma) -{ - filemap_sync(vma, vma->vm_start, vma->vm_end - vma->vm_start, MS_ASYNC); -} - -/* * Shared mappings need to be able to do the right thing at * close/unmap/sync. They will also use the private file as * backing-store for swapping.. */ static struct vm_operations_struct file_shared_mmap = { - NULL, /* open */ - filemap_close, /* close */ - filemap_unmap, /* unmap */ - NULL, /* protect */ + NULL, /* no special open */ + NULL, /* no special close */ + filemap_unmap, /* unmap - we need to sync the pages */ + NULL, /* no special protect */ filemap_sync, /* sync */ NULL, /* advise */ filemap_nopage, /* nopage */ diff -u --recursive --new-file v1.3.37/linux/mm/memory.c linux/mm/memory.c --- v1.3.37/linux/mm/memory.c Mon Oct 23 18:02:20 1995 +++ linux/mm/memory.c Mon Oct 30 08:32:39 1995 @@ -33,7 +33,6 @@ * Idea by Alex Bligh (alex@cconcepts.co.uk) */ -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/mm/mmap.c linux/mm/mmap.c --- v1.3.37/linux/mm/mmap.c Wed Sep 13 12:45:34 1995 +++ linux/mm/mmap.c Tue Nov 7 10:08:37 1995 @@ -638,7 +638,7 @@ * Case 4 involves the creation of 2 new areas, for each side of * the hole. */ -void unmap_fixup(struct vm_area_struct *area, +static void unmap_fixup(struct vm_area_struct *area, unsigned long addr, size_t len) { struct vm_area_struct *mpnt; @@ -768,7 +768,7 @@ if (mpnt->vm_ops && mpnt->vm_ops->unmap) mpnt->vm_ops->unmap(mpnt, st, end-st); - + zap_page_range(current->mm, st, end-st); unmap_fixup(mpnt, st, end-st); kfree(mpnt); } @@ -797,12 +797,16 @@ mm->mmap_avl = NULL; while (mpnt) { struct vm_area_struct * next = mpnt->vm_next; - if (mpnt->vm_ops && mpnt->vm_ops->close) - mpnt->vm_ops->close(mpnt); + if (mpnt->vm_ops) { + if (mpnt->vm_ops->unmap) + mpnt->vm_ops->unmap(mpnt, mpnt->vm_start, mpnt->vm_end-mpnt->vm_start); + if (mpnt->vm_ops->close) + mpnt->vm_ops->close(mpnt); + } remove_shared_vm_struct(mpnt); + zap_page_range(mm, mpnt->vm_start, mpnt->vm_end-mpnt->vm_start); if (mpnt->vm_inode) iput(mpnt->vm_inode); - zap_page_range(mm, mpnt->vm_start, mpnt->vm_end-mpnt->vm_start); kfree(mpnt); mpnt = next; } diff -u --recursive --new-file v1.3.37/linux/mm/swap.c linux/mm/swap.c --- v1.3.37/linux/mm/swap.c Fri Oct 13 14:44:48 1995 +++ linux/mm/swap.c Mon Nov 6 12:29:40 1995 @@ -837,6 +837,8 @@ unsigned long flags; int reserved_pages; + if (order >= NR_MEM_LISTS) + return 0; if (intr_count && priority != GFP_ATOMIC) { static int count = 0; if (++count < 5) { diff -u --recursive --new-file v1.3.37/linux/net/Changes linux/net/Changes --- v1.3.37/linux/net/Changes Mon Oct 23 18:02:21 1995 +++ linux/net/Changes Mon Nov 6 12:59:00 1995 @@ -7,7 +7,7 @@ o Merged in the Jorge Cwik fast checksum. [TESTED] o Added Arnt Gulbrandsen's fast UDP build. [TESTED] -o Pauline Middelinks masquerade patch [TESTED(bar spoof bug)] +o Pauline Middelinks masquerade patch [TESTED] 0.1 @@ -21,7 +21,7 @@ o Routing cache (only in ip_build_header so far) [TESTED] ------->>>>> ALPHA 001 <<<<<---------- o eql load balancing driver. [TESTED] -o Token ring drivers. [COMPILE - CANT TEST] +o Token ring drivers. [NOW WORK APPARENTLY] o IPIP and tunnels [TESTED] o Fix ethernet/token ring promisc broadcast error [QUICK TEST] (pkt_type set to OTHERHOST in error). @@ -46,7 +46,7 @@ o TCP SWS probe fix [TESTED] o Appletalk DDP [TESTED] o IP firewall bug fixed [TESTED] -o IP masquerade ftp port spoof [IN/BUG] +o IP masquerade ftp port spoof [NOW WORKS] o gcc 2.6.3 -O3 fix for checksum assembler [TESTED] o /proc support shows both timers [TESTED] o TCP irtt support [TESTED] @@ -84,7 +84,7 @@ ////////////////////////////1.3.0/////////////////////////// -o Merged loadable firewall code [NOT INCLUDED YET] +o Merged loadable firewall code [NOW IN (1.3.38)] o New buffers used totally non optimally [TESTED] o Fast ip_forwarding (needs changing) [NOW INCLUDED IN 1.3.15] o Fixed connection hang bug in new SWS code [TESTED] @@ -158,9 +158,9 @@ o Device locking [TESTED] o Infinite slip devices [IN - BUG] o New AF_UNIX sockets [TESTED] -o Sendmsg/recvmsg (for some stuff only) [IN] +o Sendmsg/recvmsg (for some stuff only) [TESTED] o Device unload loopholes fixed [TESTED] -o Extra firewall abilities [IN] +o Extra firewall abilities [TESTED] o Appletalk node probe bug fix [TESTED] ------->>>> 1.3.18 <<<<--------- @@ -172,70 +172,69 @@ -------->>>>> 1.3.21 <<<<<--------- -o AF_UNIX fixes and 4K limiter [IN] -o Sendmsg/recvmsg for AX.25/Appletalk [IN] -o Datagram generic iovec support [IN] -o Misc minor bug fixes [IN] +o AF_UNIX fixes and 4K limiter [TESTED] +o Sendmsg/recvmsg for AX.25/Appletalk [TESTED] +o Datagram generic iovec support [TESTED] +o Misc minor bug fixes [TESTED] -------->>>>> 1.3.22 <<<<<------- o Device lock against page fault [TESTED] o IP_HDRINCL [TESTED] -o IP firewalling spoofing protection [IN] +o IP firewalling spoofing protection [TESTED] o IGMP bug fixes and workarounds [TESTED] o IFF_ALLMULTI protocol layer support [TESTED] o First parts of IP multicast routing code [IN] o Generate BSD ENETDOWN errors [TESTED] -o Clean device unload bug [IN] +o Clean device unload bug [NOW WORKS] -------->>>>> 1.3.24 <<<<<------- o Missing IGMP includes fixes [TESTED] -o Smarter buffer use options for sockets [IN] -o AF_UNIX smarter buffer driving [IN] -o AF_UNIX full BSD semantics on STREAM writes [IN] -o IOVEC's support repeated calls to copy more [IN] -o Zero fragment 'solaris nfs' bug fixed [IN] -o NetROM supports sendmsg/recvmsg [IN] -o Sendmsg verify_iovec bugfix [IN] -o ARP PERM is really permanent now [IN] -o IPIP tunnels work fully we hope [IN] -o Closing socket change (Marc Tamsky) [IN] +o Smarter buffer use options for sockets [TESTED] +o AF_UNIX smarter buffer driving [TESTED] +o AF_UNIX full BSD semantics on STREAM writes [TESTED] +o IOVEC's support repeated calls to copy more [TESTED] +o Zero fragment 'solaris nfs' bug fixed [TESTED] +o NetROM supports sendmsg/recvmsg [TESTED] +o Sendmsg verify_iovec bugfix [TESTED] +o ARP PERM is really permanent now [TESTED] +o IPIP tunnels work fully we hope [UMM...] +o Closing socket change (Marc Tamsky) [TESTED] o RFC1122 verification of tcp.c [IN] -------->>>>> 1.3.26 <<<<<------- -o Rewrote ICMP completely [TESTED - - fragmenting is wrong] -o Moved most IP addresses to __u32 [IN] -o Cleaned up ICMP reporting [IN] -o Tidied remove_sock [IN] +o Rewrote ICMP completely [TESTED] +o Moved most IP addresses to __u32 [TESTED] +o Cleaned up ICMP reporting [TESTED] +o Tidied remove_sock [TESTED] o Added memory allocation type to ip_build_xmit [IN] -o Cleaned up af_inet to use inet_error [IN] -o Named firewall returns [IN] -o Added firewall output checks to ip_build_xmit [IN] +o Cleaned up af_inet to use inet_error [TESTED] +o Named firewall returns [TESTED] +o Added firewall output checks to ip_build_xmit [TESTED] o Multicast router downs VIF's when their - physical interface is dropped [IN] -o Reformatted ipv4/protocol.c, dropped frag field [IN] -o Fixed MSS for TCP [IN] -o Dropped sock_awaitconn [IN] + physical interface is dropped [TESTED] +o Reformatted ipv4/protocol.c, dropped frag field [TESTED] +o Fixed MSS for TCP [TESTED] +o Dropped sock_awaitconn [TESTED] o Added ip_forward to ksyms for IPIP etc [IN] -o Appletalk TIOCINQ/TIOCOUTQ bug fix [IN] -o Rewrote the IFF_UP/IFF_DOWN handling code [IN] +o Appletalk TIOCINQ/TIOCOUTQ bug fix [TESTED] +o Rewrote the IFF_UP/IFF_DOWN handling code [TESTED] -------->>>>> 1.3.29 <<<<<------- -o Major AX.25/NetROM fixes [John Naylor] [IN] -o Error in ip_mr ioctls fixed [Michael Chastain] [IN] -o TCP cache zap bugs hopefully fixed [IN] -o Length checks in udp/raw sending [Craig Metz] [IN] +o Major AX.25/NetROM fixes [John Naylor] [TESTED] +o Error in ip_mr ioctls fixed [Michael Chastain] [TESTED] +o TCP cache zap bugs hopefully fixed [CLOSE BUT NO COOKIE] +o Length checks in udp/raw sending [Craig Metz] [TESTED] -------->>>>> 1.3.31 <<<<<<------- -o IP_OPTIONS [A.N.Kuznetsov] [IN] -o TCP cache zap more fixes [IN] -o Most of the IP multicast routing cache added [IN] -o Kernel/user communication module (not used yet) [IN] +o IP_OPTIONS [A.N.Kuznetsov] [TESTED] +o TCP cache zap more fixes [TESTED.. STILL NO COOKIE] +o Most of the IP multicast routing cache added [TESTED - WORK NEEDED] +o Kernel/user communication module (not used yet) [TESTED] -------->>>>> 1.3.31 <<<<<<------- @@ -244,30 +243,44 @@ -------->>>>> 1.3.33 <<<<<<-------- -o IFF_ALLMULTI causes an address check on ether [IN] -o Added multicast ability readme file [IN] -o Assorted driver/multicast fixes [IN] -o IP routing change errors resemble BSD more [IN] -o IP port masquerading fixes [IN] +o IFF_ALLMULTI causes an address check on ether [TESTED] +o Added multicast ability readme file [TESTED] +o Assorted driver/multicast fixes [TESTED] +o IP routing change errors resemble BSD more [TESTED/MORE TO COME] +o IP port masquerading fixes [TESTED] -------->>>>> 1.3.35 <<<<<<-------- -o Appletalk data now in the protinfo union [IN] +o Appletalk data now in the protinfo union [TESTED] o BSD style bind to broadcast address supported [IN] -o Standard loadable firewall chains [IN] +o Standard loadable firewall chains [TESTED] o IPFW uses the firewall chains for firewall but - not yet acct/masquerade [IN] -o Firewall chain hooks in all other protocols [IN] -o Sendmsg/recvmsg for IPX. [IN] -o IPX uses sock_alloc_send_skb [IN] + not yet acct/masquerade [TESTED] +o Firewall chain hooks in all other protocols [TESTED] +o Sendmsg/recvmsg for IPX. [TESTED] +o IPX uses sock_alloc_send_skb [TESTED] o Recvmsg for all IP, sendmsg for TCP [IN] (nearly ready to go all *msg()) +-------->>>>> 1.3.38 <<<<<<-------- + +o ip udp/raw nonblock bug fixed [TESTED] +o ICMP lockup fix [IN] +o Fundamental operations now only sendmsg/recvmsg [IN] +o bind() for SOCK_PACKET [IN] +o set_mac_addr fixed up [IN] +o BSD SIOCSIFADDR, AF_UNSPEC behaviour [IN] +o Updated this list [IN] + + ---------- Things I thought Linus had for a while and not merged ---------------- ----------- Things pending from other people to chase ------------- +---------- Things pending from other people ------------- +o Improved IPX support for lwared. +o Decnet pre pre pre pre pre Alpha 0.0. +o Faster routing/caching support. ---------- Things pending for me to merge -------------- @@ -275,6 +288,9 @@ o AF_UNIX garbage collect code o Faster closedown option for heavy use sites (me) o Tom May's insw_and_checksum() +o IPX PPP support +o DECNET PPP test code +o SPARC patches [Dave] --------------- Things That Need Doing Before 1.4 ------------------ @@ -287,14 +303,12 @@ o L2 ip routing cache [PENDING(btv)] o Forwarding queue control (+ fairness algorithms ??) o IP forward flow control. -o Infinite PPP devices. o Clean up RAW AX.25 sockets. o Finish 802.2 Class I code to be compliant to the oddities of 802.2 o Tidy BPQ support to use a bpqip tunnel device o Strange eth0-eth3 bug o Finish IPIP bug fixes [Done hopefully] o Why doesnt the PROTO_UNREACH get sent ? [Should now work] -o IP protocols using sendmsg() o Kill off old ip_queue_xmit/ip_send stuff. o Remove kernel RARP and replace with user mode daemon. o Throw out existing firewall ioctl()'s and use a single table load. @@ -304,9 +318,8 @@ o Better TCP window handling [Pedro Roque] o Add tty support to sonix driver. o PPP for Sonix ISDN. -o Loadable firewall extensions. o Screend loadable firewall module -o LZ SLIP [Done, resolving patent issues] +o LZ SLIP [Done, resolving patent issues - sod it use PPP] o AXIP 0.3 diff -u --recursive --new-file v1.3.37/linux/net/Makefile linux/net/Makefile --- v1.3.37/linux/net/Makefile Wed Oct 4 14:14:35 1995 +++ linux/net/Makefile Mon Oct 30 08:47:14 1995 @@ -9,7 +9,28 @@ MOD_SUB_DIRS := ipv4 ALL_SUB_DIRS := 802 ax25 core ethernet ipv4 ipx unix appletalk netrom -SUB_DIRS := $(ALL_SUB_DIRS) +SUB_DIRS := 802 core ethernet unix + +ifeq ($(CONFIG_INET),y) +SUB_DIRS += ipv4 +endif + +ifeq ($(CONFIG_IPX),y) +SUB_DIRS += ipx +endif + +ifeq ($(CONFIG_ATALK),y) +SUB_DIRS += appletalk +endif + +ifeq ($(CONFIG_NETROM),y) +SUB_DIRS += netrom +endif + +ifeq ($(CONFIG_AX25),y) +SUB_DIRS += ax25 +endif + L_TARGET := network.a L_OBJS := socket.o protocols.o netlink.o $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o)) diff -u --recursive --new-file v1.3.37/linux/net/appletalk/aarp.c linux/net/appletalk/aarp.c --- v1.3.37/linux/net/appletalk/aarp.c Mon Oct 23 18:02:21 1995 +++ linux/net/appletalk/aarp.c Mon Nov 6 12:59:00 1995 @@ -372,7 +372,7 @@ * Network device notifier chain handler. */ -static int aarp_device_event(unsigned long event, void *ptr) +static int aarp_device_event(struct notifier_block *this, unsigned long event, void *ptr) { int ct=0; if(event==NETDEV_DOWN) diff -u --recursive --new-file v1.3.37/linux/net/appletalk/ddp.c linux/net/appletalk/ddp.c --- v1.3.37/linux/net/appletalk/ddp.c Mon Oct 23 18:02:21 1995 +++ linux/net/appletalk/ddp.c Mon Nov 6 12:59:00 1995 @@ -663,7 +663,7 @@ * delete our use of them (iface and route). */ -static int ddp_device_event(unsigned long event, void *ptr) +static int ddp_device_event(struct notifier_block *this, unsigned long event, void *ptr) { if(event==NETDEV_DOWN) { @@ -1696,27 +1696,6 @@ } -static int atalk_sendto(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int addr_len) -{ - struct iovec iov; - struct msghdr msg; - iov.iov_base=(void *)ubuf; - iov.iov_len=size; - msg.msg_name=(void *)sa; - msg.msg_namelen=addr_len; - msg.msg_accrights=NULL; - msg.msg_iov=&iov; - msg.msg_iovlen=1; - return atalk_sendmsg(sock,&msg,size,noblock,flags); -} - - -static int atalk_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags) -{ - return atalk_sendto(sock,ubuf,size,noblock,flags,NULL,0); -} - static int atalk_recvmsg(struct socket *sock, struct msghdr *msg, int size, int noblock, int flags, int *addr_len) { atalk_socket *sk=(atalk_socket *)sock->data; @@ -1727,11 +1706,7 @@ int er; if(sk->err) - { - er= -sk->err; - sk->err=0; - return er; - } + return sock_error(sk); if(addr_len) *addr_len=sizeof(*sat); @@ -1767,44 +1742,6 @@ } -static int atalk_write(struct socket *sock, const char *ubuf, int size, int noblock) -{ - return atalk_send(sock,ubuf,size,noblock,0); -} - - -static int atalk_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - iov.iov_base=ubuf; - iov.iov_len=size; - msg.msg_name=(void *)sa; - msg.msg_namelen=0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights=NULL; - msg.msg_iov=&iov; - msg.msg_iovlen=1; - return atalk_recvmsg(sock,&msg,size,noblock,flags,addr_len); -} - -static int atalk_recv(struct socket *sock, void *ubuf, int size , int noblock, - unsigned flags) -{ - atalk_socket *sk=(atalk_socket *)sock->data; - if(sk->zapped) - return -ENOTCONN; - return atalk_recvfrom(sock,ubuf,size,noblock,flags,NULL, NULL); -} - -static int atalk_read(struct socket *sock, char *ubuf, int size, int noblock) -{ - return atalk_recv(sock,ubuf,size,noblock,0); -} - - static int atalk_shutdown(struct socket *sk,int how) { return -EOPNOTSUPP; @@ -1878,7 +1815,6 @@ case SIOCSIFLINK: case SIOCGIFHWADDR: case SIOCSIFHWADDR: - case OLD_SIOCGIFHWADDR: case SIOCGIFFLAGS: case SIOCSIFFLAGS: case SIOCGIFMTU: @@ -1919,15 +1855,9 @@ atalk_socketpair, atalk_accept, atalk_getname, - atalk_read, - atalk_write, atalk_select, atalk_ioctl, atalk_listen, - atalk_send, - atalk_recv, - atalk_sendto, - atalk_recvfrom, atalk_shutdown, atalk_setsockopt, atalk_getsockopt, diff -u --recursive --new-file v1.3.37/linux/net/ax25/af_ax25.c linux/net/ax25/af_ax25.c --- v1.3.37/linux/net/ax25/af_ax25.c Mon Oct 23 18:02:21 1995 +++ linux/net/ax25/af_ax25.c Mon Nov 6 12:59:00 1995 @@ -66,6 +66,8 @@ * Moved digipeating ctl to new ax25_dev structs. * Fixed ax25_release(), set TCP_CLOSE, wakeup app * context, THEN make the sock dead. + * Alan(GW4PTS) Cleaned up for single recvmsg methods. + * Alan(GW4PTS) Fixed not clearing error on connect failure. * * To do: * Restructure the ax25_rcv code to be cleaner/faster and @@ -222,7 +224,7 @@ /* * Handle device status changes. */ -static int ax25_device_event(unsigned long event, void *ptr) +static int ax25_device_event(struct notifier_block *this,unsigned long event, void *ptr) { struct device *dev = (struct device *)ptr; @@ -1252,10 +1254,12 @@ } } - if (sk->state != TCP_ESTABLISHED) { /* Not in ABM, not in WAIT_UA -> failed */ + if (sk->state != TCP_ESTABLISHED) + { + /* Not in ABM, not in WAIT_UA -> failed */ sti(); sock->state = SS_UNCONNECTED; - return -sk->err; /* Always set at this point */ + return sock_error(sk); /* Always set at this point */ } sock->state = SS_CONNECTED; @@ -1693,11 +1697,7 @@ int addr_len=msg->msg_namelen; if (sk->err) { - cli(); - err = sk->err; - sk->err = 0; - sti(); - return -err; + return sock_error(sk); } if (flags|| msg->msg_accrights) @@ -1820,34 +1820,6 @@ } -static int ax25_sendto(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = (void *)ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return ax25_sendmsg(sock, &msg, size, noblock, flags); -} - -static int ax25_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags) -{ - return ax25_sendto(sock, ubuf, size, noblock, flags, NULL, 0); -} - -static int ax25_write(struct socket *sock, const char *ubuf, int size, int noblock) -{ - return ax25_sendto(sock, ubuf, size, noblock, 0, NULL, 0); -} - static int ax25_recvmsg(struct socket *sock, struct msghdr *msg, int size, int noblock, int flags, int *addr_len) { struct sock *sk = (struct sock *)sock->data; @@ -1857,11 +1829,7 @@ int er; if (sk->err) { - cli(); - er = -sk->err; - sk->err = 0; - sti(); - return er; + return sock_error(sk); } if (addr_len != NULL) @@ -1928,42 +1896,6 @@ return copied; } -static int ax25_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = 0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return ax25_recvmsg(sock, &msg, size, noblock, flags, addr_len); -} - -static int ax25_recv(struct socket *sock, void *ubuf, int size , int noblock, - unsigned flags) -{ - struct sock *sk = (struct sock *)sock->data; - - if (sk->zapped) - return -ENOTCONN; - - return ax25_recvfrom(sock, ubuf, size, noblock, flags, NULL, NULL); -} - -static int ax25_read(struct socket *sock, char *ubuf, int size, int noblock) -{ - return ax25_recv(sock, ubuf, size, noblock, 0); -} - static int ax25_shutdown(struct socket *sk, int how) { /* FIXME - generate DM and RNR states */ @@ -2143,15 +2075,9 @@ ax25_socketpair, ax25_accept, ax25_getname, - ax25_read, - ax25_write, ax25_select, ax25_ioctl, ax25_listen, - ax25_send, - ax25_recv, - ax25_sendto, - ax25_recvfrom, ax25_shutdown, ax25_setsockopt, ax25_getsockopt, diff -u --recursive --new-file v1.3.37/linux/net/core/datagram.c linux/net/core/datagram.c --- v1.3.37/linux/net/core/datagram.c Mon Oct 23 18:02:21 1995 +++ linux/net/core/datagram.c Mon Nov 6 12:59:00 1995 @@ -74,9 +74,7 @@ if(sk->err) { release_sock(sk); - cli(); - *err=-sk->err; - sk->err=0; + *err=sock_error(sk); restore_flags(intflags); return NULL; } @@ -115,8 +113,7 @@ eg an icmp sent earlier by the peer has finally turned up now */ { - *err = -sk->err; - sk->err=0; + *err = sock_error(sk); restore_flags(intflags); return NULL; } diff -u --recursive --new-file v1.3.37/linux/net/core/dev.c linux/net/core/dev.c --- v1.3.37/linux/net/core/dev.c Mon Oct 23 18:02:21 1995 +++ linux/net/core/dev.c Mon Nov 6 12:59:00 1995 @@ -34,19 +34,14 @@ * Alan Cox : Network driver sets packet type before calling netif_rx. Saves * a function call a packet. * Alan Cox : Hashed net_bh() - * Richard Kooijman : Timestamp fixes. + * Richard Kooijman: Timestamp fixes. * Alan Cox : Wrong field in SIOCGIFDSTADDR * Alan Cox : Device lock protection. * Alan Cox : Fixed nasty side effect of device close changes. + * Rudi Cilibrasi : Pass the right thing to set_mac_address() * - * Cleaned up and recommented by Alan Cox 2nd April 1994. I hope to have - * the rest as well commented in the end. */ -/* - * A lot of these includes will be going walkies very soon - */ - #include #include #include @@ -588,7 +583,7 @@ * useful will emerge. */ -volatile char in_bh = 0; /* Non-reentrant remember */ +volatile unsigned long in_bh = 0; /* Non-reentrant remember */ int in_net_bh() /* Used by timer.c */ { @@ -1050,26 +1045,50 @@ break; case SIOCGIFADDR: /* Get interface address (and family) */ - (*(struct sockaddr_in *) - &ifr.ifr_addr).sin_addr.s_addr = dev->pa_addr; - (*(struct sockaddr_in *) - &ifr.ifr_addr).sin_family = dev->family; - (*(struct sockaddr_in *) - &ifr.ifr_addr).sin_port = 0; + if(ifr.ifr_addr.sa_family==AF_UNSPEC) + { + memcpy(ifr.ifr_hwaddr.sa_data,dev->dev_addr, MAX_ADDR_LEN); + ifr.ifr_hwaddr.sa_family=dev->type; + goto rarok; + } + else + { + (*(struct sockaddr_in *) + &ifr.ifr_addr).sin_addr.s_addr = dev->pa_addr; + (*(struct sockaddr_in *) + &ifr.ifr_addr).sin_family = dev->family; + (*(struct sockaddr_in *) + &ifr.ifr_addr).sin_port = 0; + } goto rarok; case SIOCSIFADDR: /* Set interface address (and family) */ - dev->pa_addr = (*(struct sockaddr_in *) - &ifr.ifr_addr).sin_addr.s_addr; - dev->family = ifr.ifr_addr.sa_family; + + /* + * BSDism. SIOCSIFADDR family=AF_UNSPEC sets the + * physical address. We can cope with this now. + */ + + if(ifr.ifr_addr.sa_family==AF_UNSPEC) + { + if(dev->set_mac_address==NULL) + return -EOPNOTSUPP; + ret=dev->set_mac_address(dev,&ifr.ifr_addr); + } + else + { + dev->pa_addr = (*(struct sockaddr_in *) + &ifr.ifr_addr).sin_addr.s_addr; + dev->family = ifr.ifr_addr.sa_family; #ifdef CONFIG_INET - /* This is naughty. When net-032e comes out It wants moving into the net032 - code not the kernel. Till then it can sit here (SIGH) */ - dev->pa_mask = ip_get_mask(dev->pa_addr); + /* This is naughty. When net-032e comes out It wants moving into the net032 + code not the kernel. Till then it can sit here (SIGH) */ + dev->pa_mask = ip_get_mask(dev->pa_addr); #endif - dev->pa_brdaddr = dev->pa_addr | ~dev->pa_mask; - ret = 0; + dev->pa_brdaddr = dev->pa_addr | ~dev->pa_mask; + ret = 0; + } break; case SIOCGIFBRDADDR: /* Get the broadcast address */ @@ -1161,10 +1180,6 @@ ret = -EINVAL; break; - case OLD_SIOCGIFHWADDR: /* Get the hardware address. This will change and SIFHWADDR will be added */ - memcpy(ifr.old_ifr_hwaddr,dev->dev_addr, MAX_ADDR_LEN); - goto rarok; - case SIOCGIFHWADDR: memcpy(ifr.ifr_hwaddr.sa_data,dev->dev_addr, MAX_ADDR_LEN); ifr.ifr_hwaddr.sa_family=dev->type; @@ -1175,7 +1190,7 @@ return -EOPNOTSUPP; if(ifr.ifr_hwaddr.sa_family!=dev->type) return -EINVAL; - ret=dev->set_mac_address(dev,ifr.ifr_hwaddr.sa_data); + ret=dev->set_mac_address(dev,&ifr.ifr_hwaddr); break; case SIOCGIFMAP: @@ -1260,7 +1275,6 @@ case SIOCGIFMEM: case SIOCGIFHWADDR: case SIOCSIFHWADDR: - case OLD_SIOCGIFHWADDR: case SIOCGIFSLAVE: case SIOCGIFMAP: return dev_ifsioc(arg, cmd); diff -u --recursive --new-file v1.3.37/linux/net/core/firewall.c linux/net/core/firewall.c --- v1.3.37/linux/net/core/firewall.c Sun Oct 29 11:38:49 1995 +++ linux/net/core/firewall.c Mon Nov 6 12:59:01 1995 @@ -23,8 +23,6 @@ if(pf<0||pf>=NPROTO) return -EINVAL; - if(pf!=PF_INET) - return -ENOPROTOOPT; /* * Don't allow two people to adjust at once. @@ -69,8 +67,6 @@ if(pf<0||pf>=NPROTO) return -EINVAL; - if(pf!=PF_INET) - return -ENOPROTOOPT; /* * Don't allow two people to adjust at once. diff -u --recursive --new-file v1.3.37/linux/net/core/iovec.c linux/net/core/iovec.c --- v1.3.37/linux/net/core/iovec.c Mon Oct 23 18:02:22 1995 +++ linux/net/core/iovec.c Mon Oct 30 08:36:00 1995 @@ -12,7 +12,6 @@ */ -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/net/core/skbuff.c linux/net/core/skbuff.c --- v1.3.37/linux/net/core/skbuff.c Sun Oct 29 11:38:49 1995 +++ linux/net/core/skbuff.c Mon Nov 6 12:59:01 1995 @@ -9,6 +9,7 @@ * Dave Platt : Interrupt stacking fix. * Richard Kooijman : Timestamp fixes. * Alan Cox : Changed buffer format. + * Alan Cox : destructor hook for AF_UNIX etc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -460,6 +461,8 @@ if (skb->next) printk("Warning: kfree_skb passed an skb still on a list (from %p).\n", __builtin_return_address(0)); + if(skb->destructor) + skb->destructor(skb); if (skb->sk) { if(skb->sk->prot!=NULL) @@ -565,6 +568,7 @@ skb->tail=bptr; skb->end=bptr+len; skb->len=0; + skb->destructor=NULL; return skb; } diff -u --recursive --new-file v1.3.37/linux/net/ipv4/Makefile linux/net/ipv4/Makefile --- v1.3.37/linux/net/ipv4/Makefile Mon Oct 23 18:02:22 1995 +++ linux/net/ipv4/Makefile Mon Oct 30 08:41:50 1995 @@ -11,11 +11,15 @@ IPV4_OBJS := utils.o route.o proc.o timer.o protocol.o packet.o \ arp.o ip_input.o ip_fragment.o ip_forward.o ip_options.o \ ip_output.o ip_sockglue.o raw.o icmp.o tcp.o udp.o \ - devinet.o af_inet.o igmp.o ip_fw.o ipmr.o + devinet.o af_inet.o igmp.o ip_fw.o MOD_LIST_NAME := IPV4_MODULES M_OBJS := +ifeq ($(CONFIG_IP_MROUTE),y) +IPV4_OBJS += ipmr.o +endif + ifeq ($(CONFIG_INET_RARP),y) IPV4_OBJS += rarp.o else @@ -25,11 +29,8 @@ endif ifeq ($(CONFIG_NET_IPIP),y) -IPV4_OBJS := $(IPV4_OBJS) ipip.o +IPV4_OBJS += ipip.o endif - - - ifdef CONFIG_INET O_OBJS := $(IPV4_OBJS) diff -u --recursive --new-file v1.3.37/linux/net/ipv4/af_inet.c linux/net/ipv4/af_inet.c --- v1.3.37/linux/net/ipv4/af_inet.c Sun Oct 29 11:38:49 1995 +++ linux/net/ipv4/af_inet.c Tue Nov 7 08:59:26 1995 @@ -45,6 +45,7 @@ * listen. * Germano Caronni : Assorted small races. * Alan Cox : sendmsg/recvmsg basic support. + * Alan Cox : Only sendmsg/recvmsg now supported. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -657,78 +658,6 @@ sk->cong_window = 1; /* start with only sending one packet at a time. */ sk->priority = 1; sk->state = TCP_CLOSE; -#ifdef WHAT_WE_DO_THE_MEMZERO_INSTEAD_OF - sk->stamp.tv_sec=0; - sk->wmem_alloc = 0; - sk->rmem_alloc = 0; - sk->pair = NULL; - sk->opt = NULL; - sk->write_seq = 0; - sk->acked_seq = 0; - sk->copied_seq = 0; - sk->fin_seq = 0; - sk->urg_seq = 0; - sk->urg_data = 0; - sk->proc = 0; - sk->rtt = 0; /*TCP_WRITE_TIME << 3;*/ - sk->mdev = 0; - sk->backoff = 0; - sk->packets_out = 0; - sk->cong_count = 0; - sk->ssthresh = 0; - sk->max_window = 0; - sk->urginline = 0; - sk->intr = 0; - sk->linger = 0; - sk->destroy = 0; - sk->shutdown = 0; - sk->keepopen = 0; - sk->zapped = 0; - sk->done = 0; - sk->ack_backlog = 0; - sk->window = 0; - sk->bytes_rcv = 0; - sk->dead = 0; - sk->ack_timed = 0; - sk->partial = NULL; - sk->user_mss = 0; - sk->debug = 0; - /* how many packets we should send before forcing an ack. - if this is set to zero it is the same as sk->delay_acks = 0 */ - sk->max_ack_backlog = 0; - sk->inuse = 0; - sk->delay_acks = 0; - sk->daddr = 0; - sk->saddr = 0; - sk->rcv_saddr = 0; - sk->err = 0; - sk->next = NULL; - sk->pair = NULL; - sk->send_tail = NULL; - sk->send_head = NULL; - sk->timeout = 0; - sk->broadcast = 0; - sk->localroute = 0; - sk->blog = 0; - sk->dummy_th.res1=0; - sk->dummy_th.res2=0; - sk->dummy_th.urg_ptr = 0; - sk->dummy_th.fin = 0; - sk->dummy_th.syn = 0; - sk->dummy_th.rst = 0; - sk->dummy_th.psh = 0; - sk->dummy_th.ack = 0; - sk->dummy_th.urg = 0; - sk->dummy_th.dest = 0; - sk->ip_tos=0; - sk->ip_route_cache=NULL; - sk->ip_hcache_ver= 0; - sk->ip_option_len=0; - sk->ip_option_flen=0; - sk->ip_opt_next_hop=0; - sk->ip_opt_ptr[0]=NULL; - sk->ip_opt_ptr[1]=NULL; -#endif /* this is how many unacked bytes we will accept for this socket. */ sk->max_unacked = 2048; /* needs to be at most 2 full packets. */ @@ -894,6 +823,13 @@ unsigned short snum = 0 /* Stoopid compiler.. this IS ok */; int chk_addr_ret; + /* + * If the socket has its own bind function then use it. + */ + + if(sk->prot->bind) + return sk->prot->bind(sk,uaddr, addr_len); + /* check this error. */ if (sk->state != TCP_CLOSE) return(-EIO); @@ -984,22 +920,6 @@ } /* - * Handle sk->err properly. The cli/sti matter. - */ - -static int inet_error(struct sock *sk) -{ - unsigned long flags; - int err; - save_flags(flags); - cli(); - err=sk->err; - sk->err=0; - restore_flags(flags); - return -err; -} - -/* * Connect to a remote host. There is regrettably still a little * TCP 'magic' in here. */ @@ -1021,7 +941,7 @@ if (sock->state == SS_CONNECTING && sk->protocol == IPPROTO_TCP && (flags & O_NONBLOCK)) { if(sk->err!=0) - return inet_error(sk); + return sock_error(sk); return -EALREADY; /* Connecting is currently in progress */ } if (sock->state != SS_CONNECTING) @@ -1040,7 +960,7 @@ if (sk->state > TCP_FIN_WAIT2 && sock->state==SS_CONNECTING) { sock->state=SS_UNCONNECTED; - return inet_error(sk); + return sock_error(sk); } if (sk->state != TCP_ESTABLISHED &&(flags & O_NONBLOCK)) @@ -1061,7 +981,7 @@ { sock->state = SS_UNCONNECTED; sti(); - return inet_error(sk); /* set by tcp_err() */ + return sock_error(sk); /* set by tcp_err() */ } } sti(); @@ -1070,7 +990,7 @@ if (sk->state != TCP_ESTABLISHED && sk->err) { sock->state = SS_UNCONNECTED; - return inet_error(sk); + return sock_error(sk); } return(0); } @@ -1120,7 +1040,7 @@ sk2 = sk1->prot->accept(sk1,flags); if (sk2 == NULL) { - return inet_error(sk1); + return sock_error(sk1); } } newsock->data = (void *)sk2; @@ -1148,7 +1068,7 @@ if (sk2->state != TCP_ESTABLISHED && sk2->err > 0) { - err = inet_error(sk2); + err = sock_error(sk2); sk2->dead=1; destroy_sock(sk2); newsock->data = NULL; @@ -1194,25 +1114,6 @@ } -/* - * The assorted BSD I/O operations - */ - -static int inet_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, - unsigned flags, struct sockaddr *sin, int *addr_len ) -{ - struct sock *sk = (struct sock *) sock->data; - - if (sk->prot->recvfrom == NULL) - return(-EOPNOTSUPP); - if(sk->err) - return inet_error(sk); - /* We may need to bind the socket. */ - if(inet_autobind(sk)!=0) - return(-EAGAIN); - return(sk->prot->recvfrom(sk, (unsigned char *) ubuf, size, noblock, flags, - (struct sockaddr_in*)sin, addr_len)); -} static int inet_recvmsg(struct socket *sock, struct msghdr *ubuf, int size, int noblock, int flags, int *addr_len ) @@ -1222,7 +1123,7 @@ if (sk->prot->recvmsg == NULL) return(-EOPNOTSUPP); if(sk->err) - return inet_error(sk); + return sock_error(sk); /* We may need to bind the socket. */ if(inet_autobind(sk)!=0) return(-EAGAIN); @@ -1230,67 +1131,6 @@ } -static int inet_recv(struct socket *sock, void *ubuf, int size, int noblock, - unsigned flags) -{ - /* BSD explicitly states these are the same - so we do it this way to be sure */ - return inet_recvfrom(sock,ubuf,size,noblock,flags,NULL,NULL); -} - -static int inet_read(struct socket *sock, char *ubuf, int size, int noblock) -{ - struct sock *sk = (struct sock *) sock->data; - - if(sk->err) - return inet_error(sk); - /* We may need to bind the socket. */ - if(inet_autobind(sk)) - return(-EAGAIN); - return(sk->prot->read(sk, (unsigned char *) ubuf, size, noblock, 0)); -} - -static int inet_send(struct socket *sock, const void *ubuf, int size, int noblock, - unsigned flags) -{ - struct sock *sk = (struct sock *) sock->data; - if (sk->shutdown & SEND_SHUTDOWN) - { - send_sig(SIGPIPE, current, 1); - return(-EPIPE); - } - if(sk->err) - return inet_error(sk); - /* We may need to bind the socket. */ - if(inet_autobind(sk)!=0) - return(-EAGAIN); - return(sk->prot->write(sk, (const unsigned char *) ubuf, size, noblock, flags)); -} - -static int inet_write(struct socket *sock, const char *ubuf, int size, int noblock) -{ - return inet_send(sock,ubuf,size,noblock,0); -} - -static int inet_sendto(struct socket *sock, const void *ubuf, int size, int noblock, - unsigned flags, struct sockaddr *sin, int addr_len) -{ - struct sock *sk = (struct sock *) sock->data; - if (sk->shutdown & SEND_SHUTDOWN) - { - send_sig(SIGPIPE, current, 1); - return(-EPIPE); - } - if (sk->prot->sendto == NULL) - return(-EOPNOTSUPP); - if(sk->err) - return inet_error(sk); - /* We may need to bind the socket. */ - if(inet_autobind(sk)!=0) - return -EAGAIN; - return(sk->prot->sendto(sk, (const unsigned char *) ubuf, size, noblock, flags, - (struct sockaddr_in *)sin, addr_len)); -} - static int inet_sendmsg(struct socket *sock, struct msghdr *msg, int size, int noblock, int flags) { @@ -1303,7 +1143,7 @@ if (sk->prot->sendmsg == NULL) return(-EOPNOTSUPP); if(sk->err) - return inet_error(sk); + return sock_error(sk); /* We may need to bind the socket. */ if(inet_autobind(sk)!=0) return -EAGAIN; @@ -1424,7 +1264,6 @@ case SIOCSIFLINK: case SIOCGIFHWADDR: case SIOCSIFHWADDR: - case OLD_SIOCGIFHWADDR: case SIOCSIFMAP: case SIOCGIFMAP: case SIOCSIFSLAVE: @@ -1597,15 +1436,9 @@ inet_socketpair, inet_accept, inet_getname, - inet_read, - inet_write, inet_select, inet_ioctl, inet_listen, - inet_send, - inet_recv, - inet_sendto, - inet_recvfrom, inet_shutdown, inet_setsockopt, inet_getsockopt, diff -u --recursive --new-file v1.3.37/linux/net/ipv4/arp.c linux/net/ipv4/arp.c --- v1.3.37/linux/net/ipv4/arp.c Sat Sep 9 15:26:53 1995 +++ linux/net/ipv4/arp.c Mon Nov 6 12:59:01 1995 @@ -45,6 +45,7 @@ * Germano Caronni : Assorted subtle races. * Craig Schlenter : Don't modify permanent entry * during arp_rcv. + * Russ Nelson : Tidied up a few bits. */ /* RFC1122 Status: @@ -293,7 +294,7 @@ * Purge a device from the ARP queue */ -int arp_device_event(unsigned long event, void *ptr) +int arp_device_event(struct notifier_block *this, unsigned long event, void *ptr) { struct device *dev=ptr; int i; @@ -603,7 +604,7 @@ unsigned char *arp_ptr= (unsigned char *)(arp+1); struct arp_table *entry; struct arp_table *proxy_entry; - int addr_hint,hlen,htype; + int hlen,htype; unsigned long hash; unsigned char ha[MAX_ADDR_LEN]; /* So we can enable ints again. */ unsigned char *sha,*tha; @@ -720,31 +721,8 @@ * cache. */ - addr_hint = ip_chk_addr(tip); - - if(arp->ar_op == htons(ARPOP_REPLY)) - { - if(addr_hint!=IS_MYADDR) - { -/* - * Replies to other machines get tossed. - */ - - /* Should we reset the expiry timers for an entry that isn't for us, if we */ - /* have it in the cache? RFC1122 suggests it. -- MS */ - - kfree_skb(skb, FREE_READ); - return 0; - } -/* - * Fall through to code below that adds sender to cache. - */ - } - else + if(arp->ar_op == htons(ARPOP_REQUEST)) { -/* - * It is now an arp request - */ /* * Only reply for the real device address or when it's in our proxy tables */ @@ -796,8 +774,17 @@ arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr); } } - - +/* + * It is now an arp reply. + */ + if(ip_chk_addr(tip)!=IS_MYADDR) + { +/* + * Replies to other machines get tossed. + */ + kfree_skb(skb, FREE_READ); + return 0; + } /* * Now all replies are handled. Next, anything that falls through to here * needs to be added to the arp cache, or have its entry updated if it is diff -u --recursive --new-file v1.3.37/linux/net/ipv4/devinet.c linux/net/ipv4/devinet.c --- v1.3.37/linux/net/ipv4/devinet.c Tue Oct 10 18:46:39 1995 +++ linux/net/ipv4/devinet.c Mon Oct 30 08:37:31 1995 @@ -15,7 +15,6 @@ * Alan Cox, */ -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/net/ipv4/ip_fragment.c linux/net/ipv4/ip_fragment.c --- v1.3.37/linux/net/ipv4/ip_fragment.c Sun Oct 29 11:38:50 1995 +++ linux/net/ipv4/ip_fragment.c Mon Oct 30 10:37:20 1995 @@ -12,7 +12,6 @@ * Alan Cox : Split from ip.c , see ip_input.c for history. */ -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/net/ipv4/ip_options.c linux/net/ipv4/ip_options.c --- v1.3.37/linux/net/ipv4/ip_options.c Sun Oct 29 11:38:50 1995 +++ linux/net/ipv4/ip_options.c Mon Oct 30 10:37:20 1995 @@ -9,7 +9,6 @@ * */ -#include #include #include #include diff -u --recursive --new-file v1.3.37/linux/net/ipv4/ip_output.c linux/net/ipv4/ip_output.c --- v1.3.37/linux/net/ipv4/ip_output.c Sun Oct 29 11:38:50 1995 +++ linux/net/ipv4/ip_output.c Mon Nov 6 12:59:01 1995 @@ -1077,7 +1077,7 @@ * Device notifier */ -static int ip_rt_event(unsigned long event, void *ptr) +static int ip_rt_event(struct notifier_block *this, unsigned long event, void *ptr) { struct device *dev=ptr; if(event==NETDEV_DOWN) diff -u --recursive --new-file v1.3.37/linux/net/ipv4/ipip.c linux/net/ipv4/ipip.c --- v1.3.37/linux/net/ipv4/ipip.c Mon Oct 23 18:02:23 1995 +++ linux/net/ipv4/ipip.c Mon Nov 6 12:59:01 1995 @@ -10,6 +10,7 @@ * Alan Cox : Fixed bug with 1.3.18 and IPIP not working (now needs to set skb->h.iph) * to keep ip_forward happy. * Alan Cox : More fixes for 1.3.21, and firewall fix. Maybe this will work soon 8). + * Kai Schulte : Fixed #defines for IP_FIREWALL->FIREWALL * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,20 +35,11 @@ #include #include -/* - * NB. we must include the kernel idenfication string in to install the module. - */ - -#if ( defined(CONFIG_NET_IPIP) && defined(CONFIG_IP_FORWARD)) || defined(MODULE) -#ifdef MODULE +#include + #include -#include -static char kernel_version[] = UTS_RELEASE; -#else -#define MOD_INC_USE_COUNT -#define MOD_DEC_USE_COUNT -#endif +#if ( defined(CONFIG_NET_IPIP) && defined(CONFIG_IP_FORWARD)) || defined(MODULE) /* @@ -63,7 +55,7 @@ __u32 daddr, unsigned short len, __u32 saddr, int redo, struct inet_protocol *protocol) { -#ifdef CONFIG_IP_FIREWALL +#ifdef CONFIG_FIREWALL int err; #endif /* Don't unlink in the middle of a turnaround */ diff -u --recursive --new-file v1.3.37/linux/net/ipv4/ipmr.c linux/net/ipv4/ipmr.c --- v1.3.37/linux/net/ipv4/ipmr.c Fri Oct 13 14:44:48 1995 +++ linux/net/ipv4/ipmr.c Mon Nov 6 12:59:01 1995 @@ -48,8 +48,6 @@ #include #include -#ifdef CONFIG_IP_MROUTE - /* * Multicast router conrol variables */ @@ -669,7 +667,7 @@ /* The timer will clear any 'pending' stuff */ } -static int ipmr_device_event(unsigned long event, void *ptr) +static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr) { struct vif_device *v; int ct; @@ -915,5 +913,3 @@ ipmr_mfc_info }); } - -#endif diff -u --recursive --new-file v1.3.37/linux/net/ipv4/packet.c linux/net/ipv4/packet.c --- v1.3.37/linux/net/ipv4/packet.c Mon Oct 23 18:02:23 1995 +++ linux/net/ipv4/packet.c Mon Nov 6 12:59:01 1995 @@ -198,37 +198,6 @@ return(len); } -static int packet_sendto(struct sock *sk, const unsigned char *from, int len, - int noblock, unsigned flags, struct sockaddr_in *usin, - int addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = (void *)from; - iov.iov_len = len; - - msg.msg_name = (void *)usin; - msg.msg_namelen = addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return packet_sendmsg(sk, &msg, len, noblock, flags); -} - - -/* - * A write to a SOCK_PACKET can't actually do anything useful and will - * always fail but we include it for completeness and future expansion. - */ - -static int packet_write(struct sock *sk, const unsigned char *buff, - int len, int noblock, unsigned flags) -{ - return(packet_sendto(sk, buff, len, noblock, flags, NULL, 0)); -} - /* * Close a SOCK_PACKET socket. This is fairly simple. We immediately go * to 'closed' state and remove our protocol entry in the device list. @@ -238,27 +207,45 @@ static void packet_close(struct sock *sk, int timeout) { + /* + * Stop more data and kill the socket off. + */ + sk->inuse = 1; sk->state = TCP_CLOSE; - dev_remove_pack((struct packet_type *)sk->pair); - kfree_s((void *)sk->pair, sizeof(struct packet_type)); - sk->pair = NULL; + + /* + * Unhook the notifier + */ + + unregister_netdevice_notifier(&sk->protinfo.af_packet.notifier); + + if(sk->protinfo.af_packet.prot_hook) + { + /* + * Remove the protocol hook + */ + + dev_remove_pack((struct packet_type *)sk->protinfo.af_packet.prot_hook); + + /* + * Dispose of litter carefully. + */ + + kfree_s((void *)sk->protinfo.af_packet.prot_hook, sizeof(struct packet_type)); + sk->protinfo.af_packet.prot_hook = NULL; + } + release_sock(sk); } /* - * Create a packet of type SOCK_PACKET. We do one slightly irregular - * thing here that wants tidying up. We borrow the 'pair' pointer in - * the socket object so we can find the packet_type entry in the - * device list. The reverse is easy as we use the data field of the - * packet type to point to our socket. + * Attach a packer hook to a device. */ -static int packet_init(struct sock *sk) +int packet_attach(struct sock *sk) { - struct packet_type *p; - - p = (struct packet_type *) kmalloc(sizeof(*p), GFP_KERNEL); + struct packet_type *p = (struct packet_type *) kmalloc(sizeof(*p), GFP_KERNEL); if (p == NULL) return(-ENOMEM); @@ -272,7 +259,113 @@ * We need to remember this somewhere. */ - sk->pair = (struct sock *)p; + sk->protinfo.af_packet.prot_hook = p; + return 0; +} + +/* + * Bind a packet socket to a device + */ + +static int packet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) +{ + char dev[15]; + + /* + * Check legality + */ + + if(addr_len!=sizeof(struct sockaddr)) + return -EINVAL; + strncpy(dev,uaddr->sa_data,14); + dev[14]=0; + + /* + * Lock the device chain while we sanity check + * the bind request. + */ + + dev_lock_list(); + if((sk->protinfo.af_packet.bound_dev=dev_get(dev))==NULL) + { + dev_unlock_list(); + return -ENODEV; + } + if(!(sk->protinfo.af_packet.bound_dev->flags&IFF_UP)) + { + dev_unlock_list(); + return -ENETDOWN; + } + + /* + * Perform the request. + */ + + memcpy(sk->protinfo.af_packet.device_name,dev,15); + if(sk->protinfo.af_packet.prot_hook) + dev_remove_pack(sk->protinfo.af_packet.prot_hook); + else + { + int err=packet_attach(sk); + if(err) + { + dev_unlock_list(); + return err; + } + } + sk->protinfo.af_packet.prot_hook->dev=sk->protinfo.af_packet.bound_dev; + dev_add_pack(sk->protinfo.af_packet.prot_hook); + /* + * Now the notifier is set up right this lot is safe. + */ + dev_unlock_list(); + return 0; +} + +/* + * This hook is called when a device goes up or down so that + * SOCK_PACKET sockets can come unbound properly. + */ + +static int packet_unbind(struct notifier_block *this, unsigned long msg, void *data) +{ + struct inet_packet_opt *ipo=(struct inet_packet_opt *)this; + if(msg==NETDEV_DOWN && data==ipo->bound_dev) + { + /* + * Our device has gone down. + */ + ipo->bound_dev=NULL; + dev_remove_pack(ipo->prot_hook); + kfree(ipo->prot_hook); + ipo->prot_hook=NULL; + } + return NOTIFY_DONE; +} + + +/* + * Create a packet of type SOCK_PACKET. + */ + +static int packet_init(struct sock *sk) +{ + /* + * Attach a protocol block + */ + + int err=packet_attach(sk); + if(err) + return err; + + /* + * Set up the per socket notifier. + */ + + sk->protinfo.af_packet.notifier.notifier_call=packet_unbind; + sk->protinfo.af_packet.notifier.priority=0; + + register_netdevice_notifier(&sk->protinfo.af_packet.notifier); return(0); } @@ -295,6 +388,13 @@ return(0); /* + * If there is no protocol hook then the device is down. + */ + + if(sk->protinfo.af_packet.prot_hook==NULL) + return -ENETDOWN; + + /* * If the address length field is there to be filled in, we fill * it in now. */ @@ -354,40 +454,6 @@ return(copied); } -static int packet_recvfrom(struct sock *sk, unsigned char *ubuf, int size, int noblock, unsigned flags, - struct sockaddr_in *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = 0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return packet_recvmsg(sk, &msg, size, noblock, flags, addr_len); -} - - - -/* - * A packet read can succeed and is just the same as a recvfrom but without the - * addresses being recorded. - */ - -int packet_read(struct sock *sk, unsigned char *buff, - int len, int noblock, unsigned flags) -{ - return(packet_recvfrom(sk, buff, len, noblock, flags, NULL, NULL)); -} - - /* * This structure declares to the lower layer socket subsystem currently * incorrectly embedded in the IP code how to behave. This interface needs @@ -397,10 +463,6 @@ struct proto packet_prot = { packet_close, - packet_read, - packet_write, - packet_sendto, - packet_recvfrom, ip_build_header, /* Not actually used */ NULL, NULL, @@ -417,8 +479,11 @@ NULL, packet_sendmsg, /* Sendmsg */ packet_recvmsg, /* Recvmsg */ + packet_bind, /* Bind */ 128, 0, "PACKET", 0, 0 }; + + diff -u --recursive --new-file v1.3.37/linux/net/ipv4/rarp.c linux/net/ipv4/rarp.c --- v1.3.37/linux/net/ipv4/rarp.c Fri Aug 18 08:44:59 1995 +++ linux/net/ipv4/rarp.c Mon Nov 6 12:59:01 1995 @@ -163,7 +163,7 @@ sti(); } -static int rarp_device_event(unsigned long event, void *ptr) +static int rarp_device_event(struct notifier_block *this, unsigned long event, void *ptr) { if(event!=NETDEV_DOWN) return NOTIFY_DONE; diff -u --recursive --new-file v1.3.37/linux/net/ipv4/raw.c linux/net/ipv4/raw.c --- v1.3.37/linux/net/ipv4/raw.c Sun Oct 29 11:38:50 1995 +++ linux/net/ipv4/raw.c Mon Nov 6 13:47:51 1995 @@ -57,6 +57,8 @@ #include #include +#include + #ifdef CONFIG_IP_MROUTE struct sock *mroute_socket=NULL; #endif @@ -234,14 +236,41 @@ return err<0?err:len; } - -static int raw_write(struct sock *sk, const unsigned char *buff, int len, int noblock, - unsigned flags) +/* + * Temporary + */ + +static int raw_sendmsg(struct sock *sk, struct msghdr *msg, + int len, int noblock, int flags) { - return(raw_sendto(sk, buff, len, noblock, flags, NULL, 0)); + if(msg->msg_iovlen==1) + return raw_sendto(sk,msg->msg_iov[0].iov_base,len, noblock, flags, msg->msg_name, msg->msg_namelen); + else + { + /* + * For awkward cases we linearise the buffer first. In theory this is only frames + * whose iovec's don't split on 4 byte boundaries, and soon encrypted stuff (to keep + * skip happy). We are a bit more general about it. + */ + + unsigned char *buf; + int fs; + int err; + if(len>65515) + return -EMSGSIZE; + buf=kmalloc(len, GFP_KERNEL); + if(buf==NULL) + return -ENOBUFS; + memcpy_fromiovec(buf, msg->msg_iov, len); + fs=get_fs(); + set_fs(get_fs()); + err=raw_sendto(sk,buf,len, noblock, flags, msg->msg_name, msg->msg_namelen); + set_fs(fs); + kfree_s(buf,len); + return err; + } } - static void raw_close(struct sock *sk, int timeout) { sk->state = TCP_CLOSE; @@ -304,38 +333,8 @@ } -static int raw_recvfrom(struct sock *sk, unsigned char *ubuf, int size, int noblock, unsigned flags, - struct sockaddr_in *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = 0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return raw_recvmsg(sk, &msg, size, noblock, flags, addr_len); -} - -int raw_read (struct sock *sk, unsigned char *buff, int len, int noblock, unsigned flags) -{ - return(raw_recvfrom(sk, buff, len, noblock, flags, NULL, NULL)); -} - - struct proto raw_prot = { raw_close, - raw_read, - raw_write, - raw_sendto, - raw_recvfrom, ip_build_header, udp_connect, NULL, @@ -354,8 +353,9 @@ NULL, ip_setsockopt, ip_getsockopt, - NULL, + raw_sendmsg, raw_recvmsg, + NULL, /* No special bind */ 128, 0, "RAW", diff -u --recursive --new-file v1.3.37/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c --- v1.3.37/linux/net/ipv4/tcp.c Sun Oct 29 11:38:50 1995 +++ linux/net/ipv4/tcp.c Mon Nov 6 12:59:01 1995 @@ -176,6 +176,7 @@ * Marc Tamsky : Closing in closing fixes. * Mike Shaver : RFC1122 verifications. * Alan Cox : rcv_saddr errors. + * Alan Cox : Block double connect() * * * To Fix: @@ -1697,9 +1698,7 @@ release_sock(sk); if (copied) return(copied); - tmp = -sk->err; - sk->err = 0; - return(tmp); + return sock_error(sk); } /* @@ -1727,9 +1726,7 @@ release_sock(sk); if (copied) return(copied); - tmp = -sk->err; - sk->err = 0; - return(tmp); + return sock_error(sk); } if (sk->state != TCP_SYN_SENT && sk->state != TCP_SYN_RECV) @@ -1739,11 +1736,7 @@ return(copied); if (sk->err) - { - tmp = -sk->err; - sk->err = 0; - return(tmp); - } + return sock_error(sk); if (sk->keepopen) { @@ -1996,30 +1989,6 @@ return(copied); } -static int tcp_sendto(struct sock *sk, const unsigned char *ubuf, int size, int noblock, unsigned flags, - struct sockaddr_in *sin, int addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = (void *)ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sin; - msg.msg_namelen = addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return tcp_sendmsg(sk, &msg, size, noblock, flags); -} - -static int tcp_write(struct sock *sk, const unsigned char *ubuf, int size, int noblock, unsigned flags) -{ - return tcp_sendto(sk,ubuf,size,noblock,flags,NULL,0); -} - - /* * Send an ack if one is backlogged at this point. Ought to merge * this with tcp_send_ack(). @@ -2205,12 +2174,8 @@ return -EINVAL; /* Yes this is right ! */ if (sk->err) - { - int tmp = -sk->err; - sk->err = 0; - return tmp; - } - + return sock_error(sk); + if (sk->state == TCP_CLOSE || sk->done) { if (!sk->done) @@ -2341,8 +2306,7 @@ if (sk->err) { - copied = -sk->err; - sk->err = 0; + copied = -xchg(&sk->err,0); break; } @@ -2500,32 +2464,6 @@ } -static int tcp_recvfrom(struct sock *sk, unsigned char *ubuf, int size, int noblock, unsigned flags, - struct sockaddr_in *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = (void *)ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = 0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return tcp_recvmsg(sk, &msg, size, noblock, flags, addr_len); -} - -int tcp_read(struct sock *sk, unsigned char *buff, int len, int noblock, - unsigned flags) -{ - return(tcp_recvfrom(sk, buff, len, noblock, flags, NULL, NULL)); -} - /* * State processing on a close. This implements the state shift for @@ -4531,9 +4469,14 @@ struct rtable *rt; if (sk->state != TCP_CLOSE) - { return(-EISCONN); - } + + /* + * Don't allow a double connect. + */ + + if(sk->daddr) + return -EINVAL; if (addr_len < 8) return(-EINVAL); @@ -4580,9 +4523,9 @@ */ if (sk->localroute) - rt=ip_rt_local(sk->daddr, NULL, sk->saddr ? NULL : &sk->saddr); + rt=ip_rt_local(sk->daddr, NULL, sk->saddr ? NULL : &sk->saddr); else - rt=ip_rt_route(sk->daddr, NULL, sk->saddr ? NULL : &sk->saddr); + rt=ip_rt_route(sk->daddr, NULL, sk->saddr ? NULL : &sk->saddr); /* * When we connect we enforce receive requirements too. @@ -4674,8 +4617,9 @@ sk->rto = TCP_TIMEOUT_INIT; sk->retransmit_timer.function=&retransmit_timer; sk->retransmit_timer.data = (unsigned long)sk; - reset_xmit_timer(sk, TIME_WRITE, sk->rto); /* Timer for repeating the SYN until an answer */ - sk->retransmits = 0; /* Now works the right way instead of a hacked initial setting */ + reset_xmit_timer(sk, TIME_WRITE, sk->rto); /* Timer for repeating the SYN until an answer */ + sk->retransmits = 0; /* Now works the right way instead of a hacked + initial setting */ sk->prot->queue_xmit(sk, dev, buff, 0); reset_xmit_timer(sk, TIME_WRITE, sk->rto); @@ -4687,7 +4631,10 @@ } -/* This functions checks to see if the tcp header is actually acceptable. */ +/* + * This functions checks to see if the tcp header is actually acceptable. + */ + extern __inline__ int tcp_sequence(struct sock *sk, struct tcphdr *th, short len, struct options *opt, unsigned long saddr, struct device *dev) { @@ -4868,7 +4815,6 @@ return(0); } -/* skb->len = len;*/ skb->acked = 0; skb->used = 0; skb->free = 0; @@ -4909,13 +4855,6 @@ * Charge the memory to the socket. */ - if (sk->rmem_alloc + skb->truesize >= sk->rcvbuf) - { - kfree_skb(skb, FREE_READ); - release_sock(sk); - return(0); - } - skb->sk=sk; sk->rmem_alloc += skb->truesize; @@ -5152,6 +5091,20 @@ rfc_step6: /* I'll clean this up later */ /* + * If the accepted buffer put us over our queue size we + * now drop it (we must process the ack first to avoid + * deadlock cases). + */ + + if (sk->rmem_alloc >= sk->rcvbuf) + { + kfree_skb(skb, FREE_READ); + release_sock(sk); + return(0); + } + + + /* * Process urgent data */ @@ -5162,7 +5115,6 @@ return 0; } - /* * Process the encapsulated data */ @@ -5500,10 +5452,6 @@ struct proto tcp_prot = { tcp_close, - tcp_read, - tcp_write, - tcp_sendto, - tcp_recvfrom, ip_build_header, tcp_connect, tcp_accept, @@ -5520,6 +5468,7 @@ tcp_getsockopt, tcp_sendmsg, tcp_recvmsg, + NULL, /* No special bind() */ 128, 0, "TCP", diff -u --recursive --new-file v1.3.37/linux/net/ipv4/udp.c linux/net/ipv4/udp.c --- v1.3.37/linux/net/ipv4/udp.c Sun Oct 29 11:38:50 1995 +++ linux/net/ipv4/udp.c Mon Nov 6 13:48:20 1995 @@ -397,16 +397,40 @@ } /* - * In BSD SOCK_DGRAM a write is just like a send. + * Temporary */ - -static int udp_write(struct sock *sk, const unsigned char *buff, int len, int noblock, - unsigned flags) + +static int udp_sendmsg(struct sock *sk, struct msghdr *msg, + int len, int noblock, int flags) { - return(udp_sendto(sk, buff, len, noblock, flags, NULL, 0)); + if(msg->msg_iovlen==1) + return udp_sendto(sk,msg->msg_iov[0].iov_base,len, noblock, flags, msg->msg_name, msg->msg_namelen); + else + { + /* + * For awkward cases we linearise the buffer first. In theory this is only frames + * whose iovec's don't split on 4 byte boundaries, and soon encrypted stuff (to keep + * skip happy). We are a bit more general about it. + */ + + unsigned char *buf; + int fs; + int err; + if(len>65515) + return -EMSGSIZE; + buf=kmalloc(len, GFP_KERNEL); + if(buf==NULL) + return -ENOBUFS; + memcpy_fromiovec(buf, msg->msg_iov, len); + fs=get_fs(); + set_fs(get_fs()); + err=udp_sendto(sk,buf,len, noblock, flags, msg->msg_name, msg->msg_namelen); + set_fs(fs); + kfree_s(buf,len); + return err; + } } - /* * IOCTL requests applicable to the UDP protocol */ @@ -514,38 +538,6 @@ return(copied); } -int udp_recvfrom(struct sock *sk, unsigned char *ubuf, int size, int noblock, unsigned flags, - struct sockaddr_in *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = 0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return udp_recvmsg(sk, &msg, size, noblock, flags, addr_len); -} - - -/* - * Read has the same semantics as recv in SOCK_DGRAM - */ - -int udp_read(struct sock *sk, unsigned char *buff, int len, int noblock, - unsigned flags) -{ - return(udp_recvfrom(sk, buff, len, noblock, flags, NULL, NULL)); -} - - int udp_connect(struct sock *sk, struct sockaddr_in *usin, int addr_len) { struct rtable *rt; @@ -760,10 +752,6 @@ struct proto udp_prot = { udp_close, - udp_read, - udp_write, - udp_sendto, - udp_recvfrom, ip_build_header, udp_connect, NULL, @@ -778,8 +766,9 @@ NULL, ip_setsockopt, ip_getsockopt, - NULL, + udp_sendmsg, udp_recvmsg, + NULL, /* No special bind function */ 128, 0, "UDP", diff -u --recursive --new-file v1.3.37/linux/net/ipx/af_ipx.c linux/net/ipx/af_ipx.c --- v1.3.37/linux/net/ipx/af_ipx.c Mon Oct 23 18:02:24 1995 +++ linux/net/ipx/af_ipx.c Mon Nov 6 12:59:02 1995 @@ -1777,28 +1777,6 @@ return len; } -static int ipx_sendto(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = (void *)ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return ipx_sendmsg(sock, &msg, size, noblock, flags); -} - -static int ipx_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags) -{ - return ipx_sendto(sock,ubuf,size,noblock,flags,NULL,0); -} static int ipx_recvmsg(struct socket *sock, struct msghdr *msg, int size, int noblock, int flags, int *addr_len) @@ -1812,11 +1790,7 @@ int er; if(sk->err) - { - er= -sk->err; - sk->err=0; - return er; - } + return sock_error(sk); if (sk->zapped) return -EIO; @@ -1846,46 +1820,6 @@ return(truesize); } -static int ipx_write(struct socket *sock, const char *ubuf, int size, int noblock) -{ - return ipx_send(sock,ubuf,size,noblock,0); -} - -static int ipx_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = 0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return ipx_recvmsg(sock, &msg, size, noblock, flags, addr_len); -} - -static int ipx_recv(struct socket *sock, void *ubuf, int size , int noblock, - unsigned flags) -{ - ipx_socket *sk=(ipx_socket *)sock->data; - if(sk->zapped) - return -ENOTCONN; - return ipx_recvfrom(sock,ubuf,size,noblock,flags,NULL, NULL); -} - -static int ipx_read(struct socket *sock, char *ubuf, int size, int noblock) -{ - return ipx_recv(sock,ubuf,size,noblock,0); -} - - static int ipx_shutdown(struct socket *sk,int how) { return -EOPNOTSUPP; @@ -1983,15 +1917,9 @@ ipx_socketpair, ipx_accept, ipx_getname, - ipx_read, - ipx_write, ipx_select, ipx_ioctl, ipx_listen, - ipx_send, - ipx_recv, - ipx_sendto, - ipx_recvfrom, ipx_shutdown, ipx_setsockopt, ipx_getsockopt, diff -u --recursive --new-file v1.3.37/linux/net/netrom/af_netrom.c linux/net/netrom/af_netrom.c --- v1.3.37/linux/net/netrom/af_netrom.c Mon Oct 23 18:02:24 1995 +++ linux/net/netrom/af_netrom.c Mon Nov 6 12:59:02 1995 @@ -24,6 +24,8 @@ * context, THEN make the sock dead. * Circuit ID check before allocating it on * a connection. + * Alan(GW4PTS) sendmsg/recvmsg only. Fixed connect clear bug + * inherited from AX.25 */ #include @@ -122,7 +124,7 @@ /* * Handle device status changes. */ -static int nr_device_event(unsigned long event, void *ptr) +static int nr_device_event(struct notifier_block *this, unsigned long event, void *ptr) { struct device *dev = (struct device *)ptr; @@ -816,7 +818,7 @@ if (sk->state != TCP_ESTABLISHED) { sti(); sock->state = SS_UNCONNECTED; - return -sk->err; /* Always set at this point */ + return sock_error(sk); /* Always set at this point */ } sock->state = SS_CONNECTED; @@ -1033,11 +1035,8 @@ unsigned char *asmptr; int size; - if (sk->err) { - err = sk->err; - sk->err = 0; - return -err; - } + if (sk->err) + return sock_error(sk); if (flags) return -EINVAL; @@ -1128,32 +1127,6 @@ return len; } -static int nr_sendto(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = (void *)ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - return nr_sendmsg(sock, &msg, size, noblock, flags); -} - -static int nr_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags) -{ - return nr_sendto(sock, ubuf, size, noblock, flags, NULL, 0); -} - -static int nr_write(struct socket *sock, const char *ubuf, int size, int noblock) -{ - return nr_sendto(sock, ubuf, size, noblock, 0, NULL, 0); -} static int nr_recvmsg(struct socket *sock, struct msghdr *msg, int size, int noblock, int flags, int *addr_len) @@ -1164,13 +1137,8 @@ struct sk_buff *skb; int er; - if (sk->err) { - cli(); - er = -sk->err; - sk->err = 0; - sti(); - return er; - } + if (sk->err) + return sock_error(sk); if (addr_len != NULL) *addr_len = sizeof(*sax); @@ -1210,43 +1178,6 @@ return copied; } -static int nr_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - - iov.iov_base = ubuf; - iov.iov_len = size; - - msg.msg_name = (void *)sa; - msg.msg_namelen = 0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights = NULL; - msg.msg_iov = &iov; - msg.msg_iovlen = 1; - - return nr_recvmsg(sock, &msg, size, noblock, flags, addr_len); -} - - -static int nr_recv(struct socket *sock, void *ubuf, int size , int noblock, - unsigned flags) -{ - struct sock *sk = (struct sock *)sock->data; - - if (sk->zapped) - return -ENOTCONN; - - return nr_recvfrom(sock, ubuf, size, noblock, flags, NULL, NULL); -} - -static int nr_read(struct socket *sock, char *ubuf, int size, int noblock) -{ - return nr_recv(sock, ubuf, size, noblock, 0); -} - static int nr_shutdown(struct socket *sk, int how) { return -EOPNOTSUPP; @@ -1417,15 +1348,9 @@ nr_socketpair, nr_accept, nr_getname, - nr_read, - nr_write, nr_select, nr_ioctl, nr_listen, - nr_send, - nr_recv, - nr_sendto, - nr_recvfrom, nr_shutdown, nr_setsockopt, nr_getsockopt, diff -u --recursive --new-file v1.3.37/linux/net/socket.c linux/net/socket.c --- v1.3.37/linux/net/socket.c Mon Oct 23 18:02:24 1995 +++ linux/net/socket.c Mon Nov 6 12:59:02 1995 @@ -323,6 +323,8 @@ { struct socket *sock; int err; + struct iovec iov; + struct msghdr msg; sock = socki_lookup(inode); if (sock->flags & SO_ACCEPTCON) @@ -334,7 +336,14 @@ return 0; if ((err=verify_area(VERIFY_WRITE,ubuf,size))<0) return err; - return(sock->ops->read(sock, ubuf, size, (file->f_flags & O_NONBLOCK))); + msg.msg_name=NULL; + msg.msg_iov=&iov; + msg.msg_iovlen=1; + msg.msg_accrights=NULL; + iov.iov_base=ubuf; + iov.iov_len=size; + + return(sock->ops->recvmsg(sock, &msg, size,(file->f_flags & O_NONBLOCK), 0,&msg.msg_namelen)); } /* @@ -346,6 +355,8 @@ { struct socket *sock; int err; + struct msghdr msg; + struct iovec iov; sock = socki_lookup(inode); @@ -356,10 +367,18 @@ return -EINVAL; if(size==0) /* Match SYS5 behaviour */ return 0; - + if ((err=verify_area(VERIFY_READ,ubuf,size))<0) return err; - return(sock->ops->write(sock, ubuf, size,(file->f_flags & O_NONBLOCK))); + + msg.msg_name=NULL; + msg.msg_iov=&iov; + msg.msg_iovlen=1; + msg.msg_accrights=NULL; + iov.iov_base=(void *)ubuf; + iov.iov_len=size; + + return(sock->ops->sendmsg(sock, &msg, size,(file->f_flags & O_NONBLOCK),0)); } /* @@ -845,6 +864,8 @@ struct socket *sock; struct file *file; int err; + struct msghdr msg; + struct iovec iov; if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); @@ -856,7 +877,14 @@ err=verify_area(VERIFY_READ, buff, len); if(err) return err; - return(sock->ops->send(sock, buff, len, (file->f_flags & O_NONBLOCK), flags)); + + msg.msg_name=NULL; + msg.msg_iov=&iov; + msg.msg_iovlen=1; + msg.msg_accrights=NULL; + iov.iov_base=buff; + iov.iov_len=1; + return(sock->ops->sendmsg(sock, &msg, len, (file->f_flags & O_NONBLOCK), flags)); } /* @@ -872,6 +900,8 @@ struct file *file; char address[MAX_SOCK_ADDR]; int err; + struct msghdr msg; + struct iovec iov; if (fd < 0 || fd >= NR_OPEN || ((file = current->files->fd[fd]) == NULL)) return(-EBADF); @@ -886,22 +916,27 @@ if((err=move_addr_to_kernel(addr,addr_len,address))<0) return err; - - return(sock->ops->sendto(sock, buff, len, (file->f_flags & O_NONBLOCK), - flags, (struct sockaddr *)address, addr_len)); + + iov.iov_base=buff; + iov.iov_len=len; + msg.msg_name=address; + msg.msg_namelen=addr_len; + msg.msg_iov=&iov; + msg.msg_iovlen=1; + msg.msg_accrights=NULL; + return(sock->ops->sendmsg(sock, &msg, len, (file->f_flags & O_NONBLOCK), + flags)); } /* - * Receive a datagram from a socket. This isn't really right. The BSD manual - * pages explicitly state that recv is recvfrom with a NULL to argument. The - * Linux stack gets the right results for the wrong reason and this need to - * be tidied in the inet layer and removed from here. - * We check the buffer is writable and valid. + * Receive a datagram from a socket. Call the protocol recvmsg method */ -asmlinkage int sys_recv(int fd, void * buff, int len, unsigned flags) +asmlinkage int sys_recv(int fd, void * ubuf, int size, unsigned flags) { + struct iovec iov; + struct msghdr msg; struct socket *sock; struct file *file; int err; @@ -912,15 +947,22 @@ if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); - if(len<0) + if(size<0) return -EINVAL; - if(len==0) + if(size==0) return 0; - err=verify_area(VERIFY_WRITE, buff, len); + err=verify_area(VERIFY_WRITE, ubuf, size); if(err) return err; + + msg.msg_name=NULL; + msg.msg_iov=&iov; + msg.msg_iovlen=1; + msg.msg_accrights=NULL; + iov.iov_base=ubuf; + iov.iov_len=size; - return(sock->ops->recv(sock, buff, len,(file->f_flags & O_NONBLOCK), flags)); + return(sock->ops->recvmsg(sock, &msg, size,(file->f_flags & O_NONBLOCK), flags,&msg.msg_namelen)); } /* @@ -929,11 +971,13 @@ * sender address from kernel to user space. */ -asmlinkage int sys_recvfrom(int fd, void * buff, int len, unsigned flags, +asmlinkage int sys_recvfrom(int fd, void * ubuf, int size, unsigned flags, struct sockaddr *addr, int *addr_len) { struct socket *sock; struct file *file; + struct iovec iov; + struct msghdr msg; char address[MAX_SOCK_ADDR]; int err; int alen; @@ -941,24 +985,31 @@ return(-EBADF); if (!(sock = sockfd_lookup(fd, NULL))) return(-ENOTSOCK); - if(len<0) + if(size<0) return -EINVAL; - if(len==0) + if(size==0) return 0; - err=verify_area(VERIFY_WRITE,buff,len); + err=verify_area(VERIFY_WRITE,ubuf,size); if(err) return err; - len=sock->ops->recvfrom(sock, buff, len, (file->f_flags & O_NONBLOCK), - flags, (struct sockaddr *)address, &alen); + msg.msg_accrights=NULL; + msg.msg_iovlen=0; + msg.msg_iov=&iov; + iov.iov_len=size; + iov.iov_base=ubuf; + msg.msg_name=address; + msg.msg_namelen=MAX_SOCK_ADDR; + size=sock->ops->recvmsg(sock, &msg, size, (file->f_flags & O_NONBLOCK), + flags, &alen); - if(len<0) - return len; + if(size<0) + return size; if(addr!=NULL && (err=move_addr_to_user(address,alen, addr, addr_len))<0) return err; - return len; + return size; } /* @@ -1288,7 +1339,7 @@ { int i; - printk("Swansea University Computer Society NET3.032 for Linux 1.3.35\n"); + printk("Swansea University Computer Society NET3.033 for Linux 1.3.38\n"); /* * Initialize all address (protocol) families. diff -u --recursive --new-file v1.3.37/linux/net/unix/af_unix.c linux/net/unix/af_unix.c --- v1.3.37/linux/net/unix/af_unix.c Sun Oct 29 11:38:50 1995 +++ linux/net/unix/af_unix.c Mon Nov 6 13:46:28 1995 @@ -19,9 +19,25 @@ * Carsten Paeth : PF_UNIX check, address fixes. * Alan Cox : Limit size of allocated blocks. * Alan Cox : Fixed the stupid socketpair bug. + * Alan Cox : BSD compatibility fine tuning. + * + * + * Known differences from reference BSD that was tested: + * + * [TO FIX] + * No fd passing yet. + * ECONNREFUSED is not returned from one end of a connected() socket to the + * other the moment one end closes. + * fstat() doesn't return st_dev=NODEV, and give the blksize as high water mark + * and a fake inode identifier (nor the BSD first socket fstat twice bug). + * [NOT TO FIX] + * accept() returns a path name even if the connecting socket has closed + * in the meantime (BSD loses the path and gives up). + * accept() returns 0 length path for an unbound connector. BSD returns 16 + * and a null first byte in the path (but not for gethost/peername - BSD bug ??) + * socketpair(...SOCK_RAW..) doesnt panic the kernel. */ -#include #include #include #include @@ -47,18 +63,18 @@ #include #include -static unix_socket * unix_socket_list=NULL; +static unix_socket *unix_socket_list=NULL; #define min(a,b) (((a)<(b))?(a):(b)) /* * Make sure the unix name is null-terminated. */ -static inline void unix_mkname(struct sockaddr_un * sun, unsigned long len) +static inline void unix_mkname(struct sockaddr_un * sunaddr, unsigned long len) { - if (len >= sizeof(*sun)) - len = sizeof(*sun)-1; - ((char *)sun)[len]=0; + if (len >= sizeof(*sunaddr)) + len = sizeof(*sunaddr)-1; + ((char *)sunaddr)[len]=0; } /* @@ -72,14 +88,15 @@ unix_socket **s; cli(); - s = &unix_socket_list; + s=&unix_socket_list; while(*s!=NULL) { if(*s==sk) { *s=sk->next; - break; + sti(); + return; } s=&((*s)->next); } @@ -219,6 +236,8 @@ unix_socket *sk=sock->data; if(sk->type!=SOCK_STREAM) return -EOPNOTSUPP; /* Only stream sockets accept */ + if(sk->protinfo.af_unix.name==NULL) + return -EINVAL; /* No listens on an unbound socket */ sk->max_ack_backlog=backlog; sk->state=TCP_LISTEN; return 0; @@ -257,17 +276,23 @@ sk=(unix_socket *)kmalloc(sizeof(*sk),GFP_KERNEL); if(sk==NULL) return -ENOMEM; - sk->type=sock->type; switch(sock->type) { case SOCK_STREAM: break; + /* + * Believe it or not BSD has AF_UNIX, SOCK_RAW though + * nothing uses it. + */ + case SOCK_RAW: + sock->type=SOCK_DGRAM; case SOCK_DGRAM: break; default: kfree_s(sk,sizeof(*sk)); return -ESOCKTNOSUPPORT; } + sk->type=sock->type; init_timer(&sk->timer); skb_queue_head_init(&sk->write_queue); skb_queue_head_init(&sk->receive_queue); @@ -334,9 +359,15 @@ skpair->state_change(skpair); /* Wake any blocked writes */ } if(skpair!=NULL) - skpair->protinfo.af_unix.locks--; /* It may now die */ - sk->protinfo.af_unix.other=NULL; /* No pair */ + skpair->protinfo.af_unix.locks--; /* It may now die */ + sk->protinfo.af_unix.other=NULL; /* No pair */ unix_destroy_socket(sk); /* Try and flush out this socket. Throw our buffers at least */ + + /* + * FIXME: BSD difference: In BSD all sockets connected to use get ECONNRESET and we die on the spot. In + * Linux we behave like files and pipes do and wait for the last dereference. + */ + return 0; } @@ -370,14 +401,17 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { - struct sockaddr_un *sun=(struct sockaddr_un *)uaddr; + struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; unix_socket *sk=sock->data; int old_fs; int err; - if(addr_len>sizeof(struct sockaddr_un) || addr_len<3 || sun->sun_family!=AF_UNIX) + if(sk->protinfo.af_unix.name) + return -EINVAL; /* Already bound */ + + if(addr_len>sizeof(struct sockaddr_un) || addr_len<3 || sunaddr->sun_family!=AF_UNIX) return -EINVAL; - unix_mkname(sun, addr_len); + unix_mkname(sunaddr, addr_len); /* * Put ourselves in the filesystem */ @@ -387,7 +421,7 @@ sk->protinfo.af_unix.name=kmalloc(addr_len+1, GFP_KERNEL); if(sk->protinfo.af_unix.name==NULL) return -ENOMEM; - memcpy(sk->protinfo.af_unix.name, sun->sun_path, addr_len+1); + memcpy(sk->protinfo.af_unix.name, sunaddr->sun_path, addr_len+1); old_fs=get_fs(); set_fs(get_ds()); @@ -415,7 +449,7 @@ static int unix_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { unix_socket *sk=sock->data; - struct sockaddr_un *sun=(struct sockaddr_un *)uaddr; + struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; unix_socket *other; struct sk_buff *skb; int err; @@ -437,10 +471,10 @@ return -EISCONN; } - if(addr_len < sizeof(sun->sun_family)+1 || sun->sun_family!=AF_UNIX) + if(addr_len < sizeof(sunaddr->sun_family)+1 || sunaddr->sun_family!=AF_UNIX) return -EINVAL; - unix_mkname(sun, addr_len); + unix_mkname(sunaddr, addr_len); if(sk->type==SOCK_DGRAM && sk->protinfo.af_unix.other) { @@ -451,9 +485,11 @@ if(sock->type==SOCK_DGRAM) { - other=unix_find_other(sun->sun_path, &err); + other=unix_find_other(sunaddr->sun_path, &err); if(other==NULL) return err; + if(other->type!=sk->type) + return -EPROTOTYPE; other->protinfo.af_unix.locks++; sk->protinfo.af_unix.other=other; sock->state=SS_CONNECTED; @@ -474,13 +510,18 @@ skb->sk=sk; /* So they know it is us */ skb->free=1; sk->state=TCP_CLOSE; - unix_mkname(sun, addr_len); - other=unix_find_other(sun->sun_path, &err); + unix_mkname(sunaddr, addr_len); + other=unix_find_other(sunaddr->sun_path, &err); if(other==NULL) { kfree_skb(skb, FREE_WRITE); return err; } + if(other->type!=sk->type) + { + kfree_skb(skb, FREE_WRITE); + return -EPROTOTYPE; + } other->protinfo.af_unix.locks++; /* Lock the other socket so it doesn't run off for a moment */ other->ack_backlog++; sk->protinfo.af_unix.other=other; @@ -614,7 +655,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { unix_socket *sk=sock->data; - struct sockaddr_un *sun=(struct sockaddr_un *)uaddr; + struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; if(peer) { @@ -622,15 +663,15 @@ return -ENOTCONN; sk=sk->protinfo.af_unix.other; } - sun->sun_family=AF_UNIX; + sunaddr->sun_family=AF_UNIX; if(sk->protinfo.af_unix.name==NULL) { - *sun->sun_path=0; - *uaddr_len=sizeof(sun->sun_family)+1; + *sunaddr->sun_path=0; + *uaddr_len=sizeof(sunaddr->sun_family)+1; return 0; /* Not bound */ } - *uaddr_len=sizeof(sun->sun_family)+strlen(sk->protinfo.af_unix.name)+1; - strcpy(sun->sun_path,sk->protinfo.af_unix.name); /* 108 byte limited */ + *uaddr_len=sizeof(sunaddr->sun_family)+strlen(sk->protinfo.af_unix.name)+1; + strcpy(sunaddr->sun_path,sk->protinfo.af_unix.name); /* 108 byte limited */ return 0; } @@ -638,25 +679,22 @@ { unix_socket *sk=sock->data; unix_socket *other; - struct sockaddr_un *sun=msg->msg_name; + struct sockaddr_un *sunaddr=msg->msg_name; int err,size; struct sk_buff *skb; int limit=0; int sent=0; if(sk->err) - { - cli(); - err=sk->err; - sk->err=0; - sti(); - return -err; - } - + return sock_error(sk); + + if(flags&MSG_OOB) + return -EOPNOTSUPP; + if(flags || msg->msg_accrights) /* For now */ return -EINVAL; - if(sun!=NULL) + if(sunaddr!=NULL) { if(sock->type==SOCK_STREAM) { @@ -666,7 +704,7 @@ return -EOPNOTSUPP; } } - if(sun==NULL) + if(sunaddr==NULL) { if(sk->protinfo.af_unix.other==NULL) return -ENOTCONN; @@ -722,7 +760,7 @@ memcpy_fromiovec(skb_put(skb,size),msg->msg_iov, size); cli(); - if(sun==NULL) + if(sunaddr==NULL) { other=sk->protinfo.af_unix.other; if(sock->type==SOCK_DGRAM && other->dead) @@ -739,8 +777,8 @@ } else { - unix_mkname(sun, msg->msg_namelen); - other=unix_find_other(sun->sun_path, &err); + unix_mkname(sunaddr, msg->msg_namelen); + other=unix_find_other(sunaddr->sun_path, &err); if(other==NULL) { kfree_skb(skb, FREE_WRITE); @@ -762,8 +800,7 @@ static int unix_recvmsg(struct socket *sock, struct msghdr *msg, int size, int noblock, int flags, int *addr_len) { unix_socket *sk=sock->data; - struct sockaddr_un *sun=msg->msg_name; - int err; + struct sockaddr_un *sunaddr=msg->msg_name; struct sk_buff *skb; int copied=0; unsigned char *sp; @@ -772,17 +809,14 @@ struct iovec *iov=msg->msg_iov; int ct=msg->msg_iovlen; + if(flags&MSG_OOB) + return -EOPNOTSUPP; + if(addr_len) *addr_len=0; if(sk->err) - { - cli(); - err=sk->err; - sk->err=0; - sti(); - return -err; - } + return sock_error(sk); /* printk("get rcv sem\n");*/ down(&sk->protinfo.af_unix.readsem); /* Lock the socket */ @@ -838,12 +872,12 @@ } if(msg->msg_name!=NULL) { - sun->sun_family=AF_UNIX; + sunaddr->sun_family=AF_UNIX; if(skb->sk->protinfo.af_unix.name) { - memcpy(sun->sun_path, skb->sk->protinfo.af_unix.name, 108); + memcpy(sunaddr->sun_path, skb->sk->protinfo.af_unix.name, 108); if(addr_len) - *addr_len=strlen(sun->sun_path)+sizeof(short); + *addr_len=strlen(sunaddr->sun_path)+sizeof(short); } else if(addr_len) @@ -989,64 +1023,6 @@ return len; } -/* - * For AF_UNIX we flip everything into an iovec. If this doesnt do any speed harm then it will - * be easier for all the low levels to be totally iovec based. - */ - -static int unix_recvfrom(struct socket *sock, void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int *addr_len) -{ - struct iovec iov; - struct msghdr msg; - iov.iov_base=ubuf; - iov.iov_len=size; - msg.msg_name=(void *)sa; - msg.msg_namelen=0; - if (addr_len) - msg.msg_namelen = *addr_len; - msg.msg_accrights=NULL; - msg.msg_iov=&iov; - msg.msg_iovlen=1; - return unix_recvmsg(sock,&msg,size,noblock,flags,addr_len); -} - -static int unix_read(struct socket *sock, char *ubuf, int size, int noblock) -{ - return unix_recvfrom(sock,ubuf,size,noblock,0,NULL,NULL); -} - -static int unix_recv(struct socket *sock, void *ubuf, int size, int noblock, unsigned int flags) -{ - return unix_recvfrom(sock,ubuf,size,noblock,flags,NULL,NULL); -} - -static int unix_sendto(struct socket *sock, const void *ubuf, int size, int noblock, unsigned flags, - struct sockaddr *sa, int addr_len) -{ - struct iovec iov; - struct msghdr msg; - iov.iov_base=(void *)ubuf; - iov.iov_len=size; - msg.msg_name=(void *)sa; - msg.msg_namelen=addr_len; - msg.msg_accrights=NULL; - msg.msg_iov=&iov; - msg.msg_iovlen=1; - return unix_sendmsg(sock,&msg,size,noblock,flags); -} - -static int unix_write(struct socket *sock, const char *ubuf, int size, int noblock) -{ - return unix_sendto(sock,ubuf,size,noblock, 0, NULL, 0); -} - -static int unix_send(struct socket *sock, const void *ubuf, int size, int noblock, unsigned int flags) -{ - return unix_sendto(sock,ubuf,size,noblock, flags, NULL, 0); -} - - static struct proto_ops unix_proto_ops = { AF_UNIX, @@ -1058,15 +1034,9 @@ unix_socketpair, unix_accept, unix_getname, - unix_read, - unix_write, unix_select, unix_ioctl, unix_listen, - unix_send, - unix_recv, - unix_sendto, - unix_recvfrom, unix_shutdown, unix_setsockopt, unix_getsockopt, diff -u --recursive --new-file v1.3.37/linux/scripts/Configure linux/scripts/Configure --- v1.3.37/linux/scripts/Configure Sun Oct 29 11:38:50 1995 +++ linux/scripts/Configure Tue Nov 7 09:18:36 1995 @@ -200,7 +200,7 @@ # choice question choice-list default # # The choice list has a syntax of: -# NAME:VALUE { WHITESPACE '|' NAME:VALUE } +# NAME WHITESPACE VALUE { WHITESPACE NAME WHITESPACE VALUE } # The user may enter any unique prefix of one of the NAMEs and # choice will define VALUE as if it were a boolean option. # VALUE must be in all uppercase. Normally, VALUE is of the @@ -254,8 +254,16 @@ shift; shift done done - echo " defining $val" - define_bool "$val" "y" + set -- $choices + while [ -n "$2" ]; do + if [ "$2" = "$val" ]; then + echo " defined $val" + define_bool "$2" "y" + else + define_bool "$2" "n" + fi + shift; shift + done } CONFIG=.tmpconfig diff -u --recursive --new-file v1.3.37/linux/scripts/depend.awk linux/scripts/depend.awk --- v1.3.37/linux/scripts/depend.awk Mon Aug 28 14:52:27 1995 +++ linux/scripts/depend.awk Mon Oct 30 10:11:09 1995 @@ -24,8 +24,19 @@ } } +function endfile(f) { + if (hasconfig && !needsconfig) { + printf "%s doesn't need config\n",f > "/dev/stderr" + } + if (hasdep) { + print cmd + } +} + BEGIN{ hasdep=0 + hasconfig=0 + needsconfig=0 if(!(TOPDIR=ENVIRON["TOPDIR"])) { print "Environment variable TOPDIR is not set" exit 1 @@ -37,13 +48,22 @@ } } -/^#[ ]*include[ ]*[<"][^ ]*[>"]/{ +/^[ ]*#[ ]*if.*[^A-Za-z_]CONFIG_/ { + needsconfig=1 + if (!hasconfig) { + printf "%s needs config but has not included config file\n",FILENAME > "/dev/stderr" + # only say it once per file.. + hasconfig = 1 + } +} + +/^[ ]*#[ ]*include[ ]*[<"][^ ]*[>"]/{ found=0 if(LASTFILE!=FILENAME) { - if (hasdep) { - print cmd - } + endfile(LASTFILE) hasdep=0 + hasconfig=0 + needsconfig=0 cmd="" LASTFILE=FILENAME depname=FILENAME @@ -65,6 +85,9 @@ fname=$0 sub("^#[ ]*include[ ]*[<\"]","",fname) sub("[>\"].*","",fname) + if (fname=="linux/config.h") { + hasconfig=1 + } if(fileExists(relpath""fname)) { found=1 if (!hasdep) { @@ -94,7 +117,5 @@ } END{ - if (hasdep) { - print cmd - } + endfile(FILENAME) } diff -u --recursive --new-file v1.3.37/linux/scripts/tkgen.c linux/scripts/tkgen.c --- v1.3.37/linux/scripts/tkgen.c Mon Oct 23 18:02:24 1995 +++ linux/scripts/tkgen.c Mon Nov 6 12:59:02 1995 @@ -189,7 +189,7 @@ printf(".menu%d.x%d.y configure -state disabled;",menu_num, line_num); printf(".menu%d.x%d.n configure -state disabled;",menu_num, line_num); printf(".menu%d.x%d.l configure -state disabled;",menu_num, line_num); - printf("set %s [expr $%s|16];", item->optionname, item->optionname); + printf("set %s [ expr $%s | 16 ];", item->optionname, item->optionname); printf("}\n"); #endif break;