Date: Sat, 4 Feb 2012 23:27:17 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r231000 - in projects/pseries: amd64/acpica amd64/amd64 amd64/conf amd64/include boot/forth cam cam/ata cam/scsi cddl/compat/opensolaris/sys cddl/contrib/opensolaris/uts/common/fs/zfs c... Message-ID: <201202042327.q14NRHjr056538@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Sat Feb 4 23:27:16 2012 New Revision: 231000 URL: http://svn.freebsd.org/changeset/base/231000 Log: IFC @ 230995. Adapt RTAS PCI driver to new unified OF PCI interface. Added: projects/pseries/amd64/conf/WITHOUT_SOURCELESS - copied unchanged from r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS projects/pseries/amd64/conf/WITHOUT_SOURCELESS_HOST - copied unchanged from r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS_HOST projects/pseries/amd64/conf/WITHOUT_SOURCELESS_UCODE - copied unchanged from r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS_UCODE projects/pseries/dev/isci/ - copied from r230995, head/sys/dev/isci/ projects/pseries/dev/ixgbe/ixgbe_82598.h - copied unchanged from r230995, head/sys/dev/ixgbe/ixgbe_82598.h projects/pseries/dev/ixgbe/ixgbe_82599.h - copied unchanged from r230995, head/sys/dev/ixgbe/ixgbe_82599.h projects/pseries/dev/ixgbe/ixgbe_x540.c - copied unchanged from r230995, head/sys/dev/ixgbe/ixgbe_x540.c projects/pseries/dev/ixgbe/ixgbe_x540.h - copied unchanged from r230995, head/sys/dev/ixgbe/ixgbe_x540.h projects/pseries/dev/mps/mps_config.c - copied unchanged from r230995, head/sys/dev/mps/mps_config.c projects/pseries/dev/mps/mps_mapping.c - copied unchanged from r230995, head/sys/dev/mps/mps_mapping.c projects/pseries/dev/mps/mps_mapping.h - copied unchanged from r230995, head/sys/dev/mps/mps_mapping.h projects/pseries/dev/mps/mps_sas.h - copied unchanged from r230995, head/sys/dev/mps/mps_sas.h projects/pseries/dev/mps/mps_sas_lsi.c - copied unchanged from r230995, head/sys/dev/mps/mps_sas_lsi.c projects/pseries/dev/sound/pci/cs461x_dsp.h - copied unchanged from r230995, head/sys/dev/sound/pci/cs461x_dsp.h projects/pseries/dev/xen/netback/netback_unit_tests.c - copied unchanged from r230995, head/sys/dev/xen/netback/netback_unit_tests.c projects/pseries/i386/conf/WITHOUT_SOURCELESS - copied unchanged from r230995, head/sys/i386/conf/WITHOUT_SOURCELESS projects/pseries/i386/conf/WITHOUT_SOURCELESS_HOST - copied unchanged from r230995, head/sys/i386/conf/WITHOUT_SOURCELESS_HOST projects/pseries/i386/conf/WITHOUT_SOURCELESS_UCODE - copied unchanged from r230995, head/sys/i386/conf/WITHOUT_SOURCELESS_UCODE projects/pseries/modules/isci/ - copied from r230995, head/sys/modules/isci/ projects/pseries/powerpc/ofw/ofw_pci.c - copied unchanged from r230995, head/sys/powerpc/ofw/ofw_pci.c projects/pseries/powerpc/ofw/ofw_pci.h - copied unchanged from r230995, head/sys/powerpc/ofw/ofw_pci.h Deleted: projects/pseries/gnu/dev/ Modified: projects/pseries/amd64/acpica/acpi_switch.S projects/pseries/amd64/acpica/acpi_wakecode.S projects/pseries/amd64/acpica/acpi_wakeup.c projects/pseries/amd64/amd64/fpu.c projects/pseries/amd64/amd64/minidump_machdep.c projects/pseries/amd64/amd64/uma_machdep.c projects/pseries/amd64/conf/GENERIC projects/pseries/amd64/conf/NOTES projects/pseries/amd64/include/cpufunc.h projects/pseries/amd64/include/signal.h projects/pseries/boot/forth/menu.rc projects/pseries/cam/ata/ata_da.c projects/pseries/cam/ata/ata_xpt.c projects/pseries/cam/cam_ccb.h projects/pseries/cam/cam_periph.c projects/pseries/cam/cam_xpt.c projects/pseries/cam/cam_xpt_internal.h projects/pseries/cam/scsi/scsi_all.c projects/pseries/cam/scsi/scsi_all.h projects/pseries/cam/scsi/scsi_da.c projects/pseries/cam/scsi/scsi_xpt.c projects/pseries/cddl/compat/opensolaris/sys/kmem.h projects/pseries/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c projects/pseries/conf/files projects/pseries/conf/files.amd64 projects/pseries/conf/files.i386 projects/pseries/conf/files.powerpc projects/pseries/conf/options projects/pseries/conf/options.amd64 projects/pseries/conf/options.i386 projects/pseries/dev/ata/chipsets/ata-acerlabs.c projects/pseries/dev/ata/chipsets/ata-siliconimage.c projects/pseries/dev/ath/ath_dfs/null/dfs_null.c projects/pseries/dev/ath/ath_hal/ar5210/ar5210_attach.c projects/pseries/dev/ath/ath_hal/ar5211/ar5211_attach.c projects/pseries/dev/ath/ath_hal/ar5212/ar5212.h projects/pseries/dev/ath/ath_hal/ar5212/ar5212_attach.c projects/pseries/dev/ath/ath_hal/ar5212/ar5212_misc.c projects/pseries/dev/ath/ath_hal/ar5416/ar5416_attach.c projects/pseries/dev/ath/ath_hal/ar9002/ar9280_attach.c projects/pseries/dev/ath/if_ath.c projects/pseries/dev/ath/if_athdfs.h projects/pseries/dev/ciss/ciss.c projects/pseries/dev/e1000/README projects/pseries/dev/fe/if_fe.c projects/pseries/dev/firewire/sbp_targ.c projects/pseries/dev/fxp/if_fxp.c projects/pseries/dev/hwpmc/hwpmc_x86.c projects/pseries/dev/ie/if_ie.c projects/pseries/dev/iwn/if_iwn.c projects/pseries/dev/ixgbe/ixgbe.c projects/pseries/dev/ixgbe/ixgbe.h projects/pseries/dev/ixgbe/ixgbe_82598.c projects/pseries/dev/ixgbe/ixgbe_82599.c projects/pseries/dev/ixgbe/ixgbe_api.c projects/pseries/dev/ixgbe/ixgbe_api.h projects/pseries/dev/ixgbe/ixgbe_common.c projects/pseries/dev/ixgbe/ixgbe_common.h projects/pseries/dev/ixgbe/ixgbe_mbx.c projects/pseries/dev/ixgbe/ixgbe_mbx.h projects/pseries/dev/ixgbe/ixgbe_osdep.h projects/pseries/dev/ixgbe/ixgbe_phy.c projects/pseries/dev/ixgbe/ixgbe_phy.h projects/pseries/dev/ixgbe/ixgbe_type.h projects/pseries/dev/ixgbe/ixgbe_vf.c projects/pseries/dev/ixgbe/ixgbe_vf.h projects/pseries/dev/ixgbe/ixv.c projects/pseries/dev/ixgbe/ixv.h projects/pseries/dev/mps/mpi/mpi2.h projects/pseries/dev/mps/mpi/mpi2_cnfg.h projects/pseries/dev/mps/mpi/mpi2_hbd.h projects/pseries/dev/mps/mpi/mpi2_history.txt projects/pseries/dev/mps/mpi/mpi2_init.h projects/pseries/dev/mps/mpi/mpi2_ioc.h projects/pseries/dev/mps/mpi/mpi2_ra.h projects/pseries/dev/mps/mpi/mpi2_raid.h projects/pseries/dev/mps/mpi/mpi2_sas.h projects/pseries/dev/mps/mpi/mpi2_targ.h projects/pseries/dev/mps/mpi/mpi2_tool.h projects/pseries/dev/mps/mpi/mpi2_type.h projects/pseries/dev/mps/mps.c projects/pseries/dev/mps/mps_ioctl.h projects/pseries/dev/mps/mps_pci.c projects/pseries/dev/mps/mps_sas.c projects/pseries/dev/mps/mps_table.c projects/pseries/dev/mps/mps_user.c projects/pseries/dev/mps/mpsvar.h projects/pseries/dev/mvs/mvs.h projects/pseries/dev/mvs/mvs_soc.c projects/pseries/dev/netmap/ixgbe_netmap.h projects/pseries/dev/netmap/netmap.c projects/pseries/dev/netmap/netmap_kern.h projects/pseries/dev/ofw/openfirm.c projects/pseries/dev/pccbb/pccbb.c projects/pseries/dev/pci/pcireg.h projects/pseries/dev/sound/pci/csa.c projects/pseries/dev/sound/pci/csareg.h projects/pseries/dev/sound/pci/hda/hdaa.c projects/pseries/dev/sound/pci/hda/hdaa.h projects/pseries/dev/sound/pci/hda/hdaa_patches.c projects/pseries/dev/sound/pci/hda/hdac.c projects/pseries/dev/sound/pci/hda/hdac.h projects/pseries/dev/sound/pci/hda/hdacc.c projects/pseries/dev/sound/pcm/buffer.c projects/pseries/dev/sound/pcm/buffer.h projects/pseries/dev/sound/pcm/channel.c projects/pseries/dev/usb/usb_transfer.c projects/pseries/dev/wi/if_wi.c projects/pseries/dev/xen/blkback/blkback.c projects/pseries/dev/xen/netback/netback.c projects/pseries/fs/nfsclient/nfs_clbio.c projects/pseries/fs/nfsclient/nfs_clnode.c projects/pseries/fs/nfsclient/nfs_clport.c projects/pseries/fs/nfsclient/nfs_clvfsops.c projects/pseries/fs/nfsclient/nfs_clvnops.c projects/pseries/fs/nfsclient/nfsmount.h projects/pseries/geom/geom_bsd.c projects/pseries/geom/geom_mbr.c projects/pseries/geom/geom_pc98.c projects/pseries/geom/mountver/g_mountver.c projects/pseries/geom/part/g_part.c projects/pseries/i386/conf/GENERIC projects/pseries/i386/conf/NOTES projects/pseries/i386/i386/initcpu.c projects/pseries/i386/include/signal.h projects/pseries/i386/include/xen/xenpmap.h projects/pseries/i386/include/xen/xenvar.h projects/pseries/kern/imgact_elf.c projects/pseries/kern/kern_kthread.c projects/pseries/kern/kern_proc.c projects/pseries/kern/kern_shutdown.c projects/pseries/kern/subr_log.c projects/pseries/kern/subr_scanf.c projects/pseries/kern/subr_syscall.c projects/pseries/kern/uipc_mbuf.c projects/pseries/kern/uipc_socket.c projects/pseries/kern/vfs_aio.c projects/pseries/kern/vfs_cache.c projects/pseries/kern/vfs_subr.c projects/pseries/kern/vfs_vnops.c projects/pseries/modules/Makefile projects/pseries/modules/drm/Makefile projects/pseries/modules/ixgbe/Makefile projects/pseries/modules/mps/Makefile projects/pseries/modules/sound/driver/Makefile projects/pseries/modules/sound/driver/emu10k1/Makefile projects/pseries/modules/sound/driver/emu10kx/Makefile projects/pseries/modules/sound/driver/maestro3/Makefile projects/pseries/modules/usb/Makefile projects/pseries/net/flowtable.c projects/pseries/net/if_llatbl.c projects/pseries/net80211/ieee80211_dfs.c projects/pseries/net80211/ieee80211_dfs.h projects/pseries/net80211/ieee80211_hwmp.c projects/pseries/net80211/ieee80211_mesh.c projects/pseries/netinet/ip_carp.c projects/pseries/netinet/ipfw/dn_sched_qfq.c projects/pseries/netinet6/in6.h projects/pseries/netinet6/nd6.c projects/pseries/nfsclient/nfs_bio.c projects/pseries/nfsclient/nfs_vfsops.c projects/pseries/nfsclient/nfs_vnops.c projects/pseries/nfsclient/nfsmount.h projects/pseries/nlm/nlm_prot_impl.c projects/pseries/powerpc/aim/mmu_oea64.c projects/pseries/powerpc/booke/machdep.c projects/pseries/powerpc/powermac/cpcht.c projects/pseries/powerpc/powermac/grackle.c projects/pseries/powerpc/powermac/gracklevar.h projects/pseries/powerpc/powermac/uninorthpci.c projects/pseries/powerpc/powermac/uninorthvar.h projects/pseries/powerpc/ps3/ps3_syscons.c projects/pseries/powerpc/pseries/rtas_pci.c projects/pseries/sparc64/include/clock.h projects/pseries/sparc64/include/cpu.h projects/pseries/sparc64/include/ofw_machdep.h projects/pseries/sparc64/include/vmparam.h projects/pseries/sparc64/pci/schizo.c projects/pseries/sparc64/pci/schizovar.h projects/pseries/sparc64/sparc64/cache.c projects/pseries/sparc64/sparc64/clock.c projects/pseries/sparc64/sparc64/machdep.c projects/pseries/sparc64/sparc64/ofw_machdep.c projects/pseries/sparc64/sparc64/pmap.c projects/pseries/sparc64/sparc64/support.S projects/pseries/sys/elf_common.h projects/pseries/sys/malloc.h projects/pseries/sys/mdioctl.h projects/pseries/sys/param.h projects/pseries/sys/proc.h projects/pseries/sys/signal.h projects/pseries/sys/systm.h projects/pseries/sys/types.h projects/pseries/sys/ucontext.h projects/pseries/vm/swap_pager.c projects/pseries/vm/uma.h projects/pseries/vm/uma_core.c projects/pseries/vm/vm_contig.c projects/pseries/vm/vm_kern.c projects/pseries/vm/vm_page.c projects/pseries/vm/vm_page.h projects/pseries/xen/interface/io/netif.h Directory Properties: projects/pseries/ (props changed) projects/pseries/boot/ (props changed) projects/pseries/cddl/contrib/opensolaris/ (props changed) projects/pseries/conf/ (props changed) Modified: projects/pseries/amd64/acpica/acpi_switch.S ============================================================================== --- projects/pseries/amd64/acpica/acpi_switch.S Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/acpica/acpi_switch.S Sat Feb 4 23:27:16 2012 (r231000) @@ -1,7 +1,7 @@ /*- * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org> * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> - * Copyright (c) 2008-2010 Jung-uk Kim <jkim@FreeBSD.org> + * Copyright (c) 2008-2012 Jung-uk Kim <jkim@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -95,7 +95,6 @@ ENTRY(acpi_restorecpu) /* Restore CR0 except for FPU mode. */ movq PCB_CR0(%rdi), %rax - movq %rax, %rcx andq $~(CR0_EM | CR0_TS), %rax movq %rax, %cr0 @@ -121,15 +120,6 @@ ENTRY(acpi_restorecpu) #undef SDT_SYSTSS #undef SDT_SYSBSY - /* Restore other callee saved registers. */ - movq PCB_R15(%rdi), %r15 - movq PCB_R14(%rdi), %r14 - movq PCB_R13(%rdi), %r13 - movq PCB_R12(%rdi), %r12 - movq PCB_RBP(%rdi), %rbp - movq PCB_RSP(%rdi), %rsp - movq PCB_RBX(%rdi), %rbx - /* Restore debug registers. */ movq PCB_DR0(%rdi), %rax movq %rax, %dr0 @@ -146,21 +136,34 @@ ENTRY(acpi_restorecpu) /* Restore FPU state. */ fninit - movq WAKEUP_CTX(fpusave),%rdi - cmpl $0,use_xsave - jne 1f - fxrstor (%rdi) + movq WAKEUP_CTX(fpusave), %rbx + movq WAKEUP_CTX(xsmask), %rax + testq %rax, %rax + jz 1f + movq %rax, %rdx + shrq $32, %rdx + movl $XCR0, %ecx +/* xsetbv */ + .byte 0x0f, 0x01, 0xd1 +/* xrstor (%rbx) */ + .byte 0x0f, 0xae, 0x2b jmp 2f -1: movl xsave_mask,%eax - movl xsave_mask+4,%edx -/* xrstor (%rdi) */ - .byte 0x0f,0xae,0x2f +1: + fxrstor (%rbx) 2: /* Reload CR0. */ - movq %rcx, %cr0 + movq PCB_CR0(%rdi), %rax + movq %rax, %cr0 - movq WAKEUP_CTX(pcb),%rdi + /* Restore other callee saved registers. */ + movq PCB_R15(%rdi), %r15 + movq PCB_R14(%rdi), %r14 + movq PCB_R13(%rdi), %r13 + movq PCB_R12(%rdi), %r12 + movq PCB_RBP(%rdi), %rbp + movq PCB_RSP(%rdi), %rsp + movq PCB_RBX(%rdi), %rbx /* Restore return address. */ movq PCB_RIP(%rdi), %rax Modified: projects/pseries/amd64/acpica/acpi_wakecode.S ============================================================================== --- projects/pseries/amd64/acpica/acpi_wakecode.S Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/acpica/acpi_wakecode.S Sat Feb 4 23:27:16 2012 (r231000) @@ -2,7 +2,7 @@ * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org> * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2008-2010 Jung-uk Kim <jkim@FreeBSD.org> + * Copyright (c) 2008-2012 Jung-uk Kim <jkim@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -267,11 +267,11 @@ wakeup_ctx: .quad 0 wakeup_pcb: .quad 0 +wakeup_fpusave: + .quad 0 wakeup_gdt: .word 0 .quad 0 -wakeup_fpusave: - .quad 0 ALIGN_DATA wakeup_efer: @@ -284,6 +284,8 @@ wakeup_cstar: .quad 0 wakeup_sfmask: .quad 0 +wakeup_xsmask: + .quad 0 wakeup_cpu: .long 0 dummy: Modified: projects/pseries/amd64/acpica/acpi_wakeup.c ============================================================================== --- projects/pseries/amd64/acpica/acpi_wakeup.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/acpica/acpi_wakeup.c Sat Feb 4 23:27:16 2012 (r231000) @@ -2,7 +2,7 @@ * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org> * Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> * Copyright (c) 2003 Peter Wemm - * Copyright (c) 2008-2010 Jung-uk Kim <jkim@FreeBSD.org> + * Copyright (c) 2008-2012 Jung-uk Kim <jkim@FreeBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -74,7 +74,7 @@ static struct pcb **susppcbs; static void **suspfpusave; #endif -int acpi_restorecpu(vm_offset_t, struct pcb *); +int acpi_restorecpu(uint64_t, vm_offset_t); static void *acpi_alloc_wakeup_handler(void); static void acpi_stop_beep(void *); @@ -386,6 +386,7 @@ acpi_install_wakeup_handler(struct acpi_ WAKECODE_FIXUP(wakeup_lstar, uint64_t, rdmsr(MSR_LSTAR)); WAKECODE_FIXUP(wakeup_cstar, uint64_t, rdmsr(MSR_CSTAR)); WAKECODE_FIXUP(wakeup_sfmask, uint64_t, rdmsr(MSR_SF_MASK)); + WAKECODE_FIXUP(wakeup_xsmask, uint64_t, xsave_mask); /* Build temporary page tables below realmode code. */ pt4 = wakeaddr; Modified: projects/pseries/amd64/amd64/fpu.c ============================================================================== --- projects/pseries/amd64/amd64/fpu.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/amd64/fpu.c Sat Feb 4 23:27:16 2012 (r231000) @@ -78,6 +78,41 @@ __FBSDID("$FreeBSD$"); : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm __volatile("clts") +static __inline void +xrstor(char *addr, uint64_t mask) +{ + uint32_t low, hi; + + low = mask; + hi = mask >> 32; + /* xrstor (%rdi) */ + __asm __volatile(".byte 0x0f,0xae,0x2f" : : + "a" (low), "d" (hi), "D" (addr)); +} + +static __inline void +xsave(char *addr, uint64_t mask) +{ + uint32_t low, hi; + + low = mask; + hi = mask >> 32; + /* xsave (%rdi) */ + __asm __volatile(".byte 0x0f,0xae,0x27" : : + "a" (low), "d" (hi), "D" (addr) : "memory"); +} + +static __inline void +xsetbv(uint32_t reg, uint64_t val) +{ + uint32_t low, hi; + + low = val; + hi = val >> 32; + __asm __volatile(".byte 0x0f,0x01,0xd1" : : + "c" (reg), "a" (low), "d" (hi)); +} + #else /* !(__GNUCLIKE_ASM && !lint) */ void fldcw(u_short cw); @@ -90,6 +125,9 @@ void fxrstor(caddr_t addr); void ldmxcsr(u_int csr); void start_emulating(void); void stop_emulating(void); +void xrstor(char *addr, uint64_t mask); +void xsave(char *addr, uint64_t mask); +void xsetbv(uint32_t reg, uint64_t val); #endif /* __GNUCLIKE_ASM && !lint */ Modified: projects/pseries/amd64/amd64/minidump_machdep.c ============================================================================== --- projects/pseries/amd64/amd64/minidump_machdep.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/amd64/minidump_machdep.c Sat Feb 4 23:27:16 2012 (r231000) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include <sys/watchdog.h> #endif #include <vm/vm.h> +#include <vm/vm_page.h> #include <vm/pmap.h> #include <machine/atomic.h> #include <machine/elf.h> @@ -75,8 +76,11 @@ CTASSERT(sizeof(*vm_page_dump) == 8); static int is_dumpable(vm_paddr_t pa) { + vm_page_t m; int i; + if ((m = vm_phys_paddr_to_vm_page(pa)) != NULL) + return ((m->flags & PG_NODUMP) == 0); for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { if (pa >= dump_avail[i] && pa < dump_avail[i + 1]) return (1); Modified: projects/pseries/amd64/amd64/uma_machdep.c ============================================================================== --- projects/pseries/amd64/amd64/uma_machdep.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/amd64/uma_machdep.c Sat Feb 4 23:27:16 2012 (r231000) @@ -65,7 +65,8 @@ uma_small_alloc(uma_zone_t zone, int byt break; } pa = m->phys_addr; - dump_add_page(pa); + if ((wait & M_NODUMP) == 0) + dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) pagezero(va); Modified: projects/pseries/amd64/conf/GENERIC ============================================================================== --- projects/pseries/amd64/conf/GENERIC Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/conf/GENERIC Sat Feb 4 23:27:16 2012 (r231000) @@ -123,6 +123,7 @@ device adv # Advansys SCSI adapters device adw # Advansys wide SCSI adapters device aic # Adaptec 15[012]x SCSI adapters, AIC-6[23]60. device bt # Buslogic/Mylex MultiMaster SCSI adapters +device isci # Intel C600 SAS controller # ATA/SCSI peripherals device scbus # SCSI bus (required for ATA/SCSI) Modified: projects/pseries/amd64/conf/NOTES ============================================================================== --- projects/pseries/amd64/conf/NOTES Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/conf/NOTES Sat Feb 4 23:27:16 2012 (r231000) @@ -409,6 +409,11 @@ device hptiop device ips # +# Intel C600 (Patsburg) integrated SAS controller +device isci +options ISCI_LOGGING # enable debugging in isci HAL + +# # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # Copied: projects/pseries/amd64/conf/WITHOUT_SOURCELESS (from r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/pseries/amd64/conf/WITHOUT_SOURCELESS Sat Feb 4 23:27:16 2012 (r231000, copy of r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS) @@ -0,0 +1,7 @@ +# +# WITHOUT_SOURCELESS -- Disable drivers that include sourceless code. +# +# $FreeBSD$ + +include WITHOUT_SOURCELESS_HOST +include WITHOUT_SOURCELESS_UCODE Copied: projects/pseries/amd64/conf/WITHOUT_SOURCELESS_HOST (from r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS_HOST) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/pseries/amd64/conf/WITHOUT_SOURCELESS_HOST Sat Feb 4 23:27:16 2012 (r231000, copy of r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS_HOST) @@ -0,0 +1,10 @@ +# +# WITHOUT_SOURCELESS_UCODE -- Disable drivers that include sourceless +# native code for host CPU. +# +# $FreeBSD$ + +nodevice hpt27xx +nodevice hptmv +nodevice hptrr +nodevice nve Copied: projects/pseries/amd64/conf/WITHOUT_SOURCELESS_UCODE (from r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS_UCODE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/pseries/amd64/conf/WITHOUT_SOURCELESS_UCODE Sat Feb 4 23:27:16 2012 (r231000, copy of r230995, head/sys/amd64/conf/WITHOUT_SOURCELESS_UCODE) @@ -0,0 +1,41 @@ +# +# WITHOUT_SOURCELESS_UCODE -- Disable drivers that include sourceless +# microcode. +# +# $FreeBSD$ + +nodevice adw +nodevice bce +nodevice fatm +nodevice fxp +nodevice ispfw +nodevice mwlfw +nodevice ralfw +nodevice runfw +nodevice sf +nodevice sn +nodevice ti +nodevice txp +nodevice ce +nodevice cp +nodevice ctau +nodevice ipwfw +nodevice iwifw +nodevice iwnfw +nodevice wpifw + +# drm +nodevice mga +nodevice r128 +nodevice radeon + +# sound +nodevice csa +nodevice ds1 +nodevice maestro3 + +# usb +nodevice rum +nodevice uath +nodevice zyd +nodevice kue Modified: projects/pseries/amd64/include/cpufunc.h ============================================================================== --- projects/pseries/amd64/include/cpufunc.h Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/include/cpufunc.h Sat Feb 4 23:27:16 2012 (r231000) @@ -669,41 +669,6 @@ intr_restore(register_t rflags) write_rflags(rflags); } -static __inline void -xsetbv(uint32_t reg, uint64_t val) -{ - uint32_t low, hi; - - low = val; - hi = val >> 32; - __asm __volatile(".byte 0x0f,0x01,0xd1" : : - "c" (reg), "a" (low), "d" (hi)); -} - -static __inline void -xsave(char *addr, uint64_t mask) -{ - uint32_t low, hi; - - low = mask; - hi = mask >> 32; - /* xsave (%rdi) */ - __asm __volatile(".byte 0x0f,0xae,0x27" : : - "a" (low), "d" (hi), "D" (addr) : "memory"); -} - -static __inline void -xrstor(char *addr, uint64_t mask) -{ - uint32_t low, hi; - - low = mask; - hi = mask >> 32; - /* xrstor (%rdi) */ - __asm __volatile(".byte 0x0f,0xae,0x2f" : : - "a" (low), "d" (hi), "D" (addr)); -} - #else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ int breakpoint(void); @@ -768,9 +733,6 @@ u_int rgs(void); void wbinvd(void); void write_rflags(u_int rf); void wrmsr(u_int msr, uint64_t newval); -void xsetbv(uint32_t reg, uint64_t val); -void xsave(char *addr, uint64_t mask); -void xrstor(char *addr, uint64_t mask); #endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ Modified: projects/pseries/amd64/include/signal.h ============================================================================== --- projects/pseries/amd64/include/signal.h Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/amd64/include/signal.h Sat Feb 4 23:27:16 2012 (r231000) @@ -99,7 +99,10 @@ struct sigcontext { long sc_fsbase; long sc_gsbase; - long sc_spare[6]; + long sc_xfpustate; + long sc_xfpustate_len; + + long sc_spare[4]; }; #endif /* __BSD_VISIBLE */ Modified: projects/pseries/boot/forth/menu.rc ============================================================================== --- projects/pseries/boot/forth/menu.rc Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/boot/forth/menu.rc Sat Feb 4 23:27:16 2012 (r231000) @@ -18,9 +18,9 @@ menu-init \ initialize the menu area \ Initialize main menu constructs (see `menu.4th') \ NOTE: To use the `ansi' variants, add `loader_color=1' to loader.conf(5) -set menu_caption[1]="Boot [ENTER]" +set menu_caption[1]="Boot [Enter]" set menu_command[1]="boot" -set ansi_caption[1]="[1mB[37moot [1m[ENTER][37m" +set ansi_caption[1]="[1mB[37moot [1m[Enter][37m" set menu_keycode[1]="98" set menu_caption[2]="[Esc]ape to loader prompt" @@ -38,34 +38,34 @@ set menu_reboot \ set menu_options=4 -set menu_caption[4]="[A]CPI Support: Disabled" -set toggled_text[4]="[A]CPI Support: Enabled" +set menu_caption[4]="[A]CPI Support off" +set toggled_text[4]="[A]CPI Support On" set menu_command[4]="toggle_acpi" set menu_keycode[4]="97" set menu_acpi=4 -set ansi_caption[4]="[1mA[37mCPI Support: [34;1mDisabled[37m" -set toggled_ansi[4]="[1mA[37mCPI Support: [32mEnabled[37m" +set ansi_caption[4]="[1mA[37mCPI Support [34;1mOff[37m" +set toggled_ansi[4]="[1mA[37mCPI Support [32;7mOn[0;37m" -set menu_caption[5]="Boot Safe [M]ode: NO" -set toggled_text[5]="Boot Safe [M]ode: YES" +set menu_caption[5]="Safe [M]ode... off" +set toggled_text[5]="Safe [M]ode... On" set menu_command[5]="toggle_safemode" set menu_keycode[5]="109" -set ansi_caption[5]="Boot Safe [1mM[37mode: [34;1mNO[37m" -set toggled_ansi[5]="Boot Safe [1mM[37mode: [32mYES[37m" +set ansi_caption[5]="Safe [1mM[37mode... [34;1mOff[37m" +set toggled_ansi[5]="Safe [1mM[37mode... [32;7mOn[0;37m" -set menu_caption[6]="Boot [S]ingle User: NO" -set toggled_text[6]="Boot [S]ingle User: YES" +set menu_caption[6]="[S]ingle User. off" +set toggled_text[6]="[S]ingle User. On" set menu_command[6]="toggle_singleuser" set menu_keycode[6]="115" -set ansi_caption[6]="Boot [1mS[37mingle User: [34;1mNO[37m" -set toggled_ansi[6]="Boot [1mS[37mingle User: [32mYES[37m" +set ansi_caption[6]="[1mS[37mingle User. [34;1mOff[37m" +set toggled_ansi[6]="[1mS[37mingle User. [32;7mOn[0;37m" -set menu_caption[7]="Boot [V]erbose: NO" -set toggled_text[7]="Boot [V]erbose: YES" +set menu_caption[7]="[V]erbose..... off" +set toggled_text[7]="[V]erbose..... On" set menu_command[7]="toggle_verbose" set menu_keycode[7]="118" -set ansi_caption[7]="Boot [1mV[37merbose: [34;1mNO[37m" -set toggled_ansi[7]="Boot [1mV[37merbose: [32mYES[37m" +set ansi_caption[7]="[1mV[37merbose..... [34;1mOff[37m" +set toggled_ansi[7]="[1mV[37merbose..... [32;7mOn[0;37m" \ Enable automatic booting (add ``autoboot_delay=N'' to loader.conf(5) to \ customize the timeout; default is 10-seconds) Modified: projects/pseries/cam/ata/ata_da.c ============================================================================== --- projects/pseries/cam/ata/ata_da.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/ata/ata_da.c Sat Feb 4 23:27:16 2012 (r231000) @@ -1098,7 +1098,7 @@ adaregister(struct cam_periph *periph, v */ callout_init_mtx(&softc->sendordered_c, periph->sim->mtx, 0); callout_reset(&softc->sendordered_c, - (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL, + (ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); if (ADA_RA >= 0 && @@ -1653,7 +1653,7 @@ adasendorderedtag(void *arg) } /* Queue us up again */ callout_reset(&softc->sendordered_c, - (ADA_DEFAULT_TIMEOUT * hz) / ADA_ORDEREDTAG_INTERVAL, + (ada_default_timeout * hz) / ADA_ORDEREDTAG_INTERVAL, adasendorderedtag, softc); } Modified: projects/pseries/cam/ata/ata_xpt.c ============================================================================== --- projects/pseries/cam/ata/ata_xpt.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/ata/ata_xpt.c Sat Feb 4 23:27:16 2012 (r231000) @@ -186,6 +186,12 @@ static void ata_dev_async(u_int32_t asy static void ata_action(union ccb *start_ccb); static void ata_announce_periph(struct cam_periph *periph); +static int ata_dma = 1; +static int atapi_dma = 1; + +TUNABLE_INT("hw.ata.ata_dma", &ata_dma); +TUNABLE_INT("hw.ata.atapi_dma", &atapi_dma); + static struct xpt_xport ata_xport = { .alloc_device = ata_alloc_device, .action = ata_action, @@ -356,6 +362,13 @@ probestart(struct cam_periph *periph, un if (cts.xport_specific.sata.valid & CTS_SATA_VALID_MODE) mode = cts.xport_specific.sata.mode; } + if (periph->path->device->protocol == PROTO_ATA) { + if (ata_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX)) + mode = ATA_PIO_MAX; + } else { + if (atapi_dma == 0 && (mode == 0 || mode > ATA_PIO_MAX)) + mode = ATA_PIO_MAX; + } negotiate: /* Honor device capabilities. */ wantmode = mode = ata_max_mode(ident_buf, mode); Modified: projects/pseries/cam/cam_ccb.h ============================================================================== --- projects/pseries/cam/cam_ccb.h Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/cam_ccb.h Sat Feb 4 23:27:16 2012 (r231000) @@ -1118,6 +1118,7 @@ struct ccb_dev_advinfo { #define CDAI_TYPE_SCSI_DEVID 1 #define CDAI_TYPE_SERIAL_NUM 2 #define CDAI_TYPE_PHYS_PATH 3 +#define CDAI_TYPE_RCAPLONG 4 off_t bufsiz; /* IN: Size of external buffer */ #define CAM_SCSI_DEVID_MAXLEN 65536 /* length in buffer is an uint16_t */ off_t provsiz; /* OUT: Size required/used */ Modified: projects/pseries/cam/cam_periph.c ============================================================================== --- projects/pseries/cam/cam_periph.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/cam_periph.c Sat Feb 4 23:27:16 2012 (r231000) @@ -1864,13 +1864,26 @@ cam_periph_error(union ccb *ccb, cam_fla case CAM_DEV_NOT_THERE: { struct cam_path *newpath; + lun_id_t lun_id; error = ENXIO; + + /* + * For a selection timeout, we consider all of the LUNs on + * the target to be gone. If the status is CAM_DEV_NOT_THERE, + * then we only get rid of the device(s) specified by the + * path in the original CCB. + */ + if (status == CAM_DEV_NOT_THERE) + lun_id = xpt_path_lun_id(ccb->ccb_h.path); + else + lun_id = CAM_LUN_WILDCARD; + /* Should we do more if we can't create the path?? */ if (xpt_create_path(&newpath, periph, xpt_path_path_id(ccb->ccb_h.path), xpt_path_target_id(ccb->ccb_h.path), - CAM_LUN_WILDCARD) != CAM_REQ_CMP) + lun_id) != CAM_REQ_CMP) break; /* Modified: projects/pseries/cam/cam_xpt.c ============================================================================== --- projects/pseries/cam/cam_xpt.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/cam_xpt.c Sat Feb 4 23:27:16 2012 (r231000) @@ -4588,6 +4588,17 @@ xpt_release_device(struct cam_ed *device cam_devq_resize(devq, devq->alloc_queue.array_size - 1); camq_fini(&device->drvq); cam_ccbq_fini(&device->ccbq); + /* + * Free allocated memory. free(9) does nothing if the + * supplied pointer is NULL, so it is safe to call without + * checking. + */ + free(device->supported_vpds, M_CAMXPT); + free(device->device_id, M_CAMXPT); + free(device->physpath, M_CAMXPT); + free(device->rcap_buf, M_CAMXPT); + free(device->serial_num, M_CAMXPT); + xpt_release_target(device->target); free(device, M_CAMXPT); } else Modified: projects/pseries/cam/cam_xpt_internal.h ============================================================================== --- projects/pseries/cam/cam_xpt_internal.h Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/cam_xpt_internal.h Sat Feb 4 23:27:16 2012 (r231000) @@ -99,6 +99,8 @@ struct cam_ed { uint8_t *device_id; uint8_t physpath_len; uint8_t *physpath; /* physical path string form */ + uint32_t rcap_len; + uint8_t *rcap_buf; struct ata_params ident_data; u_int8_t inq_flags; /* * Current settings for inquiry flags. Modified: projects/pseries/cam/scsi/scsi_all.c ============================================================================== --- projects/pseries/cam/scsi/scsi_all.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/scsi/scsi_all.c Sat Feb 4 23:27:16 2012 (r231000) @@ -5325,8 +5325,8 @@ void scsi_read_capacity_16(struct ccb_scsiio *csio, uint32_t retries, void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, uint64_t lba, int reladr, int pmi, - struct scsi_read_capacity_data_long *rcap_buf, - uint8_t sense_len, uint32_t timeout) + uint8_t *rcap_buf, int rcap_buf_len, uint8_t sense_len, + uint32_t timeout) { struct scsi_read_capacity_16 *scsi_cmd; @@ -5337,7 +5337,7 @@ scsi_read_capacity_16(struct ccb_scsiio /*flags*/CAM_DIR_IN, tag_action, /*data_ptr*/(u_int8_t *)rcap_buf, - /*dxfer_len*/sizeof(*rcap_buf), + /*dxfer_len*/rcap_buf_len, sense_len, sizeof(*scsi_cmd), timeout); @@ -5346,7 +5346,7 @@ scsi_read_capacity_16(struct ccb_scsiio scsi_cmd->opcode = SERVICE_ACTION_IN; scsi_cmd->service_action = SRC16_SERVICE_ACTION; scsi_u64to8b(lba, scsi_cmd->addr); - scsi_ulto4b(sizeof(*rcap_buf), scsi_cmd->alloc_len); + scsi_ulto4b(rcap_buf_len, scsi_cmd->alloc_len); if (pmi) reladr |= SRC16_PMI; if (reladr) Modified: projects/pseries/cam/scsi/scsi_all.h ============================================================================== --- projects/pseries/cam/scsi/scsi_all.h Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/scsi/scsi_all.h Sat Feb 4 23:27:16 2012 (r231000) @@ -1437,15 +1437,26 @@ struct scsi_read_capacity_data_long uint8_t length[4]; #define SRC16_PROT_EN 0x01 #define SRC16_P_TYPE 0x0e +#define SRC16_PTYPE_1 0x00 +#define SRC16_PTYPE_2 0x02 +#define SRC16_PTYPE_3 0x04 uint8_t prot; #define SRC16_LBPPBE 0x0f #define SRC16_PI_EXPONENT 0xf0 #define SRC16_PI_EXPONENT_SHIFT 4 uint8_t prot_lbppbe; -#define SRC16_LALBA 0x3fff -#define SRC16_LBPRZ 0x4000 -#define SRC16_LBPME 0x8000 +#define SRC16_LALBA 0x3f +#define SRC16_LBPRZ 0x40 +#define SRC16_LBPME 0x80 +/* + * Alternate versions of these macros that are intended for use on a 16-bit + * version of the lalba_lbp field instead of the array of 2 8 bit numbers. + */ +#define SRC16_LALBA_A 0x3fff +#define SRC16_LBPRZ_A 0x4000 +#define SRC16_LBPME_A 0x8000 uint8_t lalba_lbp[2]; + uint8_t reserved[16]; }; struct scsi_report_luns @@ -2293,9 +2304,8 @@ void scsi_read_capacity_16(struct ccb_s void (*cbfcnp)(struct cam_periph *, union ccb *), uint8_t tag_action, uint64_t lba, int reladr, int pmi, - struct scsi_read_capacity_data_long - *rcap_buf, uint8_t sense_len, - uint32_t timeout); + uint8_t *rcap_buf, int rcap_buf_len, + uint8_t sense_len, uint32_t timeout); void scsi_report_luns(struct ccb_scsiio *csio, u_int32_t retries, void (*cbfcnp)(struct cam_periph *, Modified: projects/pseries/cam/scsi/scsi_da.c ============================================================================== --- projects/pseries/cam/scsi/scsi_da.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/scsi/scsi_da.c Sat Feb 4 23:27:16 2012 (r231000) @@ -160,6 +160,7 @@ struct da_softc { struct callout sendordered_c; uint64_t wwpn; uint8_t unmap_buf[UNMAP_MAX_RANGES * 16 + 8]; + struct scsi_read_capacity_data_long rcaplong; }; struct da_quirk_entry { @@ -830,7 +831,9 @@ static int daerror(union ccb *ccb, u_i static void daprevent(struct cam_periph *periph, int action); static int dagetcapacity(struct cam_periph *periph); static void dasetgeom(struct cam_periph *periph, uint32_t block_len, - uint64_t maxsector, u_int lbppbe, u_int lalba); + uint64_t maxsector, + struct scsi_read_capacity_data_long *rcaplong, + size_t rcap_size); static timeout_t dasendorderedtag; static void dashutdown(void *arg, int howto); @@ -1146,7 +1149,7 @@ dadump(void *arg, void *virtual, vm_offs /*data_ptr*/(u_int8_t *) virtual, /*dxfer_len*/length, /*sense_len*/SSD_FULL_SIZE, - DA_DEFAULT_TIMEOUT * 1000); + da_default_timeout * 1000); xpt_polled_action((union ccb *)&csio); cam_periph_unlock(periph); @@ -1594,7 +1597,7 @@ daregister(struct cam_periph *periph, vo */ callout_init_mtx(&softc->sendordered_c, periph->sim->mtx, 0); callout_reset(&softc->sendordered_c, - (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL, + (da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, dasendorderedtag, softc); mtx_unlock(periph->sim->mtx); @@ -1948,7 +1951,8 @@ out: /*lba*/ 0, /*reladr*/ 0, /*pmi*/ 0, - rcaplong, + /*rcap_buf*/ (uint8_t *)rcaplong, + /*rcap_buf_len*/ sizeof(*rcaplong), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 60000); start_ccb->ccb_h.ccb_bp = NULL; @@ -2227,10 +2231,15 @@ dadone(struct cam_periph *periph, union announce_buf[0] = '\0'; cam_periph_invalidate(periph); } else { + /* + * We pass rcaplong into dasetgeom(), + * because it will only use it if it is + * non-NULL. + */ dasetgeom(periph, block_size, maxsector, - lbppbe, lalba & SRC16_LALBA); - if ((lalba & SRC16_LBPME) && - softc->delete_method == DA_DELETE_NONE) + rcaplong, sizeof(*rcaplong)); + if ((lalba & SRC16_LBPME_A) + && softc->delete_method == DA_DELETE_NONE) softc->delete_method = DA_DELETE_UNMAP; dp = &softc->params; snprintf(announce_buf, sizeof(announce_buf), @@ -2504,6 +2513,7 @@ dagetcapacity(struct cam_periph *periph) lalba = 0; error = 0; rc16failed = 0; + rcaplong = NULL; sense_flags = SF_RETRY_UA; if (softc->flags & DA_FLAG_PACK_REMOVABLE) sense_flags |= SF_NO_PRINT; @@ -2521,39 +2531,47 @@ dagetcapacity(struct cam_periph *periph) /* Try READ CAPACITY(16) first if we think it should work. */ if (softc->flags & DA_FLAG_CAN_RC16) { scsi_read_capacity_16(&ccb->csio, - /*retries*/ 4, - /*cbfcnp*/ dadone, - /*tag_action*/ MSG_SIMPLE_Q_TAG, - /*lba*/ 0, - /*reladr*/ 0, - /*pmi*/ 0, - rcaplong, - /*sense_len*/ SSD_FULL_SIZE, - /*timeout*/ 60000); + /*retries*/ 4, + /*cbfcnp*/ dadone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*lba*/ 0, + /*reladr*/ 0, + /*pmi*/ 0, + /*rcap_buf*/ (uint8_t *)rcaplong, + /*rcap_buf_len*/ sizeof(*rcaplong), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 60000); ccb->ccb_h.ccb_bp = NULL; error = cam_periph_runccb(ccb, daerror, - /*cam_flags*/CAM_RETRY_SELTO, - sense_flags, - softc->disk->d_devstat); + /*cam_flags*/CAM_RETRY_SELTO, + sense_flags, softc->disk->d_devstat); if (error == 0) goto rc16ok; /* If we got ILLEGAL REQUEST, do not prefer RC16 any more. */ - if ((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_REQ_INVALID) { + if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INVALID) { softc->flags &= ~DA_FLAG_CAN_RC16; } else if (((ccb->ccb_h.status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) && - (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) && - (ccb->ccb_h.status & CAM_AUTOSNS_VALID) && - ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) && - ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { + CAM_SCSI_STATUS_ERROR) + && (ccb->csio.scsi_status == SCSI_STATUS_CHECK_COND) + && (ccb->ccb_h.status & CAM_AUTOSNS_VALID) + && ((ccb->ccb_h.flags & CAM_SENSE_PHYS) == 0) + && ((ccb->ccb_h.flags & CAM_SENSE_PTR) == 0)) { int sense_key, error_code, asc, ascq; - scsi_extract_sense(&ccb->csio.sense_data, - &error_code, &sense_key, &asc, &ascq); - if (sense_key == SSD_KEY_ILLEGAL_REQUEST) + scsi_extract_sense_len(&ccb->csio.sense_data, + ccb->csio.sense_len - + ccb->csio.sense_resid, + &error_code, &sense_key, + &asc, &ascq, /*show_errors*/1); + /* + * If we don't have enough sense to get the sense + * key, or if it's illegal request, turn off + * READ CAPACITY (16). + */ + if ((sense_key == -1) + || (sense_key == SSD_KEY_ILLEGAL_REQUEST)) softc->flags &= ~DA_FLAG_CAN_RC16; } rc16failed = 1; @@ -2590,7 +2608,8 @@ dagetcapacity(struct cam_periph *periph) /*lba*/ 0, /*reladr*/ 0, /*pmi*/ 0, - rcaplong, + /*rcap_buf*/ (uint8_t *)rcaplong, + /*rcap_buf_len*/ sizeof(*rcaplong), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 60000); ccb->ccb_h.ccb_bp = NULL; @@ -2617,9 +2636,9 @@ done: error = EINVAL; } else { dasetgeom(periph, block_len, maxsector, - lbppbe, lalba & SRC16_LALBA); - if ((lalba & SRC16_LBPME) && - softc->delete_method == DA_DELETE_NONE) + rcaplong, sizeof(*rcaplong)); + if ((lalba & SRC16_LBPME) + && softc->delete_method == DA_DELETE_NONE) softc->delete_method = DA_DELETE_UNMAP; } } @@ -2633,17 +2652,27 @@ done: static void dasetgeom(struct cam_periph *periph, uint32_t block_len, uint64_t maxsector, - u_int lbppbe, u_int lalba) + struct scsi_read_capacity_data_long *rcaplong, size_t rcap_len) { struct ccb_calc_geometry ccg; struct da_softc *softc; struct disk_params *dp; + u_int lbppbe, lalba; softc = (struct da_softc *)periph->softc; dp = &softc->params; dp->secsize = block_len; dp->sectors = maxsector + 1; + if (rcaplong != NULL) { + lbppbe = rcaplong->prot_lbppbe & SRC16_LBPPBE; + lalba = scsi_2btoul(rcaplong->lalba_lbp); + lalba &= SRC16_LALBA_A; + } else { + lbppbe = 0; + lalba = 0; + } + if (lbppbe > 0) { dp->stripesize = block_len << lbppbe; dp->stripeoffset = (dp->stripesize - block_len * lalba) % @@ -2688,6 +2717,38 @@ dasetgeom(struct cam_periph *periph, uin dp->secs_per_track = ccg.secs_per_track; dp->cylinders = ccg.cylinders; } + + /* + * If the user supplied a read capacity buffer, and if it is + * different than the previous buffer, update the data in the EDT. + * If it's the same, we don't bother. This avoids sending an + * update every time someone opens this device. + */ + if ((rcaplong != NULL) + && (bcmp(rcaplong, &softc->rcaplong, + min(sizeof(softc->rcaplong), rcap_len)) != 0)) { + struct ccb_dev_advinfo cdai; + + xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cdai.ccb_h.func_code = XPT_DEV_ADVINFO; + cdai.buftype = CDAI_TYPE_RCAPLONG; + cdai.flags |= CDAI_FLAG_STORE; + cdai.bufsiz = rcap_len; + cdai.buf = (uint8_t *)rcaplong; + xpt_action((union ccb *)&cdai); + if ((cdai.ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(cdai.ccb_h.path, 0, 0, 0, FALSE); + if (cdai.ccb_h.status != CAM_REQ_CMP) { + xpt_print(periph->path, "%s: failed to set read " + "capacity advinfo\n", __func__); + /* Use cam_error_print() to decode the status */ + cam_error_print((union ccb *)&cdai, CAM_ESF_CAM_STATUS, + CAM_EPF_ALL); + } else { + bcopy(rcaplong, &softc->rcaplong, + min(sizeof(softc->rcaplong), rcap_len)); + } + } } static void @@ -2707,7 +2768,7 @@ dasendorderedtag(void *arg) } /* Queue us up again */ callout_reset(&softc->sendordered_c, - (DA_DEFAULT_TIMEOUT * hz) / DA_ORDEREDTAG_INTERVAL, + (da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL, dasendorderedtag, softc); } Modified: projects/pseries/cam/scsi/scsi_xpt.c ============================================================================== --- projects/pseries/cam/scsi/scsi_xpt.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cam/scsi/scsi_xpt.c Sat Feb 4 23:27:16 2012 (r231000) @@ -2468,8 +2468,10 @@ scsi_dev_advinfo(union ccb *start_ccb) break; case CDAI_TYPE_PHYS_PATH: if (cdai->flags & CDAI_FLAG_STORE) { - if (device->physpath != NULL) + if (device->physpath != NULL) { free(device->physpath, M_CAMXPT); + device->physpath = NULL; + } device->physpath_len = cdai->bufsiz; /* Clear existing buffer if zero length */ if (cdai->bufsiz == 0) @@ -2490,6 +2492,36 @@ scsi_dev_advinfo(union ccb *start_ccb) memcpy(cdai->buf, device->physpath, amt); } break; + case CDAI_TYPE_RCAPLONG: + if (cdai->flags & CDAI_FLAG_STORE) { + if (device->rcap_buf != NULL) { + free(device->rcap_buf, M_CAMXPT); + device->rcap_buf = NULL; + } + + device->rcap_len = cdai->bufsiz; + /* Clear existing buffer if zero length */ + if (cdai->bufsiz == 0) + break; + + device->rcap_buf = malloc(cdai->bufsiz, M_CAMXPT, + M_NOWAIT); + if (device->rcap_buf == NULL) { + start_ccb->ccb_h.status = CAM_REQ_ABORTED; + return; + } + + memcpy(device->rcap_buf, cdai->buf, cdai->bufsiz); + } else { + cdai->provsiz = device->rcap_len; + if (device->rcap_len == 0) + break; + amt = device->rcap_len; + if (cdai->provsiz > cdai->bufsiz) + amt = cdai->bufsiz; + memcpy(cdai->buf, device->rcap_buf, amt); + } + break; default: return; } Modified: projects/pseries/cddl/compat/opensolaris/sys/kmem.h ============================================================================== --- projects/pseries/cddl/compat/opensolaris/sys/kmem.h Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cddl/compat/opensolaris/sys/kmem.h Sat Feb 4 23:27:16 2012 (r231000) @@ -45,7 +45,9 @@ MALLOC_DECLARE(M_SOLARIS); #define KM_SLEEP M_WAITOK #define KM_PUSHPAGE M_WAITOK #define KM_NOSLEEP M_NOWAIT -#define KMC_NODEBUG 0 +#define KM_ZERO M_ZERO +#define KM_NODEBUG M_NODUMP +#define KMC_NODEBUG UMA_ZONE_NODUMP #define KMC_NOTOUCH 0 typedef struct kmem_cache { Modified: projects/pseries/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c ============================================================================== --- projects/pseries/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Feb 4 23:25:18 2012 (r230999) +++ projects/pseries/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c Sat Feb 4 23:27:16 2012 (r231000) @@ -42,6 +42,10 @@ static int zio_use_uma = 0; TUNABLE_INT("vfs.zfs.zio.use_uma", &zio_use_uma); SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, use_uma, CTLFLAG_RDTUN, &zio_use_uma, 0, "Use uma(9) for ZIO allocations"); +static int zio_exclude_metadata = 0; +TUNABLE_INT("vfs.zfs.zio.exclude_metadata", &zio_exclude_metadata); +SYSCTL_INT(_vfs_zfs_zio, OID_AUTO, exclude_metadata, CTLFLAG_RDTUN, &zio_exclude_metadata, 0, + "Exclude metadata buffers from dumps as well"); /* * ========================================================================== @@ -148,7 +152,7 @@ zio_init(void) (void) sprintf(name, "zio_data_buf_%lu", (ulong_t)size); zio_data_buf_cache[c] = kmem_cache_create(name, size, align, NULL, NULL, NULL, NULL, NULL, - cflags | KMC_NOTOUCH); + cflags | KMC_NOTOUCH | KMC_NODEBUG); } } @@ -217,13 +221,14 @@ void * zio_buf_alloc(size_t size) { size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + int flags = zio_exclude_metadata ? KM_NODEBUG : 0; ASSERT(c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); if (zio_use_uma) return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE)); else - return (kmem_alloc(size, KM_SLEEP)); + return (kmem_alloc(size, KM_SLEEP|flags)); } /* @@ -242,7 +247,7 @@ zio_data_buf_alloc(size_t size) if (zio_use_uma) return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202042327.q14NRHjr056538>