Date: Thu, 5 Aug 2004 21:27:13 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 58953 for review Message-ID: <200408052127.i75LRD4o084930@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=58953 Change 58953 by rwatson@rwatson_paprika on 2004/08/05 21:26:48 Integrate netperf_socket from CVS HEAD: various pmap/vm locking fixes, cleanups, giant removal btx fixes more /dev/mem fixes if_hme checksum offload lazypmap_lock eliminated curthread avoidance in mutex code BPF lockless read for interface descriptor list looped back from rwatson_netperf Affected files ... .. //depot/projects/netperf_socket/sys/arm/arm/pmap.c#7 integrate .. //depot/projects/netperf_socket/sys/boot/i386/boot2/boot1.S#5 integrate .. //depot/projects/netperf_socket/sys/boot/i386/btx/lib/btxcsu.s#2 integrate .. //depot/projects/netperf_socket/sys/conf/files.amd64#14 integrate .. //depot/projects/netperf_socket/sys/conf/files.i386#25 integrate .. //depot/projects/netperf_socket/sys/conf/files.pc98#14 integrate .. //depot/projects/netperf_socket/sys/contrib/pf/netinet/in4_cksum.c#3 integrate .. //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci_link.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-all.c#12 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-all.h#9 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-chipset.c#13 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-disk.c#7 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-dma.c#3 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-lowlevel.c#12 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-pci.c#9 integrate .. //depot/projects/netperf_socket/sys/dev/ata/ata-queue.c#9 integrate .. //depot/projects/netperf_socket/sys/dev/ata/atapi-cd.c#8 integrate .. //depot/projects/netperf_socket/sys/dev/ata/atapi-fd.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/ata/atapi-tape.c#6 integrate .. //depot/projects/netperf_socket/sys/dev/drm/drm_drv.h#6 integrate .. //depot/projects/netperf_socket/sys/dev/hme/if_hme.c#10 integrate .. //depot/projects/netperf_socket/sys/dev/hme/if_hme_sbus.c#5 integrate .. //depot/projects/netperf_socket/sys/dev/hme/if_hmereg.h#3 integrate .. //depot/projects/netperf_socket/sys/dev/hme/if_hmevar.h#2 integrate .. //depot/projects/netperf_socket/sys/geom/mirror/g_mirror.c#3 integrate .. //depot/projects/netperf_socket/sys/geom/mirror/g_mirror.h#3 integrate .. //depot/projects/netperf_socket/sys/i386/acpica/acpi_wakeup.c#7 integrate .. //depot/projects/netperf_socket/sys/i386/i386/machdep.c#12 integrate .. //depot/projects/netperf_socket/sys/i386/i386/mp_machdep.c#5 integrate .. //depot/projects/netperf_socket/sys/i386/i386/pmap.c#23 integrate .. //depot/projects/netperf_socket/sys/ia64/ia64/locore.S#2 integrate .. //depot/projects/netperf_socket/sys/kern/kern_mutex.c#10 integrate .. //depot/projects/netperf_socket/sys/kern/kern_synch.c#14 integrate .. //depot/projects/netperf_socket/sys/kern/subr_rman.c#4 integrate .. //depot/projects/netperf_socket/sys/kern/subr_witness.c#9 integrate .. //depot/projects/netperf_socket/sys/net/bpf.c#10 integrate .. //depot/projects/netperf_socket/sys/net/if_gre.c#9 integrate .. //depot/projects/netperf_socket/sys/pc98/conf/GENERIC#12 integrate .. //depot/projects/netperf_socket/sys/pc98/i386/machdep.c#10 integrate .. //depot/projects/netperf_socket/sys/powerpc/powerpc/pmap.c#13 integrate .. //depot/projects/netperf_socket/sys/sparc64/sparc64/pmap.c#11 integrate .. //depot/projects/netperf_socket/sys/sys/bio.h#5 integrate .. //depot/projects/netperf_socket/sys/sys/mutex.h#7 integrate .. //depot/projects/netperf_socket/sys/sys/systm.h#9 integrate .. //depot/projects/netperf_socket/sys/vm/vm_map.c#17 integrate .. //depot/projects/netperf_socket/sys/vm/vm_mmap.c#11 integrate Differences ... ==== //depot/projects/netperf_socket/sys/arm/arm/pmap.c#7 (text+ko) ==== @@ -144,7 +144,7 @@ */ /* Include header files */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.9 2004/07/30 20:38:30 alc Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/pmap.c,v 1.10 2004/08/04 22:03:15 alc Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -3406,7 +3406,10 @@ vm_page_t pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_page_t mpte) { + + mtx_lock(&Giant); pmap_enter(pmap, va, m, VM_PROT_READ | VM_PROT_EXECUTE, FALSE); + mtx_unlock(&Giant); return (NULL); } ==== //depot/projects/netperf_socket/sys/boot/i386/boot2/boot1.S#5 (text+ko) ==== @@ -12,7 +12,7 @@ * warranties of merchantability and fitness for a particular * purpose. * - * $FreeBSD: src/sys/boot/i386/boot2/boot1.S,v 1.28 2004/06/02 09:38:32 phk Exp $ + * $FreeBSD: src/sys/boot/i386/boot2/boot1.S,v 1.29 2004/08/05 06:00:05 kan Exp $ */ /* Memory Locations */ @@ -193,10 +193,6 @@ sub %si,%cx # count rep # Relocate movsb # client - sub %di,%cx # Byte count - xorb %al,%al # Zero assumed bss from - rep # the end of boot2.bin - stosb # up to 0x10000 /* * Enable A20 so we can access memory above 1 meg. ==== //depot/projects/netperf_socket/sys/boot/i386/btx/lib/btxcsu.s#2 (text+ko) ==== @@ -13,7 +13,7 @@ # purpose. # -# $FreeBSD: src/sys/boot/i386/btx/lib/btxcsu.s,v 1.3 1999/08/28 00:40:07 peter Exp $ +# $FreeBSD: src/sys/boot/i386/btx/lib/btxcsu.s,v 1.4 2004/08/05 06:00:05 kan Exp $ # # BTX C startup code (ELF). @@ -30,7 +30,15 @@ # # Client entry point. # -_start: movl %eax,__base # Set base address +_start: cld + pushl %eax + movl $_edata,%edi + movl $_end,%ecx + subl %edi, %ecx + xorb %al, %al + rep + stosb + popl __base movl %esp,%eax # Set addl $ARGADJ,%eax # argument movl %eax,__args # pointer ==== //depot/projects/netperf_socket/sys/conf/files.amd64#14 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.amd64,v 1.43 2004/08/01 11:40:51 markm Exp $ +# $FreeBSD: src/sys/conf/files.amd64,v 1.44 2004/08/04 20:49:43 markm Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -112,6 +112,7 @@ dev/kbd/kbd.c optional kbd dev/kbd/kbd.c optional sc dev/kbd/kbd.c optional ukbd +dev/mem/memutil.c optional mem dev/ppc/ppc.c optional ppc dev/sio/sio.c optional sio dev/sio/sio_isa.c optional sio isa ==== //depot/projects/netperf_socket/sys/conf/files.i386#25 (text+ko) ==== @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $FreeBSD: src/sys/conf/files.i386,v 1.501 2004/08/01 11:40:51 markm Exp $ +# $FreeBSD: src/sys/conf/files.i386,v 1.502 2004/08/04 20:49:43 markm Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -153,6 +153,7 @@ dev/kbd/kbd.c optional vt dev/lnc/if_lnc_isa.c optional lnc isa dev/io/iodev.c optional io +dev/mem/memutil.c optional mem dev/ppc/ppc.c optional ppc dev/ppc/ppc_puc.c optional ppc puc pci dev/random/nehemiah.c optional random ==== //depot/projects/netperf_socket/sys/conf/files.pc98#14 (text+ko) ==== @@ -3,7 +3,7 @@ # # modified for PC-9801 # -# $FreeBSD: src/sys/conf/files.pc98,v 1.303 2004/08/01 13:00:04 nyan Exp $ +# $FreeBSD: src/sys/conf/files.pc98,v 1.304 2004/08/05 13:00:11 nyan Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -111,6 +111,7 @@ dev/kbd/kbd.c optional pckbd dev/lnc/if_lnc_cbus.c optional lnc isa dev/io/iodev.c optional io +dev/mem/memutil.c optional mem dev/ppc/ppc_puc.c optional ppc puc pci dev/sbni/if_sbni.c optional sbni dev/sbni/if_sbni_pci.c optional sbni pci ==== //depot/projects/netperf_socket/sys/contrib/pf/netinet/in4_cksum.c#3 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/sys/contrib/pf/netinet/in4_cksum.c,v 1.3 2004/06/16 23:24:01 mlaier Exp $ */ +/* $FreeBSD: src/sys/contrib/pf/netinet/in4_cksum.c,v 1.4 2004/08/05 20:41:38 mlaier Exp $ */ /* $OpenBSD: in4_cksum.c,v 1.7 2003/06/02 23:28:13 millert Exp $ */ /* $KAME: in4_cksum.c,v 1.10 2001/11/30 10:06:15 itojun Exp $ */ /* $NetBSD: in_cksum.c,v 1.13 1996/10/13 02:03:03 christos Exp $ */ @@ -64,90 +64,37 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/mbuf.h> -#include <sys/systm.h> -#include <sys/socket.h> -#include <net/route.h> + #include <netinet/in.h> #include <netinet/in_systm.h> #include <netinet/ip.h> #include <netinet/ip_var.h> -#if defined(__FreeBSD__) && defined(__i386__) -/* - * Copied from FreeBSD 5.0 sys/i386/i386/in_cksum.c - * XXX - * Currently support I386 processor only. - * In the long run, we need an optimized cksum routines for each Tier1 - * architecture. Due to the lack of available hardware except I386 I - * can't support other processors now. For those users which use Sparc64, - * Alpha processors can use more optimized version in FreeBSD. - * See sys/$ARCH/$ARCH/in_cksum.c where $ARCH=`uname -p` - */ - -/* - * These asm statements require __volatile because they pass information - * via the condition codes. GCC does not currently provide a way to specify - * the condition codes as an input or output operand. - * - * The LOAD macro below is effectively a prefetch into cache. GCC will - * load the value into a register but will not use it. Since modern CPUs - * reorder operations, this will generally take place in parallel with - * other calculations. - */ -#define ADD(n) __asm __volatile \ - ("addl %1, %0" : "+r" (sum) : \ - "g" (((const u_int32_t *)w)[n / 4])) -#define ADDC(n) __asm __volatile \ - ("adcl %1, %0" : "+r" (sum) : \ - "g" (((const u_int32_t *)w)[n / 4])) -#define LOAD(n) __asm __volatile \ - ("" : : "r" (((const u_int32_t *)w)[n / 4])) -#define MOP __asm __volatile \ - ("adcl $0, %0" : "+r" (sum)) -#endif -/* - * Checksum routine for Internet Protocol family headers (Portable Version). - * This is only for IPv4 pseudo header checksum. - * No need to clear non-pseudo-header fields in IPv4 header. - * len is for actual payload size, and does not include IPv4 header and - * skipped header chain (off + len should be equal to the whole packet). - * - * This routine is very heavily used in the network - * code and should be modified for each CPU to be as fast as possible. - */ +#include <machine/in_cksum.h> #define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) #define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);} -#if defined(__FreeBSD__) -int -in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); -#endif +int in4_cksum(struct mbuf *, u_int8_t, int, int); int -in4_cksum(m, nxt, off, len) - struct mbuf *m; - u_int8_t nxt; - int off, len; +in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len) { - u_int16_t *w; - int sum = 0; - int mlen = 0; - int byte_swapped = 0; union { struct ipovly ipov; u_int16_t w[10]; } u; union { - u_int8_t c[2]; - u_int16_t s; - } s_util; - union { u_int16_t s[2]; u_int32_t l; } l_util; + u_int16_t *w; + int psum; + int sum = 0; + if (nxt != 0) { /* pseudo header */ if (off < sizeof(struct ipovly)) @@ -165,223 +112,9 @@ sum += w[5]; sum += w[6]; sum += w[7]; sum += w[8]; sum += w[9]; } - /* skip unnecessary part */ - while (m && off > 0) { - if (m->m_len > off) - break; - off -= m->m_len; - m = m->m_next; - } - - for (;m && len; m = m->m_next) { - if (m->m_len == 0) - continue; - w = (u_int16_t *)(mtod(m, caddr_t) + off); - if (mlen == -1) { - /* - * The first byte of this mbuf is the continuation - * of a word spanning between this mbuf and the - * last mbuf. - * - * s_util.c[0] is already saved when scanning previous - * mbuf. - */ - s_util.c[1] = *(u_int8_t *)w; - sum += s_util.s; - w = (u_int16_t *)((u_int8_t *)w + 1); - mlen = m->m_len - off - 1; - len--; - } else - mlen = m->m_len - off; - off = 0; - if (len < mlen) - mlen = len; - len -= mlen; -#if defined(__FreeBSD__) && defined(__i386__) - /* - * Force to long boundary so we do longword aligned - * memory operations - */ - if (3 & (int) w) { - REDUCE; - if ((1 & (int) w) && (mlen > 0)) { - sum <<= 8; - s_util.c[0] = *(char *)w; - w = (u_short *)((char *)w + 1); - mlen--; - byte_swapped = 1; - } - if ((2 & (int) w) && (mlen >= 2)) { - sum += *w++; - mlen -= 2; - } - } - /* - * Advance to a 486 cache line boundary. - */ - if (4 & (int) w && mlen >= 4) { - ADD(0); - MOP; - w += 2; - mlen -= 4; - } - if (8 & (int) w && mlen >= 8) { - ADD(0); - ADDC(4); - MOP; - w += 4; - mlen -= 8; - } - /* - * Do as much of the checksum as possible 32 bits at at time. - * In fact, this loop is unrolled to make overhead from - * branches &c small. - */ - mlen -= 1; - while ((mlen -= 32) >= 0) { - /* - * Add with carry 16 words and fold in the last - * carry by adding a 0 with carry. - * - * The early ADD(16) and the LOAD(32) are to load - * the next 2 cache lines in advance on 486's. The - * 486 has a penalty of 2 clock cycles for loading - * a cache line, plus whatever time the external - * memory takes to load the first word(s) addressed. - * These penalties are unavoidable. Subsequent - * accesses to a cache line being loaded (and to - * other external memory?) are delayed until the - * whole load finishes. These penalties are mostly - * avoided by not accessing external memory for - * 8 cycles after the ADD(16) and 12 cycles after - * the LOAD(32). The loop terminates when mlen - * is initially 33 (not 32) to guaranteed that - * the LOAD(32) is within bounds. - */ - ADD(16); - ADDC(0); - ADDC(4); - ADDC(8); - ADDC(12); - LOAD(32); - ADDC(20); - ADDC(24); - ADDC(28); - MOP; - w += 16; - } - mlen += 32 + 1; - if (mlen >= 32) { - ADD(16); - ADDC(0); - ADDC(4); - ADDC(8); - ADDC(12); - ADDC(20); - ADDC(24); - ADDC(28); - MOP; - w += 16; - mlen -= 32; - } - if (mlen >= 16) { - ADD(0); - ADDC(4); - ADDC(8); - ADDC(12); - MOP; - w += 8; - mlen -= 16; - } - if (mlen >= 8) { - ADD(0); - ADDC(4); - MOP; - w += 4; - mlen -= 8; - } - if (mlen == 0 && byte_swapped == 0) - continue; /* worth 1% maybe ?? */ - REDUCE; - while ((mlen -= 2) >= 0) { - sum += *w++; - } - if (byte_swapped) { - REDUCE; - sum <<= 8; - byte_swapped = 0; - if (mlen == -1) { - s_util.c[1] = *(char *)w; - sum += s_util.s; - mlen = 0; - } else - mlen = -1; - } else if (mlen == -1) - /* - * This mbuf has odd number of bytes. - * There could be a word split betwen - * this mbuf and the next mbuf. - * Save the last byte (to prepend to next mbuf). - */ - s_util.c[0] = *(char *)w; -#else - /* - * Force to even boundary. - */ - if ((1 & (long) w) && (mlen > 0)) { - REDUCE; - sum <<= 8; - s_util.c[0] = *(u_int8_t *)w; - w = (u_int16_t *)((int8_t *)w + 1); - mlen--; - byte_swapped = 1; - } - /* - * Unroll the loop to make overhead from - * branches &c small. - */ - while ((mlen -= 32) >= 0) { - sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; - sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; - sum += w[8]; sum += w[9]; sum += w[10]; sum += w[11]; - sum += w[12]; sum += w[13]; sum += w[14]; sum += w[15]; - w += 16; - } - mlen += 32; - while ((mlen -= 8) >= 0) { - sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; - w += 4; - } - mlen += 8; - if (mlen == 0 && byte_swapped == 0) - continue; - REDUCE; - while ((mlen -= 2) >= 0) { - sum += *w++; - } - if (byte_swapped) { - REDUCE; - sum <<= 8; - byte_swapped = 0; - if (mlen == -1) { - s_util.c[1] = *(u_int8_t *)w; - sum += s_util.s; - mlen = 0; - } else - mlen = -1; - } else if (mlen == -1) - s_util.c[0] = *(u_int8_t *)w; -#endif - } - if (len) - printf("cksum4: out of data\n"); - if (mlen == -1) { - /* The last mbuf has odd # of bytes. Follow the - standard (the odd byte may be shifted left by 8 bits - or not as determined by endian-ness of the machine) */ - s_util.c[1] = 0; - sum += s_util.s; - } + psum = in_cksum_skip(m, len + off, off); + psum = ~psum & 0xffff; + sum += psum; REDUCE; return (~sum & 0xffff); } ==== //depot/projects/netperf_socket/sys/dev/acpica/acpi_pci_link.c#6 (text+ko) ==== @@ -24,8 +24,11 @@ * SUCH DAMAGE. */ +/* XXX Uncomment this if you have new PCI IRQ problems starting 2004/8/5. */ +/* #define ACPI_OLD_PCI_LINK 1 */ + #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.16 2004/06/14 18:54:14 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_pci_link.c,v 1.17 2004/08/05 06:54:16 njl Exp $"); #include "opt_acpi.h" #include <sys/param.h> @@ -73,10 +76,12 @@ static int irq_penalty[MAX_ACPI_INTERRUPTS]; +#ifdef ACPI_OLD_PCI_LINK #define ACPI_STA_PRESENT 0x00000001 #define ACPI_STA_ENABLE 0x00000002 #define ACPI_STA_SHOWINUI 0x00000004 #define ACPI_STA_FUNCTIONAL 0x00000008 +#endif /* ACPI_OLD_PCI_LINK */ /* * PCI link object management @@ -171,6 +176,7 @@ (int)entry->prt.Pin); } +#ifdef ACPI_OLD_PCI_LINK static ACPI_STATUS acpi_pci_link_get_object_status(ACPI_HANDLE handle, UINT32 *sta) { @@ -215,6 +221,7 @@ AcpiOsFree(buf.Pointer); return_ACPI_STATUS (AE_OK); } +#endif /* ACPI_OLD_PCI_LINK */ static ACPI_STATUS acpi_pci_link_get_irq_resources(ACPI_RESOURCE *resources, @@ -439,7 +446,9 @@ { ACPI_HANDLE handle; ACPI_STATUS error; +#ifdef ACPI_OLD_PCI_LINK UINT32 sta; +#endif struct acpi_prt_entry *entry; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -457,6 +466,11 @@ return_ACPI_STATUS (error); } + /* + * PCI link status (_STA) is unreliable. Many systems return + * erroneous values so we ignore it. + */ +#ifdef ACPI_OLD_PCI_LINK error = acpi_pci_link_get_object_status(handle, &sta); if (ACPI_FAILURE(error)) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, @@ -471,6 +485,7 @@ acpi_name(handle))); return_ACPI_STATUS (AE_ERROR); } +#endif /* ACPI_OLD_PCI_LINK */ TAILQ_FOREACH(entry, &acpi_prt_entries, links) { if (entry->busno == busno && @@ -539,7 +554,9 @@ ACPI_STATUS error; ACPI_RESOURCE resbuf; ACPI_BUFFER crsbuf; +#ifdef ACPI_OLD_PCI_LINK UINT32 sta; +#endif ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -614,7 +631,13 @@ AcpiOsFree(crsbuf.Pointer); link->current_irq = 0; + error = AE_OK; + /* + * PCI link status (_STA) is unreliable. Many systems return + * erroneous values so we ignore it. + */ +#ifdef ACPI_OLD_PCI_LINK error = acpi_pci_link_get_object_status(link->handle, &sta); if (ACPI_FAILURE(error)) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, @@ -629,7 +652,14 @@ acpi_name(link->handle))); return_ACPI_STATUS (AE_ERROR); } +#endif /* ACPI_OLD_PCI_LINK */ + /* + * Many systems always return invalid values for current settings + * (_CRS). Since we can't trust the value returned, we have to + * assume we were successful. + */ +#ifdef ACPI_OLD_PCI_LINK error = acpi_pci_link_get_current_irq(link, &link->current_irq); if (ACPI_FAILURE(error)) { ACPI_DEBUG_PRINT((ACPI_DB_WARN, @@ -647,6 +677,7 @@ link->current_irq = 0; error = AE_ERROR; } +#endif /* ACPI_OLD_PCI_LINK */ return_ACPI_STATUS (error); } ==== //depot/projects/netperf_socket/sys/dev/ata/ata-all.c#12 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.217 2004/08/01 12:31:38 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.218 2004/08/05 21:13:40 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -231,7 +231,6 @@ int ata_reinit(struct ata_channel *ch) { - struct ata_request *request = ch->running; int devices, misdev, newdev; if (!ch->r_irq) @@ -242,10 +241,8 @@ ata_printf(ch, -1, "reiniting channel ..\n"); ATA_FORCELOCK_CH(ch); ch->flags |= ATA_IMMEDIATE_MODE; - ch->running = NULL; devices = ch->devices; ch->hw.reset(ch); - ATA_UNLOCK_CH(ch); if (bootverbose) ata_printf(ch, -1, "resetting done ..\n"); @@ -254,10 +251,6 @@ if ((misdev = devices & ~ch->devices)) { if ((misdev & (ATA_ATA_MASTER | ATA_ATAPI_MASTER)) && ch->device[MASTER].detach) { - if (request && (request->device == &ch->device[MASTER])) { - request->result = ENXIO; - request->retries = 0; - } ch->device[MASTER].detach(&ch->device[MASTER]); ata_fail_requests(ch, &ch->device[MASTER]); free(ch->device[MASTER].param, M_ATA); @@ -265,10 +258,6 @@ } if ((misdev & (ATA_ATA_SLAVE | ATA_ATAPI_SLAVE)) && ch->device[SLAVE].detach) { - if (request && (request->device == &ch->device[SLAVE])) { - request->result = ENXIO; - request->retries = 0; - } ch->device[SLAVE].detach(&ch->device[SLAVE]); ata_fail_requests(ch, &ch->device[SLAVE]); free(ch->device[SLAVE].param, M_ATA); @@ -276,6 +265,9 @@ } } + ch->running = NULL; + ATA_UNLOCK_CH(ch); + /* identify what is present on the channel now */ ata_identify_devices(ch); ==== //depot/projects/netperf_socket/sys/dev/ata/ata-all.h#9 (text+ko) ==== @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.79 2004/04/30 16:21:34 sos Exp $ + * $FreeBSD: src/sys/dev/ata/ata-all.h,v 1.80 2004/08/05 21:13:41 sos Exp $ */ /* ATA register defines */ @@ -297,8 +297,9 @@ u_int32_t max_iosize; /* DMA engine max IO size */ u_int32_t cur_iosize; /* DMA engine current IO size */ int flags; -#define ATA_DMA_ACTIVE 0x01 /* DMA transfer in progress */ -#define ATA_DMA_READ 0x02 /* transaction is a read */ +#define ATA_DMA_READ 0x01 /* transaction is a read */ +#define ATA_DMA_LOADED 0x02 /* DMA tables etc loaded */ +#define ATA_DMA_ACTIVE 0x04 /* DMA transfer in progress */ void (*alloc)(struct ata_channel *ch); void (*free)(struct ata_channel *ch); ==== //depot/projects/netperf_socket/sys/dev/ata/ata-chipset.c#13 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.77 2004/07/30 13:33:09 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.78 2004/08/05 21:13:41 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -1278,16 +1278,16 @@ break; case PRMIO: - if (ctlr->r_res1) - bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,ctlr->r_res1); +// if (ctlr->r_res1) +// bus_release_resource(dev, ctlr->r_type1, ctlr->r_rid1,ctlr->r_res1); ctlr->r_type1 = SYS_RES_MEMORY; - ctlr->r_rid1 = 0x20; + ctlr->r_rid1 = PCIR_BAR(4); if (!(ctlr->r_res1 = bus_alloc_resource_any(dev, ctlr->r_type1, &ctlr->r_rid1, RF_ACTIVE))) return ENXIO; ctlr->r_type2 = SYS_RES_MEMORY; - ctlr->r_rid2 = 0x1c; + ctlr->r_rid2 = PCIR_BAR(3); if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE))) return ENXIO; @@ -1433,12 +1433,14 @@ static int ata_promise_mio_dmastart(struct ata_channel *ch) { + ch->flags |= ATA_DMA_ACTIVE; return 0; } static int ata_promise_mio_dmastop(struct ata_channel *ch) { + ch->flags &= ~ATA_DMA_ACTIVE; /* get status XXX SOS */ return 0; } @@ -1777,6 +1779,7 @@ ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, ((ch->dma->flags & ATA_DMA_READ) ? ATA_BMCMD_WRITE_READ : 0) | ATA_BMCMD_START_STOP); + ch->flags |= ATA_DMA_ACTIVE; return 0; } @@ -1795,6 +1798,7 @@ error = ATA_IDX_INB(ch, ATA_BMSTAT_PORT); ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); + ch->flags &= ~ATA_DMA_ACTIVE; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR); return error; } @@ -2057,7 +2061,7 @@ } ctlr->r_type2 = SYS_RES_MEMORY; - ctlr->r_rid2 = 0x24; + ctlr->r_rid2 = PCIR_BAR(5); if (!(ctlr->r_res2 = bus_alloc_resource_any(dev, ctlr->r_type2, &ctlr->r_rid2, RF_ACTIVE))) return ENXIO; ==== //depot/projects/netperf_socket/sys/dev/ata/ata-disk.c#7 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.174 2004/07/12 10:50:50 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-disk.c,v 1.175 2004/08/05 21:11:32 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -392,10 +392,11 @@ ata_mode2str(adp->device->mode)); } else { - ata_prtdev(adp->device,"%lluMB <%.40s> [%lld/%d/%d] at ata%d-%s %s", + ata_prtdev(adp->device, + "%lluMB <%.40s/%.8s> [%lld/%d/%d] at ata%d-%s %s", (unsigned long long)(adp->total_secs / ((1024L * 1024L) / DEV_BSIZE)), - adp->device->param->model, + adp->device->param->model, adp->device->param->revision, (unsigned long long)(adp->total_secs / (adp->heads * adp->sectors)), adp->heads, adp->sectors, ==== //depot/projects/netperf_socket/sys/dev/ata/ata-dma.c#3 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.126 2004/04/13 09:44:20 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-dma.c,v 1.127 2004/08/05 21:13:41 sos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -265,8 +265,7 @@ dir ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); ch->dma->cur_iosize = count; - ch->dma->flags = dir ? (ATA_DMA_ACTIVE | ATA_DMA_READ) : ATA_DMA_ACTIVE; - + ch->dma->flags = dir ? (ATA_DMA_LOADED | ATA_DMA_READ) : ATA_DMA_LOADED; return 0; } @@ -281,7 +280,6 @@ bus_dmamap_unload(ch->dma->ddmatag, ch->dma->ddmamap); ch->dma->cur_iosize = 0; - ch->dma->flags = 0; - + ch->dma->flags &= ~ATA_DMA_LOADED; return 0; } ==== //depot/projects/netperf_socket/sys/dev/ata/ata-lowlevel.c#12 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-lowlevel.c,v 1.40 2004/07/24 19:03:28 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-lowlevel.c,v 1.41 2004/08/05 21:13:41 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -80,9 +80,6 @@ return ATA_OP_FINISHED; } - /* record the request as running */ - ch->running = request; - ATA_DEBUG_RQ(request, "transaction"); /* disable ATAPI DMA writes if HW doesn't support it */ @@ -120,10 +117,8 @@ else printf("ATAPI_RESET timeout\n"); - if (request->status & ATA_S_ERROR) { + if (request->status & ATA_S_ERROR) request->error = ATA_IDX_INB(ch, ATA_ERROR); - //request->result = EIO; - } break; } @@ -139,7 +134,8 @@ } } - /* return and wait for interrupt */ + /* record the request as running and return for interrupt */ + ch->running = request; return ATA_OP_CONTINUES; /* ATA DMA data transfer commands */ @@ -168,7 +164,8 @@ break; } - /* return and wait for interrupt */ + /* record the request as running and return for interrupt */ + ch->running = request; return ATA_OP_CONTINUES; /* ATAPI PIO commands */ @@ -192,8 +189,10 @@ } /* command interrupt device ? just return and wait for interrupt */ - if ((request->device->param->config & ATA_DRQ_MASK) == ATA_DRQ_INTR) + if ((request->device->param->config & ATA_DRQ_MASK) == ATA_DRQ_INTR) { + ch->running = request; return ATA_OP_CONTINUES; + } /* wait for ready to write ATAPI command block */ { @@ -224,7 +223,8 @@ (request->device->param->config & ATA_PROTO_MASK) == ATA_PROTO_ATAPI_12 ? 6 : 8); - /* return and wait for interrupt */ + /* record the request as running and return for interrupt */ + ch->running = request; return ATA_OP_CONTINUES; case ATA_R_ATAPI|ATA_R_DMA: @@ -289,14 +289,14 @@ break; } - /* return and wait for interrupt */ + /* record the request as running and return for interrupt */ + ch->running = request; return ATA_OP_CONTINUES; } /* request finish here */ - if (ch->dma->flags & ATA_DMA_ACTIVE) + if (ch->dma->flags & ATA_DMA_LOADED) ch->dma->unload(ch); - ch->running = NULL; return ATA_OP_FINISHED; } ==== //depot/projects/netperf_socket/sys/dev/ata/ata-pci.c#9 (text+ko) ==== @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.85 2004/06/15 11:02:09 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-pci.c,v 1.86 2004/08/05 21:13:41 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -454,6 +454,7 @@ (ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_WRITE_READ) | ((ch->dma->flags & ATA_DMA_READ) ? ATA_BMCMD_WRITE_READ : 0) | ATA_BMCMD_START_STOP); + ch->dma->flags |= ATA_DMA_ACTIVE; return 0; } @@ -465,6 +466,7 @@ error = ATA_IDX_INB(ch, ATA_BMSTAT_PORT) & ATA_BMSTAT_MASK; ATA_IDX_OUTB(ch, ATA_BMCMD_PORT, ATA_IDX_INB(ch, ATA_BMCMD_PORT) & ~ATA_BMCMD_START_STOP); + ch->dma->flags &= ~ATA_DMA_ACTIVE; ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR); return error; } ==== //depot/projects/netperf_socket/sys/dev/ata/ata-queue.c#9 (text+ko) ==== @@ -27,7 +27,7 @@ */ >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408052127.i75LRD4o084930>