Date: Fri, 17 Nov 2006 21:00:11 GMT From: Jung-uk Kim <jkim@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 110180 for review Message-ID: <200611172100.kAHL0B2f061477@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=110180 Change 110180 by jkim@jkim_hammer on 2006/11/17 20:59:43 IFC (for sys/kern/sysv_msg.c) Affected files ... .. //depot/projects/linuxolator/src/sys/amd64/amd64/db_trace.c#4 integrate .. //depot/projects/linuxolator/src/sys/amd64/amd64/intr_machdep.c#5 integrate .. //depot/projects/linuxolator/src/sys/amd64/amd64/io_apic.c#3 integrate .. //depot/projects/linuxolator/src/sys/amd64/amd64/machdep.c#8 integrate .. //depot/projects/linuxolator/src/sys/amd64/include/reg.h#3 integrate .. //depot/projects/linuxolator/src/sys/arm/arm/nexus.c#3 integrate .. //depot/projects/linuxolator/src/sys/arm/xscale/i80321/ep80219_machdep.c#3 integrate .. //depot/projects/linuxolator/src/sys/arm/xscale/i80321/iq31244_machdep.c#3 integrate .. //depot/projects/linuxolator/src/sys/ddb/db_watch.c#2 integrate .. //depot/projects/linuxolator/src/sys/dev/ata/ata-all.c#3 integrate .. //depot/projects/linuxolator/src/sys/dev/isp/isp_pci.c#4 integrate .. //depot/projects/linuxolator/src/sys/dev/mpt/mpt_cam.c#6 integrate .. //depot/projects/linuxolator/src/sys/dev/nfe/if_nfe.c#4 integrate .. //depot/projects/linuxolator/src/sys/fs/procfs/procfs_ioctl.c#4 integrate .. //depot/projects/linuxolator/src/sys/i386/i386/db_trace.c#4 integrate .. //depot/projects/linuxolator/src/sys/i386/i386/intr_machdep.c#3 integrate .. //depot/projects/linuxolator/src/sys/i386/i386/io_apic.c#3 integrate .. //depot/projects/linuxolator/src/sys/i386/i386/machdep.c#6 integrate .. //depot/projects/linuxolator/src/sys/i386/include/reg.h#3 integrate .. //depot/projects/linuxolator/src/sys/kern/sysv_msg.c#7 integrate .. //depot/projects/linuxolator/src/sys/nfsclient/nfs_node.c#3 integrate .. //depot/projects/linuxolator/src/sys/nfsclient/nfs_vnops.c#5 integrate Differences ... ==== //depot/projects/linuxolator/src/sys/amd64/amd64/db_trace.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.77 2006/11/15 19:53:47 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/db_trace.c,v 1.80 2006/11/17 20:27:00 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -200,7 +200,7 @@ static void db_print_stack_entry(const char *, int, char **, long *, db_addr_t); static void decode_syscall(int, struct thread *); -static char * watchtype_str(int type); +static const char * watchtype_str(int type); int amd64_set_watch(int watchnum, unsigned long watchaddr, int size, int access, struct dbreg *d); int amd64_clr_watch(int watchnum, struct dbreg *d); @@ -538,12 +538,11 @@ int access; struct dbreg *d; { - int i; - unsigned int mask; + int i, len; if (watchnum == -1) { - for (i = 0, mask = 0x3; i < 4; i++, mask <<= 2) - if ((d->dr[7] & mask) == 0) + for (i = 0; i < 4; i++) + if (!DBREG_DR7_ENABLED(d->dr[7], i)) break; if (i < 4) watchnum = i; @@ -563,25 +562,34 @@ } /* - * we can watch a 1, 2, or 4 byte sized location + * we can watch a 1, 2, 4, or 8 byte sized location */ switch (size) { - case 1 : mask = 0x00; break; - case 2 : mask = 0x01 << 2; break; - case 4 : mask = 0x03 << 2; break; - default : return (-1); + case 1: + len = DBREG_DR7_LEN_1; + break; + case 2: + len = DBREG_DR7_LEN_2; + break; + case 4: + len = DBREG_DR7_LEN_4; + break; + case 8: + len = DBREG_DR7_LEN_8; + break; + default: + return (-1); } - mask |= access; - /* clear the bits we are about to affect */ - d->dr[7] &= ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16))); + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); /* set drN register to the address, N=watchnum */ DBREG_DRX(d, watchnum) = watchaddr; /* enable the watchpoint */ - d->dr[7] |= (0x2 << (watchnum*2)) | (mask << (watchnum*4+16)); + d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, + DBREG_DR7_GLOBAL_ENABLE); return (watchnum); } @@ -596,7 +604,7 @@ if (watchnum < 0 || watchnum >= 4) return (-1); - d->dr[7] = d->dr[7] & ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16))); + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); DBREG_DRX(d, watchnum) = 0; return (0); @@ -615,25 +623,26 @@ avail = 0; for(i = 0; i < 4; i++) { - if ((d.dr[7] & (3 << (i*2))) == 0) + if (!DBREG_DR7_ENABLED(d.dr[7], i)) avail++; } - if (avail * 4 < size) + if (avail * 8 < size) return (-1); - for (i = 0; i < 4 && (size != 0); i++) { - if ((d.dr[7] & (3<<(i*2))) == 0) { - if (size > 4) + for (i = 0; i < 4 && (size > 0); i++) { + if (!DBREG_DR7_ENABLED(d.dr[7], i)) { + if (size >= 8 || (avail == 1 && size > 4)) + wsize = 8; + else if (size > 2) wsize = 4; else wsize = size; - if (wsize == 3) - wsize++; amd64_set_watch(i, addr, wsize, DBREG_DR7_WRONLY, &d); addr += wsize; size -= wsize; + avail--; } } @@ -648,13 +657,13 @@ db_expr_t addr; db_expr_t size; { + struct dbreg d; int i; - struct dbreg d; fill_dbregs(NULL, &d); for(i = 0; i < 4; i++) { - if (d.dr[7] & (3 << (i*2))) { + if (DBREG_DR7_ENABLED(d.dr[7], i)) { if ((DBREG_DRX((&d), i) >= addr) && (DBREG_DRX((&d), i) < addr+size)) amd64_clr_watch(i, &d); @@ -668,8 +677,7 @@ } -static -char * +static const char * watchtype_str(type) int type; { @@ -691,17 +699,21 @@ fill_dbregs(NULL, &d); db_printf("\nhardware watchpoints:\n"); - db_printf(" watch status type len address\n"); - db_printf(" ----- -------- ---------- --- ----------\n"); + db_printf(" watch status type len address\n"); + db_printf(" ----- -------- ---------- --- ------------------\n"); for (i = 0; i < 4; i++) { - if (d.dr[7] & (0x03 << (i*2))) { - type = (d.dr[7] >> (16+(i*4))) & 3; - len = (d.dr[7] >> (16+(i*4)+2)) & 3; - db_printf(" %-5d %-8s %10s %3d 0x%016lx\n", - i, "enabled", watchtype_str(type), - len + 1, DBREG_DRX((&d), i)); - } - else { + if (DBREG_DR7_ENABLED(d.dr[7], i)) { + type = DBREG_DR7_ACCESS(d.dr[7], i); + len = DBREG_DR7_LEN(d.dr[7], i); + if (len == DBREG_DR7_LEN_8) + len = 8; + else + len++; + db_printf(" %-5d %-8s %10s %3d ", + i, "enabled", watchtype_str(type), len); + db_printsym((db_addr_t)DBREG_DRX((&d), i), DB_STGY_ANY); + db_printf("\n"); + } else { db_printf(" %-5d disabled\n", i); } } ==== //depot/projects/linuxolator/src/sys/amd64/amd64/intr_machdep.c#5 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.25 2006/10/16 21:40:46 jhb Exp $ + * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.26 2006/11/17 16:41:03 jhb Exp $ */ /* @@ -446,10 +446,6 @@ current_cpu++; if (current_cpu >= num_cpus) current_cpu = 0; - if (bootverbose) { - printf("INTR: Assigning IRQ %d", pic->pic_vector(isrc)); - printf(" to local APIC %u\n", apic_id); - } pic->pic_assign_cpu(isrc, apic_id); } @@ -483,7 +479,7 @@ if (num_cpus <= 1) return; - /* Round-robin assign each enabled source a CPU. */ + /* Round-robin assign a CPU to each enabled source. */ mtx_lock_spin(&intr_table_lock); assign_cpu = 1; for (i = 0; i < NUM_IO_INTS; i++) { ==== //depot/projects/linuxolator/src/sys/amd64/amd64/io_apic.c#3 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/io_apic.c,v 1.25 2006/10/10 23:23:11 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/io_apic.c,v 1.26 2006/11/17 16:41:03 jhb Exp $"); #include "opt_isa.h" @@ -512,13 +512,6 @@ * be routed to other CPUs later after they are enabled. */ intpin->io_cpu = PCPU_GET(apic_id); - if (bootverbose && intpin->io_irq != IRQ_DISABLED) { - printf("ioapic%u: intpin %d -> ", io->io_id, i); - ioapic_print_irq(intpin); - printf(" (%s, %s)\n", intpin->io_edgetrigger ? - "edge" : "level", intpin->io_activehi ? "high" : - "low"); - } value = ioapic_read(apic, IOAPIC_REDTBL_LO(i)); ioapic_write(apic, IOAPIC_REDTBL_LO(i), value | IOART_INTMSET); } @@ -583,6 +576,8 @@ return (EINVAL); if (io->io_pins[pin].io_irq >= NUM_IO_INTS) return (EINVAL); + if (io->io_pins[pin].io_bus == bus_type) + return (0); io->io_pins[pin].io_bus = bus_type; if (bootverbose) printf("ioapic%u: intpin %d bus %s\n", io->io_id, pin, @@ -666,13 +661,17 @@ ioapic_set_polarity(void *cookie, u_int pin, enum intr_polarity pol) { struct ioapic *io; + int activehi; io = (struct ioapic *)cookie; if (pin >= io->io_numintr || pol == INTR_POLARITY_CONFORM) return (EINVAL); if (io->io_pins[pin].io_irq >= NUM_IO_INTS) return (EINVAL); - io->io_pins[pin].io_activehi = (pol == INTR_POLARITY_HIGH); + activehi = (pol == INTR_POLARITY_HIGH); + if (io->io_pins[pin].io_activehi == activehi) + return (0); + io->io_pins[pin].io_activehi = activehi; if (bootverbose) printf("ioapic%u: intpin %d polarity: %s\n", io->io_id, pin, pol == INTR_POLARITY_HIGH ? "high" : "low"); @@ -683,13 +682,17 @@ ioapic_set_triggermode(void *cookie, u_int pin, enum intr_trigger trigger) { struct ioapic *io; + int edgetrigger; io = (struct ioapic *)cookie; if (pin >= io->io_numintr || trigger == INTR_TRIGGER_CONFORM) return (EINVAL); if (io->io_pins[pin].io_irq >= NUM_IO_INTS) - return (EINVAL); - io->io_pins[pin].io_edgetrigger = (trigger == INTR_TRIGGER_EDGE); + return (EINVAL); + edgetrigger = (trigger == INTR_TRIGGER_EDGE); + if (io->io_pins[pin].io_edgetrigger == edgetrigger) + return (0); + io->io_pins[pin].io_edgetrigger = edgetrigger; if (bootverbose) printf("ioapic%u: intpin %d trigger: %s\n", io->io_id, pin, trigger == INTR_TRIGGER_EDGE ? "edge" : "level"); ==== //depot/projects/linuxolator/src/sys/amd64/amd64/machdep.c#8 (text+ko) ==== @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.661 2006/11/15 19:53:47 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/amd64/amd64/machdep.c,v 1.663 2006/11/17 20:27:01 jhb Exp $"); #include "opt_atalk.h" #include "opt_atpic.h" @@ -1692,7 +1692,6 @@ { struct pcb *pcb; int i; - u_int64_t mask1, mask2; if (td == NULL) { load_dr0(dbregs->dr[0]); @@ -1709,10 +1708,13 @@ * TRCTRAP or a general protection fault right here. * Upper bits of dr6 and dr7 must not be set */ - for (i = 0, mask1 = 0x3<<16, mask2 = 0x2<<16; i < 8; - i++, mask1 <<= 2, mask2 <<= 2) - if ((dbregs->dr[7] & mask1) == mask2) + for (i = 0; i < 4; i++) { + if (DBREG_DR7_ACCESS(dbregs->dr[7], i) == 0x02) + return (EINVAL); + if (td->td_frame->tf_cs == _ucode32sel && + DBREG_DR7_LEN(dbregs->dr[7], i) == DBREG_DR7_LEN_8) return (EINVAL); + } if ((dbregs->dr[6] & 0xffffffff00000000ul) != 0 || (dbregs->dr[7] & 0xffffffff00000000ul) != 0) return (EINVAL); @@ -1733,22 +1735,22 @@ * from within kernel mode? */ - if (dbregs->dr[7] & 0x3) { + if (DBREG_DR7_ENABLED(dbregs->dr[7], 0)) { /* dr0 is enabled */ if (dbregs->dr[0] >= VM_MAXUSER_ADDRESS) return (EINVAL); } - if (dbregs->dr[7] & 0x3<<2) { + if (DBREG_DR7_ENABLED(dbregs->dr[7], 1)) { /* dr1 is enabled */ if (dbregs->dr[1] >= VM_MAXUSER_ADDRESS) return (EINVAL); } - if (dbregs->dr[7] & 0x3<<4) { + if (DBREG_DR7_ENABLED(dbregs->dr[7], 2)) { /* dr2 is enabled */ if (dbregs->dr[2] >= VM_MAXUSER_ADDRESS) return (EINVAL); } - if (dbregs->dr[7] & 0x3<<6) { + if (DBREG_DR7_ENABLED(dbregs->dr[7], 3)) { /* dr3 is enabled */ if (dbregs->dr[3] >= VM_MAXUSER_ADDRESS) return (EINVAL); ==== //depot/projects/linuxolator/src/sys/amd64/include/reg.h#3 (text+ko) ==== @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)reg.h 5.5 (Berkeley) 1/18/91 - * $FreeBSD: src/sys/amd64/include/reg.h,v 1.36 2006/11/15 19:53:48 jhb Exp $ + * $FreeBSD: src/sys/amd64/include/reg.h,v 1.38 2006/11/17 20:27:01 jhb Exp $ */ #ifndef _MACHINE_REG_H_ @@ -92,9 +92,22 @@ /* Index 8-15: reserved */ }; +#define DBREG_DR7_LOCAL_ENABLE 0x01 +#define DBREG_DR7_GLOBAL_ENABLE 0x02 +#define DBREG_DR7_LEN_1 0x00 /* 1 byte length */ +#define DBREG_DR7_LEN_2 0x01 +#define DBREG_DR7_LEN_4 0x03 +#define DBREG_DR7_LEN_8 0x02 #define DBREG_DR7_EXEC 0x00 /* break on execute */ #define DBREG_DR7_WRONLY 0x01 /* break on write */ #define DBREG_DR7_RDWR 0x03 /* break on read or write */ +#define DBREG_DR7_MASK(i) ((u_long)0xf << ((i) * 4 + 16) | 0x3 << (i) * 2) +#define DBREG_DR7_SET(i, len, access, enable) \ + ((u_long)((len) << 2 | (access)) << ((i) * 4 + 16) | (enable) << (i) * 2) +#define DBREG_DR7_GD 0x2000 +#define DBREG_DR7_ENABLED(d, i) (((d) & 0x3 << (i) * 2) != 0) +#define DBREG_DR7_ACCESS(d, i) ((d) >> ((i) * 4 + 16) & 0x3) +#define DBREG_DR7_LEN(d, i) ((d) >> ((i) * 4 + 18) & 0x3) #define DBREG_DRX(d,x) ((d)->dr[(x)]) /* reference dr0 - dr15 by register number */ ==== //depot/projects/linuxolator/src/sys/arm/arm/nexus.c#3 (text+ko) ==== @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/arm/nexus.c,v 1.9 2006/10/25 21:11:46 cognet Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/arm/nexus.c,v 1.10 2006/11/17 11:56:56 cognet Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -142,7 +142,7 @@ int i; for (i = rman_get_start(r); i <= rman_get_end(r); i++) - arm_mask_irq(rman_get_start(r)); + arm_mask_irq(i); error = arm_remove_irqhandler(ih); return (error); } ==== //depot/projects/linuxolator/src/sys/arm/xscale/i80321/ep80219_machdep.c#3 (text+ko) ==== @@ -49,7 +49,7 @@ #include "opt_ddb.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/ep80219_machdep.c,v 1.3 2006/10/26 21:42:17 jb Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/ep80219_machdep.c,v 1.4 2006/11/17 00:53:39 kevlo Exp $"); #define _ARM32_BUS_DMA_PRIVATE #include <sys/param.h> @@ -474,7 +474,6 @@ /* Do basic tuning, hz etc */ init_param1(); init_param2(physmem); - avail_end = 0xa0000000 + memsize - 1; kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - sizeof(struct pcb))); ==== //depot/projects/linuxolator/src/sys/arm/xscale/i80321/iq31244_machdep.c#3 (text+ko) ==== @@ -49,7 +49,7 @@ #include "opt_ddb.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/iq31244_machdep.c,v 1.24 2006/10/26 21:42:17 jb Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/xscale/i80321/iq31244_machdep.c,v 1.25 2006/11/17 00:53:39 kevlo Exp $"); #define _ARM32_BUS_DMA_PRIVATE #include <sys/param.h> @@ -477,7 +477,6 @@ /* Do basic tuning, hz etc */ init_param1(); init_param2(physmem); - avail_end = 0xa0000000 + memsize - 1; kdb_init(); return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP - sizeof(struct pcb))); ==== //depot/projects/linuxolator/src/sys/ddb/db_watch.c#2 (text+ko) ==== @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/ddb/db_watch.c,v 1.27 2005/09/10 03:01:24 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/ddb/db_watch.c,v 1.28 2006/11/17 16:41:56 jhb Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -168,11 +168,19 @@ return; } +#ifdef __LP64__ + db_printf(" Map Address Size\n"); +#else db_printf(" Map Address Size\n"); +#endif for (watch = db_watchpoint_list; watch != 0; watch = watch->link) +#ifdef __LP64__ + db_printf("%s%16p %16lx %lx\n", +#else db_printf("%s%8p %8lx %lx\n", +#endif db_map_current(watch->map) ? "*" : " ", (void *)watch->map, (long)watch->loaddr, (long)watch->hiaddr - (long)watch->loaddr); ==== //depot/projects/linuxolator/src/sys/dev/ata/ata-all.c#3 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.274 2006/09/11 18:33:59 sos Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/ata/ata-all.c,v 1.275 2006/11/17 11:13:47 sos Exp $"); #include "opt_ata.h" #include <sys/param.h> @@ -601,12 +601,12 @@ isprint(atadev->param.model[1]))) { struct ata_params *atacap = &atadev->param; char buffer[64]; -#if BYTE_ORDER == BIG_ENDIAN +#ifndef __ARMEB__ int16_t *ptr; for (ptr = (int16_t *)atacap; ptr < (int16_t *)atacap + sizeof(struct ata_params)/2; ptr++) { - *ptr = bswap16(*ptr); + *ptr = le16toh(*ptr); } #endif if (!(!strncmp(atacap->model, "FX", 2) || ==== //depot/projects/linuxolator/src/sys/dev/isp/isp_pci.c#4 (text+ko) ==== @@ -30,7 +30,7 @@ * FreeBSD Version. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.125 2006/11/14 08:45:48 mjacob Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/isp/isp_pci.c,v 1.126 2006/11/17 17:32:45 mjacob Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1057,6 +1057,7 @@ cmd &= ~PCIM_CMD_INTX_DISABLE; } +#ifdef WE_KNEW_WHAT_WE_WERE_DOING if (IS_24XX(isp)) { int reg; @@ -1088,6 +1089,11 @@ pci_write_config(dev, reg, 2, pectl); } } +#else + if (IS_24XX(isp)) { + cmd &= ~PCIM_CMD_INTX_DISABLE; + } +#endif pci_write_config(dev, PCIR_COMMAND, cmd, 2); ==== //depot/projects/linuxolator/src/sys/dev/mpt/mpt_cam.c#6 (text+ko) ==== @@ -94,7 +94,7 @@ * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.38 2006/11/15 21:46:36 jb Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/mpt/mpt_cam.c,v 1.40 2006/11/17 00:19:55 mjacob Exp $"); #include <dev/mpt/mpt.h> #include <dev/mpt/mpt_cam.h> @@ -3144,14 +3144,16 @@ * XXX: FC cards report MAX_DEVICES of 512- but we * XXX: seem to hang when going higher than 255. */ - if (cpi->max_target > 255) + if (cpi->max_target > 255) { cpi->max_target = 255; + } /* * XXX: VMware ESX reports > 16 devices and then dies * XXX: when we probe. */ - if (mpt->is_spi && cpi->max_target > 15) + if (mpt->is_spi && cpi->max_target > 15) { cpi->max_target = 15; + } cpi->max_lun = 7; cpi->initiator_id = mpt->mpt_ini_id; @@ -3166,8 +3168,7 @@ */ if (mpt->is_fc) { cpi->hba_misc = PIM_NOBUSRESET; - cpi->base_transfer_speed = - mpt->mpt_fcport_speed * 100000; + cpi->base_transfer_speed = 100000; cpi->hba_inquiry = PI_TAG_ABLE; cpi->transport = XPORT_FC; cpi->transport_version = 0; @@ -4151,12 +4152,16 @@ bus_addr_t pptr; request_t *req; - if (length == 0) { + /* + * We enter with resid set to the data load for the command. + */ + tgt = MPT_TGT_STATE(mpt, cmd_req); + if (length == 0 || tgt->resid == 0) { + tgt->resid = 0; mpt_scsi_tgt_status(mpt, NULL, cmd_req, 0, NULL); return; } - tgt = MPT_TGT_STATE(mpt, cmd_req); if ((req = mpt_get_request(mpt, FALSE)) == NULL) { mpt_prt(mpt, "out of resources- dropping local response\n"); return; @@ -4208,7 +4213,7 @@ tgt->ccb = NULL; tgt->req = req; - tgt->resid = 0; + tgt->resid -= length; tgt->bytes_xfered = length; #ifdef WE_TRUST_AUTO_GOOD_STATUS tgt->state = TGT_STATE_MOVING_DATA_AND_STATUS; @@ -4514,6 +4519,13 @@ static void mpt_scsi_tgt_atio(struct mpt_softc *mpt, request_t *req, uint32_t reply_desc) { + static uint8_t null_iqd[SHORT_INQUIRY_LENGTH] = { + 0x7f, 0x00, 0x02, 0x02, 0x20, 0x00, 0x00, 0x32, + 'F', 'R', 'E', 'E', 'B', 'S', 'D', ' ', + 'L', 'S', 'I', '-', 'L', 'O', 'G', 'I', + 'C', ' ', 'N', 'U', 'L', 'D', 'E', 'V', + '0', '0', '0', '1' + }; struct ccb_accept_tio *atiop; lun_id_t lun; int tag_action = 0; @@ -4660,12 +4672,9 @@ * REPORT LUNS gets illegal command. * All other commands get 'no such device'. */ - uint8_t *sp, cond, buf[MPT_SENSE_SIZE]; + size_t len; - mpt_prt(mpt, "CMD 0x%x to unmanaged lun %u\n", - cdbp[0], lun); - memset(buf, 0, MPT_SENSE_SIZE); cond = SCSI_STATUS_CHECK_COND; buf[0] = 0xf0; @@ -4677,31 +4686,38 @@ switch (cdbp[0]) { case INQUIRY: { - static uint8_t iqd[8] = { - 0x7f, 0x0, 0x4, 0x12, 0x0 - }; if (cdbp[1] != 0) { buf[12] = 0x26; buf[13] = 0x01; break; } - mpt_prt(mpt, "local inquiry\n"); + len = min(tgt->resid, cdbp[4]); + len = min(len, sizeof (null_iqd)); + mpt_lprt(mpt, MPT_PRT_DEBUG, + "local inquiry %ld bytes\n", (long) len); mpt_scsi_tgt_local(mpt, req, lun, 1, - iqd, sizeof (iqd)); + null_iqd, len); return; } case REQUEST_SENSE: { buf[2] = 0x0; - mpt_prt(mpt, "local request sense\n"); + len = min(tgt->resid, cdbp[4]); + len = min(len, sizeof (buf)); + mpt_lprt(mpt, MPT_PRT_DEBUG, + "local reqsense %ld bytes\n", (long) len); mpt_scsi_tgt_local(mpt, req, lun, 1, - buf, sizeof (buf)); + buf, len); return; } case REPORT_LUNS: + mpt_lprt(mpt, MPT_PRT_DEBUG, "REPORT LUNS\n"); buf[12] = 0x26; - break; + return; default: + mpt_lprt(mpt, MPT_PRT_DEBUG, + "CMD 0x%x to unmanaged lun %u\n", + cdbp[0], lun); buf[12] = 0x25; break; } ==== //depot/projects/linuxolator/src/sys/dev/nfe/if_nfe.c#4 (text+ko) ==== @@ -21,7 +21,7 @@ /* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/nfe/if_nfe.c,v 1.7 2006/10/19 10:01:26 obrien Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/nfe/if_nfe.c,v 1.8 2006/11/17 16:49:40 obrien Exp $"); /* Uncomment the following line to enable polling. */ /* #define DEVICE_POLLING */ @@ -1130,7 +1130,7 @@ static void nfe_poll(struct ifnet *ifp, enum poll_cmd cmd, int count) { - struct nfe_softc *sc = ifp->if_softc; + struct nfe_softc *sc = ifp->if_softc; NFE_LOCK(sc); if (ifp->if_drv_flags & IFF_DRV_RUNNING) @@ -1142,7 +1142,7 @@ static void nfe_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count) { - struct nfe_softc *sc = ifp->if_softc; + struct nfe_softc *sc = ifp->if_softc; u_int32_t r; NFE_LOCK_ASSERT(sc); ==== //depot/projects/linuxolator/src/sys/fs/procfs/procfs_ioctl.c#4 (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/fs/procfs/procfs_ioctl.c,v 1.14 2006/11/06 13:41:57 rwatson Exp $ + * $FreeBSD: src/sys/fs/procfs/procfs_ioctl.c,v 1.15 2006/11/17 14:52:38 kib Exp $ */ #include "opt_compat.h" @@ -124,7 +124,7 @@ *(unsigned int *)data = p->p_pfsflags; break; case PIOCWAIT: - while (p->p_step == 0) { + while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); @@ -142,7 +142,7 @@ break; #ifdef COMPAT_IA32 case PIOCWAIT32: - while (p->p_step == 0) { + while (p->p_step == 0 && (p->p_flag & P_WEXIT) == 0) { /* sleep until p stops */ error = msleep(&p->p_stype, &p->p_mtx, PWAIT|PCATCH, "pioctl", 0); ==== //depot/projects/linuxolator/src/sys/i386/i386/db_trace.c#4 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/db_trace.c,v 1.76 2006/11/15 19:53:48 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/db_trace.c,v 1.78 2006/11/17 19:20:32 jhb Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -190,7 +190,7 @@ static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t); static void decode_syscall(int, struct thread *); -static char * watchtype_str(int type); +static const char * watchtype_str(int type); int i386_set_watch(int watchnum, unsigned int watchaddr, int size, int access, struct dbreg *d); int i386_clr_watch(int watchnum, struct dbreg *d); @@ -571,12 +571,11 @@ int access; struct dbreg *d; { - int i; - unsigned int mask; + int i, len; if (watchnum == -1) { - for (i = 0, mask = 0x3; i < 4; i++, mask <<= 2) - if ((d->dr[7] & mask) == 0) + for (i = 0; i < 4; i++) + if (!DBREG_DR7_ENABLED(d->dr[7], i)) break; if (i < 4) watchnum = i; @@ -599,22 +598,28 @@ * we can watch a 1, 2, or 4 byte sized location */ switch (size) { - case 1 : mask = 0x00; break; - case 2 : mask = 0x01 << 2; break; - case 4 : mask = 0x03 << 2; break; - default : return (-1); + case 1: + len = DBREG_DR7_LEN_1; + break; + case 2: + len = DBREG_DR7_LEN_2; + break; + case 4: + len = DBREG_DR7_LEN_4; + break; + default: + return (-1); } - mask |= access; - /* clear the bits we are about to affect */ - d->dr[7] &= ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16))); + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); /* set drN register to the address, N=watchnum */ DBREG_DRX(d, watchnum) = watchaddr; /* enable the watchpoint */ - d->dr[7] |= (0x2 << (watchnum*2)) | (mask << (watchnum*4+16)); + d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, + DBREG_DR7_GLOBAL_ENABLE); return (watchnum); } @@ -629,7 +634,7 @@ if (watchnum < 0 || watchnum >= 4) return (-1); - d->dr[7] = d->dr[7] & ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16))); + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); DBREG_DRX(d, watchnum) = 0; return (0); @@ -648,21 +653,19 @@ avail = 0; for(i = 0; i < 4; i++) { - if ((d.dr[7] & (3 << (i*2))) == 0) + if (!DBREG_DR7_ENABLED(d.dr[7], i)) avail++; } if (avail * 4 < size) return (-1); - for (i = 0; i < 4 && (size != 0); i++) { - if ((d.dr[7] & (3<<(i*2))) == 0) { - if (size > 4) + for (i = 0; i < 4 && (size > 0); i++) { + if (!DBREG_DR7_ENABLED(d.dr[7], i)) { + if (size > 2) wsize = 4; else wsize = size; - if (wsize == 3) - wsize++; i386_set_watch(i, addr, wsize, DBREG_DR7_WRONLY, &d); addr += wsize; @@ -681,13 +684,13 @@ db_expr_t addr; db_expr_t size; { + struct dbreg d; int i; - struct dbreg d; fill_dbregs(NULL, &d); for(i = 0; i < 4; i++) { - if (d.dr[7] & (3 << (i*2))) { + if (DBREG_DR7_ENABLED(d.dr[7], i)) { if ((DBREG_DRX((&d), i) >= addr) && (DBREG_DRX((&d), i) < addr+size)) i386_clr_watch(i, &d); @@ -701,8 +704,7 @@ } -static -char * +static const char * watchtype_str(type) int type; { @@ -727,21 +729,21 @@ db_printf(" watch status type len address\n"); db_printf(" ----- -------- ---------- --- ----------\n"); for (i = 0; i < 4; i++) { - if (d.dr[7] & (0x03 << (i*2))) { - type = (d.dr[7] >> (16+(i*4))) & 3; - len = (d.dr[7] >> (16+(i*4)+2)) & 3; - db_printf(" %-5d %-8s %10s %3d 0x%08x\n", - i, "enabled", watchtype_str(type), - len+1, DBREG_DRX((&d),i)); - } - else { + if (DBREG_DR7_ENABLED(d.dr[7], i)) { + type = DBREG_DR7_ACCESS(d.dr[7], i); + len = DBREG_DR7_LEN(d.dr[7], i); + db_printf(" %-5d %-8s %10s %3d ", + i, "enabled", watchtype_str(type), len + 1); + db_printsym((db_addr_t)DBREG_DRX((&d), i), DB_STGY_ANY); + db_printf("\n"); + } else { db_printf(" %-5d disabled\n", i); } } db_printf("\ndebug register values:\n"); for (i = 0; i < 8; i++) { - db_printf(" dr%d 0x%08x\n", i, DBREG_DRX((&d),i)); + db_printf(" dr%d 0x%08x\n", i, DBREG_DRX((&d), i)); } db_printf("\n"); } ==== //depot/projects/linuxolator/src/sys/i386/i386/intr_machdep.c#3 (text+ko) ==== @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.20 2006/10/10 23:23:12 jhb Exp $ + * $FreeBSD: src/sys/i386/i386/intr_machdep.c,v 1.21 2006/11/17 16:41:03 jhb Exp $ */ /* @@ -412,10 +412,6 @@ current_cpu++; if (current_cpu >= num_cpus) current_cpu = 0; - if (bootverbose) { - printf("INTR: Assigning IRQ %d", pic->pic_vector(isrc)); - printf(" to local APIC %u\n", apic_id); - } pic->pic_assign_cpu(isrc, apic_id); } @@ -449,7 +445,7 @@ if (num_cpus <= 1) return; - /* Round-robin assign each enabled source a CPU. */ + /* Round-robin assign a CPU to each enabled source. */ mtx_lock_spin(&intr_table_lock); assign_cpu = 1; for (i = 0; i < NUM_IO_INTS; i++) { ==== //depot/projects/linuxolator/src/sys/i386/i386/io_apic.c#3 (text+ko) ==== @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/i386/i386/io_apic.c,v 1.29 2006/10/10 23:23:12 jhb Exp $"); +__FBSDID("$FreeBSD: src/sys/i386/i386/io_apic.c,v 1.30 2006/11/17 16:41:03 jhb Exp $"); #include "opt_isa.h" @@ -512,13 +512,6 @@ * be routed to other CPUs later after they are enabled. */ intpin->io_cpu = PCPU_GET(apic_id); - if (bootverbose && intpin->io_irq != IRQ_DISABLED) { - printf("ioapic%u: intpin %d -> ", io->io_id, i); - ioapic_print_irq(intpin); - printf(" (%s, %s)\n", intpin->io_edgetrigger ? - "edge" : "level", intpin->io_activehi ? "high" : - "low"); - } value = ioapic_read(apic, IOAPIC_REDTBL_LO(i)); ioapic_write(apic, IOAPIC_REDTBL_LO(i), value | IOART_INTMSET); } @@ -583,6 +576,8 @@ return (EINVAL); if (io->io_pins[pin].io_irq >= NUM_IO_INTS) >>> TRUNCATED FOR MAIL (1000 lines) <<<
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611172100.kAHL0B2f061477>