From owner-svn-src-projects@FreeBSD.ORG Sun Nov 13 21:36:21 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1C8D6106566B; Sun, 13 Nov 2011 21:36:21 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D3238FC08; Sun, 13 Nov 2011 21:36:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pADLaKoV009753; Sun, 13 Nov 2011 21:36:20 GMT (envelope-from cognet@svn.freebsd.org) Received: (from cognet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pADLaKjd009751; Sun, 13 Nov 2011 21:36:20 GMT (envelope-from cognet@svn.freebsd.org) Message-Id: <201111132136.pADLaKjd009751@svn.freebsd.org> From: Olivier Houchard Date: Sun, 13 Nov 2011 21:36:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227492 - projects/armv6/sys/arm/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Nov 2011 21:36:21 -0000 Author: cognet Date: Sun Nov 13 21:36:20 2011 New Revision: 227492 URL: http://svn.freebsd.org/changeset/base/227492 Log: Use isb at the end of the various i-cache syncing routines, just to be sure. Suggested by: Mark Tinguely Modified: projects/armv6/sys/arm/arm/cpufunc_asm_armv7.S Modified: projects/armv6/sys/arm/arm/cpufunc_asm_armv7.S ============================================================================== --- projects/armv6/sys/arm/arm/cpufunc_asm_armv7.S Sun Nov 13 17:07:43 2011 (r227491) +++ projects/armv6/sys/arm/arm/cpufunc_asm_armv7.S Sun Nov 13 21:36:20 2011 (r227492) @@ -197,6 +197,7 @@ ENTRY(armv7_idcache_wbinv_range) add r0, r0, ip subs r1, r1, ip bhi .Larmv7_id_wbinv_next + isb /* instruction synchronization barrier */ dsb /* data synchronization barrier */ RET @@ -208,6 +209,7 @@ ENTRY_NP(armv7_icache_sync_range) add r0, r0, ip subs r1, r1, ip bhi .Larmv7_sync_next + isb /* instruction synchronization barrier */ dsb /* data synchronization barrier */ RET From owner-svn-src-projects@FreeBSD.ORG Tue Nov 15 05:49:35 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E1031065670; Tue, 15 Nov 2011 05:49:35 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 053968FC15; Tue, 15 Nov 2011 05:49:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAF5nYaC083067; Tue, 15 Nov 2011 05:49:34 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAF5nY15083066; Tue, 15 Nov 2011 05:49:34 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201111150549.pAF5nY15083066@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 15 Nov 2011 05:49:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227521 - projects/altix2 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 05:49:35 -0000 Author: marcel Date: Tue Nov 15 05:49:34 2011 New Revision: 227521 URL: http://svn.freebsd.org/changeset/base/227521 Log: Create a new branch, called altix2, for SGI Altix work. This is the continuation of the altix branch, which got increasingly harder to merge from head due to metadata bogons. Added: - copied from r227518, head/ Directory Properties: projects/altix2/ (props changed) From owner-svn-src-projects@FreeBSD.ORG Tue Nov 15 06:35:21 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4220106564A; Tue, 15 Nov 2011 06:35:21 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AE5A18FC0C; Tue, 15 Nov 2011 06:35:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAF6ZLTq084772; Tue, 15 Nov 2011 06:35:21 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAF6ZL1M084764; Tue, 15 Nov 2011 06:35:21 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201111150635.pAF6ZL1M084764@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 15 Nov 2011 06:35:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227523 - in projects/altix2/sys: amd64/include conf i386/include ia64/conf ia64/ia64 ia64/include ia64/pci ia64/sgisn kern sys x86/x86 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 06:35:21 -0000 Author: marcel Date: Tue Nov 15 06:35:21 2011 New Revision: 227523 URL: http://svn.freebsd.org/changeset/base/227523 Log: Bring over all the changes from the altix branch. This is deliberately not a merge, so prevent poisoning the merge data. Added: projects/altix2/sys/ia64/conf/ALTIX projects/altix2/sys/ia64/include/sgisn.h (contents, props changed) projects/altix2/sys/ia64/sgisn/ projects/altix2/sys/ia64/sgisn/sgisn_console.c (contents, props changed) projects/altix2/sys/ia64/sgisn/sgisn_pcib.c (contents, props changed) projects/altix2/sys/ia64/sgisn/sgisn_pcib.h (contents, props changed) projects/altix2/sys/ia64/sgisn/sgisn_shub.c (contents, props changed) projects/altix2/sys/ia64/sgisn/sgisn_shub.h (contents, props changed) projects/altix2/sys/kern/subr_busdma.c (contents, props changed) Modified: projects/altix2/sys/amd64/include/bus_dma.h projects/altix2/sys/conf/files projects/altix2/sys/conf/files.ia64 projects/altix2/sys/i386/include/bus_dma.h projects/altix2/sys/ia64/ia64/busdma_machdep.c projects/altix2/sys/ia64/ia64/interrupt.c projects/altix2/sys/ia64/ia64/machdep.c projects/altix2/sys/ia64/ia64/mp_machdep.c projects/altix2/sys/ia64/ia64/pmap.c projects/altix2/sys/ia64/include/bus.h projects/altix2/sys/ia64/include/bus_dma.h projects/altix2/sys/ia64/include/md_var.h projects/altix2/sys/ia64/include/pcpu.h projects/altix2/sys/ia64/pci/pci_cfgreg.c projects/altix2/sys/sys/bus_dma.h projects/altix2/sys/x86/x86/busdma_machdep.c Modified: projects/altix2/sys/amd64/include/bus_dma.h ============================================================================== --- projects/altix2/sys/amd64/include/bus_dma.h Tue Nov 15 05:55:15 2011 (r227522) +++ projects/altix2/sys/amd64/include/bus_dma.h Tue Nov 15 06:35:21 2011 (r227523) @@ -31,4 +31,8 @@ #include +#define BUSDMA_MAX_BPAGES 8192 + +#define bus_dma_tag_parent(x) x + #endif /* _AMD64_BUS_DMA_H_ */ Modified: projects/altix2/sys/conf/files ============================================================================== --- projects/altix2/sys/conf/files Tue Nov 15 05:55:15 2011 (r227522) +++ projects/altix2/sys/conf/files Tue Nov 15 06:35:21 2011 (r227523) @@ -2377,6 +2377,7 @@ kern/subr_acl_posix1e.c standard kern/subr_autoconf.c standard kern/subr_blist.c standard kern/subr_bus.c standard +kern/subr_busdma.c standard kern/subr_bufring.c standard kern/subr_clock.c standard kern/subr_devstat.c standard Modified: projects/altix2/sys/conf/files.ia64 ============================================================================== --- projects/altix2/sys/conf/files.ia64 Tue Nov 15 05:55:15 2011 (r227522) +++ projects/altix2/sys/conf/files.ia64 Tue Nov 15 06:35:21 2011 (r227523) @@ -117,6 +117,9 @@ ia64/ia64/vm_machdep.c standard ia64/isa/isa.c optional isa ia64/isa/isa_dma.c optional isa ia64/pci/pci_cfgreg.c optional pci +ia64/sgisn/sgisn_console.c standard +ia64/sgisn/sgisn_pcib.c standard +ia64/sgisn/sgisn_shub.c standard isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_elf32.c optional compat_freebsd32 Modified: projects/altix2/sys/i386/include/bus_dma.h ============================================================================== --- projects/altix2/sys/i386/include/bus_dma.h Tue Nov 15 05:55:15 2011 (r227522) +++ projects/altix2/sys/i386/include/bus_dma.h Tue Nov 15 06:35:21 2011 (r227523) @@ -31,4 +31,8 @@ #include +#define BUSDMA_MAX_BPAGES 512 + +#define bus_dma_tag_parent(x) x + #endif /* _I386_BUS_DMA_H_ */ Added: projects/altix2/sys/ia64/conf/ALTIX ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/altix2/sys/ia64/conf/ALTIX Tue Nov 15 06:35:21 2011 (r227523) @@ -0,0 +1,68 @@ +# $FreeBSD$ + +cpu ITANIUM2 +ident ALTIX + +makeoptions DEBUG=-g +makeoptions MODULES_OVERRIDE="" + +device ata +device atadisk +device bge +device bpf +device da +device ether +device firmware +device isp +device loop +device md +device miibus +device pass +device pci +device pty +device random +device scbus +device tun +device uart +device vlan + +options ALT_BREAK_TO_DEBUGGER +options CD9660 +options DDB +options DEADLKRES +options FFS +options GDB +options INET +options INET6 +options INVARIANTS +options INVARIANT_SUPPORT +options KDB +options KTRACE +options MD_ROOT +options MSDOSFS +options NFSCL +options NFSLOCKD +options NFS_ROOT +options NULLFS +options P1003_1B_SEMAPHORES +#options PREEMPTION +options PRINTF_BUFR_SIZE=128 +options PROCFS +options PSEUDOFS +options SCHED_ULE +options SCSI_DELAY=3000 +options SMP +options SOFTUPDATES +options SYSVMSG +options SYSVSEM +options SYSVSHM +options TMPFS +options UFS_DIRHASH +options WITNESS +options WITNESS_SKIPSPIN +options _KPOSIX_PRIORITY_SCHEDULING + +#options KTR +#options KTR_COMPILE=KTR_INTR +#options KTR_MASK=KTR_INTR +#options KTR_VERBOSE Modified: projects/altix2/sys/ia64/ia64/busdma_machdep.c ============================================================================== --- projects/altix2/sys/ia64/ia64/busdma_machdep.c Tue Nov 15 05:55:15 2011 (r227522) +++ projects/altix2/sys/ia64/ia64/busdma_machdep.c Tue Nov 15 06:35:21 2011 (r227523) @@ -26,959 +26,3 @@ #include __FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#define MAX_BPAGES 1024 - -struct bus_dma_tag { - bus_dma_tag_t parent; - bus_size_t alignment; - bus_size_t boundary; - bus_addr_t lowaddr; - bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; - bus_size_t maxsize; - u_int nsegments; - bus_size_t maxsegsz; - int flags; - int ref_count; - int map_count; - bus_dma_lock_t *lockfunc; - void *lockfuncarg; - bus_dma_segment_t *segments; -}; - -struct bounce_page { - vm_offset_t vaddr; /* kva of bounce buffer */ - bus_addr_t busaddr; /* Physical address */ - vm_offset_t datavaddr; /* kva of client data */ - bus_size_t datacount; /* client data count */ - STAILQ_ENTRY(bounce_page) links; -}; - -u_int busdma_swi_pending; - -static struct mtx bounce_lock; -static STAILQ_HEAD(bp_list, bounce_page) bounce_page_list; -static int free_bpages; -static int reserved_bpages; -static int active_bpages; -static int total_bpages; -static int total_bounced; -static int total_deferred; - -static SYSCTL_NODE(_hw, OID_AUTO, busdma, CTLFLAG_RD, 0, "Busdma parameters"); -SYSCTL_INT(_hw_busdma, OID_AUTO, free_bpages, CTLFLAG_RD, &free_bpages, 0, - "Free bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, reserved_bpages, CTLFLAG_RD, &reserved_bpages, - 0, "Reserved bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, active_bpages, CTLFLAG_RD, &active_bpages, 0, - "Active bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, total_bpages, CTLFLAG_RD, &total_bpages, 0, - "Total bounce pages"); -SYSCTL_INT(_hw_busdma, OID_AUTO, total_bounced, CTLFLAG_RD, &total_bounced, 0, - "Total bounce requests"); -SYSCTL_INT(_hw_busdma, OID_AUTO, total_deferred, CTLFLAG_RD, &total_deferred, - 0, "Total bounce requests that were deferred"); - -struct bus_dmamap { - struct bp_list bpages; - int pagesneeded; - int pagesreserved; - bus_dma_tag_t dmat; - void *buf; /* unmapped buffer pointer */ - bus_size_t buflen; /* unmapped buffer length */ - bus_dmamap_callback_t *callback; - void *callback_arg; - STAILQ_ENTRY(bus_dmamap) links; -}; - -static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; -static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; -static struct bus_dmamap nobounce_dmamap; - -static void init_bounce_pages(void *dummy); -static int alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages); -static int reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, - int commit); -static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_offset_t vaddr, bus_size_t size); -static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, - bus_size_t len); - -/* - * Return true if a match is made. - * - * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'. - * - * If paddr is within the bounds of the dma tag then call the filter callback - * to check for a match, if there is no filter callback then assume a match. - */ -static __inline int -run_filter(bus_dma_tag_t dmat, bus_addr_t paddr, bus_size_t len) -{ - bus_size_t bndy; - int retval; - - retval = 0; - bndy = dmat->boundary; - do { - if (((paddr > dmat->lowaddr && paddr <= dmat->highaddr) || - (paddr & (dmat->alignment - 1)) != 0 || - (paddr & bndy) != ((paddr + len) & bndy)) && - (dmat->filter == NULL || - (*dmat->filter)(dmat->filterarg, paddr) != 0)) - retval = 1; - dmat = dmat->parent; - } while (retval == 0 && dmat != NULL); - return (retval); -} - -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). Drivers that don't provide their own locks - * should specify &Giant to dmat->lockfuncarg. Drivers that use their own - * non-mutex locking scheme don't have to use this at all. - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -static void -dflt_lock(void *arg, bus_dma_lock_op_t op) -{ - panic("driver error: busdma dflt_lock called"); -} - -#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 - -/* - * Allocate a device specific dma_tag. - */ -int -bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, - bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, - int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) -{ - bus_dma_tag_t newtag; - int error = 0; - - /* Basic sanity checking */ - if (boundary != 0 && boundary < maxsegsz) - maxsegsz = boundary; - - /* Return a NULL tag on failure */ - *dmat = NULL; - - newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT); - if (newtag == NULL) - return (ENOMEM); - - newtag->parent = parent; - newtag->alignment = alignment; - newtag->boundary = boundary; - newtag->lowaddr = trunc_page(lowaddr) + (PAGE_SIZE - 1); - newtag->highaddr = trunc_page(highaddr) + (PAGE_SIZE - 1); - newtag->filter = filter; - newtag->filterarg = filterarg; - newtag->maxsize = maxsize; - newtag->nsegments = nsegments; - newtag->maxsegsz = maxsegsz; - newtag->flags = flags; - newtag->ref_count = 1; /* Count ourself */ - newtag->map_count = 0; - if (lockfunc != NULL) { - newtag->lockfunc = lockfunc; - newtag->lockfuncarg = lockfuncarg; - } else { - newtag->lockfunc = dflt_lock; - newtag->lockfuncarg = NULL; - } - newtag->segments = NULL; - - /* Take into account any restrictions imposed by our parent tag */ - if (parent != NULL) { - newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); - newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); - if (newtag->boundary == 0) - newtag->boundary = parent->boundary; - else if (parent->boundary != 0) - newtag->boundary = MIN(parent->boundary, - newtag->boundary); - if (newtag->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - newtag->filter = parent->filter; - newtag->filterarg = parent->filterarg; - newtag->parent = parent->parent; - } - if (newtag->parent != NULL) - atomic_add_int(&parent->ref_count, 1); - } - - if (newtag->lowaddr < ptoa(Maxmem) && (flags & BUS_DMA_ALLOCNOW) != 0) { - /* Must bounce */ - - if (ptoa(total_bpages) < maxsize) { - int pages; - - pages = atop(maxsize) - total_bpages; - - /* Add pages to our bounce pool */ - if (alloc_bounce_pages(newtag, pages) < pages) - error = ENOMEM; - } - /* Performed initial allocation */ - newtag->flags |= BUS_DMA_MIN_ALLOC_COMP; - } - - if (error != 0) { - free(newtag, M_DEVBUF); - } else { - *dmat = newtag; - } - return (error); -} - -int -bus_dma_tag_destroy(bus_dma_tag_t dmat) -{ - if (dmat != NULL) { - - if (dmat->map_count != 0) - return (EBUSY); - - while (dmat != NULL) { - bus_dma_tag_t parent; - - parent = dmat->parent; - atomic_subtract_int(&dmat->ref_count, 1); - if (dmat->ref_count == 0) { - if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } - } - return (0); -} - -/* - * Allocate a handle for mapping from kva/uva/physical - * address space into bus device space. - */ -int -bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) -{ - int error; - - error = 0; - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) - return (ENOMEM); - } - - /* - * Bouncing might be required if the driver asks for an active - * exclusion region, a data alignment that is stricter than 1, and/or - * an active address boundary. - */ - if (dmat->lowaddr < ptoa(Maxmem)) { - /* Must bounce */ - int maxpages; - - *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (*mapp == NULL) - return (ENOMEM); - - /* Initialize the new map */ - STAILQ_INIT(&((*mapp)->bpages)); - - /* - * Attempt to add pages to our pool on a per-instance - * basis up to a sane limit. - */ - maxpages = MIN(MAX_BPAGES, Maxmem - atop(dmat->lowaddr)); - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (dmat->map_count > 0 && total_bpages < maxpages)) { - int pages; - - pages = MAX(atop(dmat->maxsize), 1); - pages = MIN(maxpages - total_bpages, pages); - if (alloc_bounce_pages(dmat, pages) < pages) - error = ENOMEM; - - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0) { - if (error == 0) - dmat->flags |= BUS_DMA_MIN_ALLOC_COMP; - } else { - error = 0; - } - } - } else { - *mapp = NULL; - } - if (error == 0) - dmat->map_count++; - return (error); -} - -/* - * Destroy a handle for mapping from kva/uva/physical - * address space into bus device space. - */ -int -bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - - if (map != NULL && map != &nobounce_dmamap) { - if (STAILQ_FIRST(&map->bpages) != NULL) - return (EBUSY); - free(map, M_DEVBUF); - } - dmat->map_count--; - return (0); -} - - -/* - * Allocate a piece of memory that can be efficiently mapped into - * bus device space based on the constraints lited in the dma tag. - * A dmamap to for use with dmamap_load is also allocated. - */ -int -bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, - bus_dmamap_t *mapp) -{ - int mflags; - - if (flags & BUS_DMA_NOWAIT) - mflags = M_NOWAIT; - else - mflags = M_WAITOK; - - /* If we succeed, no mapping/bouncing will be required */ - *mapp = NULL; - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - mflags); - if (dmat->segments == NULL) - return (ENOMEM); - } - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; - - /* - * XXX: - * (dmat->alignment < dmat->maxsize) is just a quick hack; the exact - * alignment guarantees of malloc need to be nailed down, and the - * code below should be rewritten to take that into account. - * - * In the meantime, we'll warn the user if malloc gets it wrong. - */ - if ((dmat->maxsize <= PAGE_SIZE) && - (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= ptoa(Maxmem)) { - *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); - } else { - /* - * XXX Use Contigmalloc until it is merged into this facility - * and handles multi-seg allocations. Nobody is doing - * multi-seg allocations yet though. - * XXX Certain AGP hardware does. - */ - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); - } - if (*vaddr == NULL) - return (ENOMEM); - else if (vtophys(*vaddr) & (dmat->alignment - 1)) - printf("bus_dmamem_alloc failed to align memory properly.\n"); - return (0); -} - -/* - * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. - */ -void -bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) -{ - /* - * dmamem does not need to be bounced, so the map should be - * NULL - */ - if (map != NULL) - panic("bus_dmamem_free: Invalid map freed\n"); - if ((dmat->maxsize <= PAGE_SIZE) && - (dmat->alignment < dmat->maxsize) && - dmat->lowaddr >= ptoa(Maxmem)) - free(vaddr, M_DEVBUF); - else { - contigfree(vaddr, dmat->maxsize, M_DEVBUF); - } -} - -/* - * Utility function to load a linear buffer. lastaddrp holds state - * between invocations (for multiple-buffer loads). segp contains - * the starting segment on entrace, and the ending segment on exit. - * first indicates if this is the first invocation of this function. - */ -static int -_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, - bus_size_t buflen, struct thread *td, int flags, bus_addr_t *lastaddrp, - bus_dma_segment_t *segs, int *segp, int first) -{ - bus_size_t sgsize; - bus_addr_t curaddr, lastaddr, baddr, bmask; - vm_offset_t vaddr; - bus_addr_t paddr; - int seg; - pmap_t pmap; - - if (map == NULL) - map = &nobounce_dmamap; - - if (td != NULL) - pmap = vmspace_pmap(td->td_proc->p_vmspace); - else - pmap = NULL; - - if ((dmat->lowaddr < ptoa(Maxmem) || dmat->boundary > 0 || - dmat->alignment > 1) && map != &nobounce_dmamap && - map->pagesneeded == 0) { - vm_offset_t vendaddr; - - /* - * Count the number of bounce pages - * needed in order to complete this transfer - */ - vaddr = trunc_page((vm_offset_t)buf); - vendaddr = (vm_offset_t)buf + buflen; - - while (vaddr < vendaddr) { - if (pmap != NULL) - paddr = pmap_extract(pmap, vaddr); - else - paddr = pmap_kextract(vaddr); - if (run_filter(dmat, paddr, 0) != 0) - map->pagesneeded++; - vaddr += PAGE_SIZE; - } - } - - vaddr = (vm_offset_t)buf; - - /* Reserve Necessary Bounce Pages */ - if (map->pagesneeded != 0) { - mtx_lock(&bounce_lock); - if (flags & BUS_DMA_NOWAIT) { - if (reserve_bounce_pages(dmat, map, 0) != 0) { - mtx_unlock(&bounce_lock); - return (ENOMEM); - } - } else { - if (reserve_bounce_pages(dmat, map, 1) != 0) { - /* Queue us for resources */ - map->dmat = dmat; - map->buf = buf; - map->buflen = buflen; - STAILQ_INSERT_TAIL(&bounce_map_waitinglist, - map, links); - mtx_unlock(&bounce_lock); - return (EINPROGRESS); - } - } - mtx_unlock(&bounce_lock); - } - - lastaddr = *lastaddrp; - bmask = ~(dmat->boundary - 1); - - for (seg = *segp; buflen > 0 ; ) { - /* - * Get the physical address for this segment. - */ - if (pmap) - curaddr = pmap_extract(pmap, vaddr); - else - curaddr = pmap_kextract(vaddr); - - /* - * Compute the segment size, and adjust counts. - */ - sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); - if (sgsize > dmat->maxsegsz) - sgsize = dmat->maxsegsz; - if (buflen < sgsize) - sgsize = buflen; - - /* - * Make sure we don't cross any boundaries. - */ - if (dmat->boundary > 0) { - baddr = (curaddr + dmat->boundary) & bmask; - if (sgsize > (baddr - curaddr)) - sgsize = (baddr - curaddr); - } - - if (map->pagesneeded != 0 && run_filter(dmat, curaddr, sgsize)) - curaddr = add_bounce_page(dmat, map, vaddr, sgsize); - - /* - * Insert chunk into a segment, coalescing with - * previous segment if possible. - */ - if (first) { - segs[seg].ds_addr = curaddr; - segs[seg].ds_len = sgsize; - first = 0; - } else { - if (curaddr == lastaddr && - (segs[seg].ds_len + sgsize) <= dmat->maxsegsz && - (dmat->boundary == 0 || - (segs[seg].ds_addr & bmask) == (curaddr & bmask))) - segs[seg].ds_len += sgsize; - else { - if (++seg >= dmat->nsegments) - break; - segs[seg].ds_addr = curaddr; - segs[seg].ds_len = sgsize; - } - } - - lastaddr = curaddr + sgsize; - vaddr += sgsize; - buflen -= sgsize; - } - - *segp = seg; - *lastaddrp = lastaddr; - - /* - * Did we fit? - */ - return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ -} - -/* - * Map the buffer buf into bus space using the dmamap map. - */ -int -bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, - bus_size_t buflen, bus_dmamap_callback_t *callback, void *callback_arg, - int flags) -{ - bus_addr_t lastaddr = 0; - int error, nsegs = 0; - - if (map != NULL) { - flags |= BUS_DMA_WAITOK; - map->callback = callback; - map->callback_arg = callback_arg; - } - - error = _bus_dmamap_load_buffer(dmat, map, buf, buflen, NULL, flags, - &lastaddr, dmat->segments, &nsegs, 1); - - if (error == EINPROGRESS) - return (error); - - if (error) - (*callback)(callback_arg, dmat->segments, 0, error); - else - (*callback)(callback_arg, dmat->segments, nsegs + 1, 0); - - return (0); -} - -/* - * Like _bus_dmamap_load(), but for mbufs. - */ -int -bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0, - bus_dmamap_callback2_t *callback, void *callback_arg, int flags) -{ - int nsegs, error; - - M_ASSERTPKTHDR(m0); - - flags |= BUS_DMA_NOWAIT; - nsegs = 0; - error = 0; - if (m0->m_pkthdr.len <= dmat->maxsize) { - int first = 1; - bus_addr_t lastaddr = 0; - struct mbuf *m; - - for (m = m0; m != NULL && error == 0; m = m->m_next) { - if (m->m_len > 0) { - error = _bus_dmamap_load_buffer(dmat, map, - m->m_data, m->m_len, NULL, flags, - &lastaddr, dmat->segments, &nsegs, first); - first = 0; - } - } - } else { - error = EINVAL; - } - - if (error) { - /* force "no valid mappings" in callback */ - (*callback)(callback_arg, dmat->segments, 0, 0, error); - } else { - (*callback)(callback_arg, dmat->segments, nsegs + 1, - m0->m_pkthdr.len, error); - } - return (error); -} - -int -bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map, struct mbuf *m0, - bus_dma_segment_t *segs, int *nsegs, int flags) -{ - int error; - - M_ASSERTPKTHDR(m0); - - flags |= BUS_DMA_NOWAIT; - *nsegs = 0; - error = 0; - if (m0->m_pkthdr.len <= dmat->maxsize) { - int first = 1; - bus_addr_t lastaddr = 0; - struct mbuf *m; - - for (m = m0; m != NULL && error == 0; m = m->m_next) { - if (m->m_len > 0) { - error = _bus_dmamap_load_buffer(dmat, map, - m->m_data, m->m_len, NULL, flags, - &lastaddr, segs, nsegs, first); - first = 0; - } - } - ++*nsegs; - } else { - error = EINVAL; - } - - return (error); -} - -/* - * Like _bus_dmamap_load(), but for uios. - */ -int -bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map, struct uio *uio, - bus_dmamap_callback2_t *callback, void *callback_arg, int flags) -{ - bus_addr_t lastaddr; - int nsegs, error, first, i; - bus_size_t resid; - struct iovec *iov; - struct thread *td = NULL; - - flags |= BUS_DMA_NOWAIT; - resid = uio->uio_resid; - iov = uio->uio_iov; - - if (uio->uio_segflg == UIO_USERSPACE) { - td = uio->uio_td; - KASSERT(td != NULL, - ("bus_dmamap_load_uio: USERSPACE but no proc")); - } - - nsegs = 0; - error = 0; - first = 1; - for (i = 0; i < uio->uio_iovcnt && resid != 0 && !error; i++) { - /* - * Now at the first iovec to load. Load each iovec - * until we have exhausted the residual count. - */ - bus_size_t minlen = - resid < iov[i].iov_len ? resid : iov[i].iov_len; - caddr_t addr = (caddr_t) iov[i].iov_base; - - if (minlen > 0) { - error = _bus_dmamap_load_buffer(dmat, map, addr, - minlen, td, flags, &lastaddr, dmat->segments, - &nsegs, first); - first = 0; - - resid -= minlen; - } - } - - if (error) { - /* force "no valid mappings" in callback */ - (*callback)(callback_arg, dmat->segments, 0, 0, error); - } else { - (*callback)(callback_arg, dmat->segments, nsegs + 1, - uio->uio_resid, error); - } - return (error); -} - -/* - * Release the mapping held by map. - */ -void -_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - struct bounce_page *bpage; - - while ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - STAILQ_REMOVE_HEAD(&map->bpages, links); - free_bounce_page(dmat, bpage); - } -} - -void -_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) -{ - struct bounce_page *bpage; - - if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - /* - * Handle data bouncing. We might also - * want to add support for invalidating - * the caches on broken hardware - */ - - if (op & BUS_DMASYNC_PREWRITE) { - while (bpage != NULL) { - bcopy((void *)bpage->datavaddr, - (void *)bpage->vaddr, bpage->datacount); - bpage = STAILQ_NEXT(bpage, links); - } - total_bounced++; - } - - if (op & BUS_DMASYNC_POSTREAD) { - while (bpage != NULL) { - bcopy((void *)bpage->vaddr, - (void *)bpage->datavaddr, bpage->datacount); - bpage = STAILQ_NEXT(bpage, links); - } - total_bounced++; - } - } -} - -static void -init_bounce_pages(void *dummy __unused) -{ - - free_bpages = 0; - reserved_bpages = 0; - active_bpages = 0; - total_bpages = 0; - STAILQ_INIT(&bounce_page_list); - STAILQ_INIT(&bounce_map_waitinglist); - STAILQ_INIT(&bounce_map_callbacklist); - mtx_init(&bounce_lock, "bounce pages lock", NULL, MTX_DEF); -} -SYSINIT(bpages, SI_SUB_LOCK, SI_ORDER_ANY, init_bounce_pages, NULL); - -static int -alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) -{ - int count; - - count = 0; - while (numpages > 0) { - struct bounce_page *bpage; - - bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (bpage == NULL) - break; - bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0ul, dmat->lowaddr, PAGE_SIZE, dmat->boundary); - if (bpage->vaddr == 0) { - free(bpage, M_DEVBUF); - break; - } - bpage->busaddr = pmap_kextract(bpage->vaddr); - mtx_lock(&bounce_lock); - STAILQ_INSERT_TAIL(&bounce_page_list, bpage, links); - total_bpages++; - free_bpages++; - mtx_unlock(&bounce_lock); - count++; - numpages--; - } - return (count); -} - -static int -reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int commit) -{ - int pages; - - mtx_assert(&bounce_lock, MA_OWNED); - pages = MIN(free_bpages, map->pagesneeded - map->pagesreserved); - if (commit == 0 && map->pagesneeded > (map->pagesreserved + pages)) - return (map->pagesneeded - (map->pagesreserved + pages)); - free_bpages -= pages; - reserved_bpages += pages; - map->pagesreserved += pages; - pages = map->pagesneeded - map->pagesreserved; - - return (pages); -} - -static bus_addr_t -add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr, - bus_size_t size) -{ - struct bounce_page *bpage; - - KASSERT(map != NULL && map != &nobounce_dmamap, - ("add_bounce_page: bad map %p", map)); - - if (map->pagesneeded == 0) - panic("add_bounce_page: map doesn't need any pages"); - map->pagesneeded--; - - if (map->pagesreserved == 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Tue Nov 15 06:45:52 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FAE4106566B; Tue, 15 Nov 2011 06:45:52 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F3DA78FC15; Tue, 15 Nov 2011 06:45:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAF6jpeK085182; Tue, 15 Nov 2011 06:45:51 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAF6jp68085180; Tue, 15 Nov 2011 06:45:51 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201111150645.pAF6jp68085180@svn.freebsd.org> From: Marcel Moolenaar Date: Tue, 15 Nov 2011 06:45:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227525 - projects/altix2/sys/ia64/sgisn X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Nov 2011 06:45:52 -0000 Author: marcel Date: Tue Nov 15 06:45:51 2011 New Revision: 227525 URL: http://svn.freebsd.org/changeset/base/227525 Log: Garbage-collect opt_comconsole.h. Modified: projects/altix2/sys/ia64/sgisn/sgisn_console.c Modified: projects/altix2/sys/ia64/sgisn/sgisn_console.c ============================================================================== --- projects/altix2/sys/ia64/sgisn/sgisn_console.c Tue Nov 15 06:44:07 2011 (r227524) +++ projects/altix2/sys/ia64/sgisn/sgisn_console.c Tue Nov 15 06:45:51 2011 (r227525) @@ -27,8 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_comconsole.h" - #include #include #include From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 02:00:28 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 39E96106566B; Wed, 16 Nov 2011 02:00:28 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 109E88FC0A; Wed, 16 Nov 2011 02:00:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAG20Rib026290; Wed, 16 Nov 2011 02:00:27 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAG20RQC026289; Wed, 16 Nov 2011 02:00:27 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201111160200.pAG20RQC026289@svn.freebsd.org> From: Marcel Moolenaar Date: Wed, 16 Nov 2011 02:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227546 - projects/altix X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 02:00:28 -0000 Author: marcel Date: Wed Nov 16 02:00:27 2011 New Revision: 227546 URL: http://svn.freebsd.org/changeset/base/227546 Log: Remove the altix branch. It's been replaced by the altix2 branch. Deleted: projects/altix/ From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 18:34:06 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA483106566C; Wed, 16 Nov 2011 18:34:06 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9A02A8FC1A; Wed, 16 Nov 2011 18:34:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGIY6LH061378; Wed, 16 Nov 2011 18:34:06 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGIY6uS061375; Wed, 16 Nov 2011 18:34:06 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201111161834.pAGIY6uS061375@svn.freebsd.org> From: Alexander Motin Date: Wed, 16 Nov 2011 18:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227574 - projects/head_mfi/sys/dev/mfi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 18:34:06 -0000 Author: mav Date: Wed Nov 16 18:34:06 2011 New Revision: 227574 URL: http://svn.freebsd.org/changeset/base/227574 Log: Tune style for the new declarations. Modified: projects/head_mfi/sys/dev/mfi/mfireg.h projects/head_mfi/sys/dev/mfi/mfivar.h Modified: projects/head_mfi/sys/dev/mfi/mfireg.h ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfireg.h Wed Nov 16 18:33:17 2011 (r227573) +++ projects/head_mfi/sys/dev/mfi/mfireg.h Wed Nov 16 18:34:06 2011 (r227574) @@ -101,9 +101,9 @@ __FBSDID("$FreeBSD$"); #define MFI_1078_RM 0x80000000 /* reply 1078 message interrupt */ #define MFI_ODC 0x4 /* outbound doorbell change interrupt */ -/*OCR registers*/ -#define MFI_WSR 0x004 /*write sequence register*/ -#define MFI_HDR 0x008 /*host diagnostic register*/ +/* OCR registers */ +#define MFI_WSR 0x004 /* write sequence register */ +#define MFI_HDR 0x008 /* host diagnostic register */ #define MFI_RSR 0x3c3 /* Reset Status Register */ /* @@ -113,12 +113,6 @@ __FBSDID("$FreeBSD$"); #define MFI_GEN2_RM 0x00000001 /* reply GEN2 message interrupt */ /* - * gen2 specific changes - */ -#define MFI_GEN2_EIM 0x00000005 /* gen2 enable interrupt mask */ -#define MFI_GEN2_RM 0x00000001 /* reply gen2 message interrupt */ - -/* * skinny specific changes */ #define MFI_SKINNY_IDB 0x00 /* Inbound doorbell is at 0x00 for skinny */ @@ -129,7 +123,7 @@ __FBSDID("$FreeBSD$"); /* Bits for MFI_OSTS */ #define MFI_OSTS_INTR_VALID 0x00000002 -/*OCR specific flags*/ +/* OCR specific flags */ #define MFI_FIRMWARE_STATE_CHANGE 0x00000002 #define MFI_STATE_CHANGE_INTERRUPT 0x00000004 /* MFI state change interrrupt */ @@ -153,13 +147,14 @@ __FBSDID("$FreeBSD$"); #define MFI_FWSTATE_HOSTMEMREQD_MASK 0x08000000 #define MFI_FWSTATE_BOOT_MESSAGE_PENDING 0x90000000 #define MFI_RESET_REQUIRED 0x00000001 -/* ThunderBolt Support */ +/* ThunderBolt Support */ #define MFI_FWSTATE_TB_MASK 0xf0000000 #define MFI_FWSTATE_TB_RESET 0x00000000 #define MFI_FWSTATE_TB_READY 0x10000000 #define MFI_FWSTATE_TB_OPERATIONAL 0x20000000 #define MFI_FWSTATE_TB_FAULT 0x40000000 + /* * Control bits to drive the card to ready state. These go into the IDB * register. @@ -170,7 +165,7 @@ __FBSDID("$FreeBSD$"); #define MFI_FWINIT_CLEAR_HANDSHAKE 0x00000008 /* Respond to WAIT_HANDSHAKE */ #define MFI_FWINIT_HOTPLUG 0x00000010 -/*ADP reset flags*/ +/* ADP reset flags */ #define MFI_STOP_ADP 0x00000020 #define MFI_ADP_RESET 0x00000040 #define DIAG_WRITE_ENABLE 0x00000080 @@ -267,12 +262,18 @@ typedef enum { /* ThunderBolt Specific */ -// Pre-TB command size and TB command size. We will be checking it at the load time for the time being -#define MR_COMMAND_SIZE (MFI_FRAME_SIZE*20) // 1280 bytes +/* + * Pre-TB command size and TB command size. + * We will be checking it at the load time for the time being + */ +#define MR_COMMAND_SIZE (MFI_FRAME_SIZE*20) /* 1280 bytes */ #define MEGASAS_THUNDERBOLT_MSG_ALLIGNMENT 256 -// We are defining only 128 byte message to reduce memory move over head -// and also it will reduce the SRB extension size by 128byte compared with 256 message size +/* + * We are defining only 128 byte message to reduce memory move over head + * and also it will reduce the SRB extension size by 128byte compared with + * 256 message size + */ #define MEGASAS_THUNDERBOLT_NEW_MSG_SIZE 256 #define MEGASAS_THUNDERBOLT_MAX_COMMANDS 1024 #define MEGASAS_THUNDERBOLT_MAX_REPLY_COUNT 1024 @@ -282,7 +283,7 @@ typedef enum { #define MPI2_FUNCTION_PASSTHRU_IO_REQUEST 0xF0 #define MPI2_FUNCTION_LD_IO_REQUEST 0xF1 -//TODO remove this and place the right AEN +/* TODO remove this and place the right AEN */ #define MR_EVT_LD_FAST_PATH_IO_STATUS_CHANGED (0xFFFF) #define MR_INTERNAL_MFI_FRAMES_SMID 1 @@ -434,8 +435,8 @@ typedef enum { MR_PD_QUERY_TYPE_POWER_STATE = 2, MR_PD_QUERY_TYPE_MEDIA_TYPE = 3, MR_PD_QUERY_TYPE_SPEED = 4, - MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5, /*query for system drives */ -}mfi_pd_query_type; + MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5 /*query for system drives */ +} mfi_pd_query_type; /* * Other propertities and definitions @@ -459,8 +460,6 @@ typedef enum { #define MFI_SECTOR_LEN 512 /* Scatter Gather elements */ - -/* Scatter Gather elements */ struct mfi_sg32 { uint32_t addr; uint32_t len; @@ -478,9 +477,9 @@ struct mfi_sg_skinny { } __packed; union mfi_sgl { - struct mfi_sg32 sg32[1]; - struct mfi_sg64 sg64[1]; - struct mfi_sg_skinny sg_skinny[1]; + struct mfi_sg32 sg32[1]; + struct mfi_sg64 sg64[1]; + struct mfi_sg_skinny sg_skinny[1]; } __packed; /* Message frames. All messages have a common header */ @@ -496,7 +495,7 @@ struct mfi_frame_header { uint32_t context; /* * pad0 is MSI Specific. Not used by Driver. Zero the value before - * sending the command to f/w + * sending the command to f/w. */ uint32_t pad0; uint16_t flags; @@ -521,9 +520,8 @@ struct mfi_init_frame { } __packed; /* - * define MFI Address Context union + * Define MFI Address Context union. */ - #ifdef MFI_ADDRESS_IS_uint64_t typedef uint64_t MFI_ADDRESS; #else @@ -647,40 +645,58 @@ struct mfi_ctrl_props { uint8_t expose_encl_devices; uint8_t maintainPdFailHistory; uint8_t disallowHostRequestReordering; - uint8_t abortCCOnError; // set TRUE to abort CC on detecting an inconsistency - uint8_t loadBalanceMode;// load balance mode (MR_LOAD_BALANCE_MODE) - uint8_t disableAutoDetectBackplane; // 0 - use auto detect logic of backplanes like SGPIO, i2c SEP using h/w mechansim like GPIO pins - // 1 - disable auto detect SGPIO, - // 2 - disable i2c SEP auto detect - // 3 - disable both auto detect - uint8_t snapVDSpace; // % of source LD to be reserved for a VDs snapshot in snapshot repository, for metadata and user data - // 1=5%, 2=10%, 3=15% and so on + /* set TRUE to abort CC on detecting an inconsistency */ + uint8_t abortCCOnError; + /* load balance mode (MR_LOAD_BALANCE_MODE) */ + uint8_t loadBalanceMode; + /* + * 0 - use auto detect logic of backplanes like SGPIO, i2c SEP using + * h/w mechansim like GPIO pins + * 1 - disable auto detect SGPIO, + * 2 - disable i2c SEP auto detect + * 3 - disable both auto detect + */ + uint8_t disableAutoDetectBackplane; + /* + * % of source LD to be reserved for a VDs snapshot in snapshot + * repository, for metadata and user data: 1=5%, 2=10%, 3=15% and so on + */ + uint8_t snapVDSpace; /* - * Add properties that can be controlled by a bit in the following structure. - */ + * Add properties that can be controlled by a bit in the following + * structure. + */ struct { - uint32_t copyBackDisabled :1; // set TRUE to disable copyBack (0=copback enabled) - uint32_t SMARTerEnabled :1; + /* set TRUE to disable copyBack (0=copback enabled) */ + uint32_t copyBackDisabled :1; + uint32_t SMARTerEnabled :1; uint32_t prCorrectUnconfiguredAreas :1; - uint32_t useFdeOnly :1; - uint32_t disableNCQ :1; - uint32_t SSDSMARTerEnabled :1; + uint32_t useFdeOnly :1; + uint32_t disableNCQ :1; + uint32_t SSDSMARTerEnabled :1; uint32_t SSDPatrolReadEnabled :1; uint32_t enableSpinDownUnconfigured :1; - uint32_t autoEnhancedImport :1; + uint32_t autoEnhancedImport :1; uint32_t enableSecretKeyControl :1; uint32_t disableOnlineCtrlReset :1; uint32_t allowBootWithPinnedCache :1; - uint32_t disableSpinDownHS :1; - uint32_t enableJBOD :1; - uint32_t reserved :18; + uint32_t disableSpinDownHS :1; + uint32_t enableJBOD :1; + uint32_t reserved :18; } OnOffProperties; - uint8_t autoSnapVDSpace; // % of source LD to be reserved for auto snapshot in snapshot repository, for metadata and user data - // 1=5%, 2=10%, 3=15% and so on - uint8_t viewSpace; // snapshot writeable VIEWs capacity as a % of source LD capacity. 0=READ only - // 1=5%, 2=10%, 3=15% and so on - uint16_t spinDownTime; // # of idle minutes before device is spun down (0=use FW defaults) + /* + * % of source LD to be reserved for auto snapshot in snapshot + * repository, for metadata and user data: 1=5%, 2=10%, 3=15% and so on. + */ + uint8_t autoSnapVDSpace; + /* + * Snapshot writeable VIEWs capacity as a % of source LD capacity: + * 0=READ only, 1=5%, 2=10%, 3=15% and so on. + */ + uint8_t viewSpace; + /* # of idle minutes before device is spun down (0=use FW defaults) */ + uint16_t spinDownTime; uint8_t reserved[24]; } __packed; @@ -1396,27 +1412,26 @@ struct mfi_pr_properties { * Raid Context structure which describes MegaRAID specific IO Paramenters * This resides at offset 0x60 where the SGL normally starts in MPT IO Frames */ - typedef struct _MPI2_SCSI_IO_VENDOR_UNIQUE { - uint16_t resvd0; // 0x00 -0x01 - uint16_t timeoutValue; // 0x02 -0x03 - uint8_t regLockFlags; - uint8_t armId; - uint16_t TargetID; // 0x06 -0x07 - - uint64_t RegLockLBA; // 0x08 - 0x0F - - uint32_t RegLockLength; // 0x10 - 0x13 - - uint16_t SMID; //nextLMId; // 0x14 - 0x15 - uint8_t exStatus; // 0x16 - uint8_t Status; // 0x17 status - - uint8_t RAIDFlags; // 0x18 - uint8_t numSGE; // 0x19 numSge - uint16_t configSeqNum; // 0x1A - 0x1B - uint8_t spanArm; // 0x1C - uint8_t resvd2[3]; // 0x1D- 0x1F + uint16_t resvd0; /* 0x00 - 0x01 */ + uint16_t timeoutValue; /* 0x02 - 0x03 */ + uint8_t regLockFlags; + uint8_t armId; + uint16_t TargetID; /* 0x06 - 0x07 */ + + uint64_t RegLockLBA; /* 0x08 - 0x0F */ + + uint32_t RegLockLength; /* 0x10 - 0x13 */ + + uint16_t SMID; /* 0x14 - 0x15 nextLMId */ + uint8_t exStatus; /* 0x16 */ + uint8_t Status; /* 0x17 status */ + + uint8_t RAIDFlags; /* 0x18 */ + uint8_t numSGE; /* 0x19 numSge */ + uint16_t configSeqNum; /* 0x1A - 0x1B */ + uint8_t spanArm; /* 0x1C */ + uint8_t resvd2[3]; /* 0x1D - 0x1F */ } MPI2_SCSI_IO_VENDOR_UNIQUE, MPI25_SCSI_IO_VENDOR_UNIQUE; /*** DJA *****/ @@ -1458,8 +1473,6 @@ typedef struct _MPI2_SCSI_IO_VENDOR_UNIQ #define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC (0xF0) /* beginning of product-specific range */ #define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC (0xFF) /* end of product-specific range */ - - /* Doorbell functions */ #define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40) #define MPI2_FUNCTION_HANDSHAKE (0x42) @@ -1488,38 +1501,38 @@ typedef struct _MPI2_SCSI_IO_VENDOR_UNIQ #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) #define MPI2_HEADER_VERSION_DEV_MASK (0x00FF) #define MPI2_HEADER_VERSION_DEV_SHIFT (0) -#define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | MPI2_HEADER_VERSION_DEV) +#define MPI2_HEADER_VERSION ((MPI2_HEADER_VERSION_UNIT << 8) | \ + MPI2_HEADER_VERSION_DEV) /* IOCInit Request message */ -struct MPI2_IOC_INIT_REQUEST -{ - uint8_t WhoInit; /* 0x00 */ - uint8_t Reserved1; /* 0x01 */ - uint8_t ChainOffset; /* 0x02 */ - uint8_t Function; /* 0x03 */ - uint16_t Reserved2; /* 0x04 */ - uint8_t Reserved3; /* 0x06 */ - uint8_t MsgFlags; /* 0x07 */ - uint8_t VP_ID; /* 0x08 */ - uint8_t VF_ID; /* 0x09 */ - uint16_t Reserved4; /* 0x0A */ - uint16_t MsgVersion; /* 0x0C */ - uint16_t HeaderVersion; /* 0x0E */ - uint32_t Reserved5; /* 0x10 */ - uint16_t Reserved6; /* 0x14 */ - uint8_t Reserved7; /* 0x16 */ - uint8_t HostMSIxVectors; /* 0x17 */ - uint16_t Reserved8; /* 0x18 */ - uint16_t SystemRequestFrameSize; /* 0x1A */ - uint16_t ReplyDescriptorPostQueueDepth; /* 0x1C */ - uint16_t ReplyFreeQueueDepth; /* 0x1E */ - uint32_t SenseBufferAddressHigh; /* 0x20 */ - uint32_t SystemReplyAddressHigh; /* 0x24 */ - uint64_t SystemRequestFrameBaseAddress; /* 0x28 */ - uint64_t ReplyDescriptorPostQueueAddress;/* 0x30 */ - uint64_t ReplyFreeQueueAddress; /* 0x38 */ - uint64_t TimeStamp; /* 0x40 */ +struct MPI2_IOC_INIT_REQUEST { + uint8_t WhoInit; /* 0x00 */ + uint8_t Reserved1; /* 0x01 */ + uint8_t ChainOffset; /* 0x02 */ + uint8_t Function; /* 0x03 */ + uint16_t Reserved2; /* 0x04 */ + uint8_t Reserved3; /* 0x06 */ + uint8_t MsgFlags; /* 0x07 */ + uint8_t VP_ID; /* 0x08 */ + uint8_t VF_ID; /* 0x09 */ + uint16_t Reserved4; /* 0x0A */ + uint16_t MsgVersion; /* 0x0C */ + uint16_t HeaderVersion; /* 0x0E */ + uint32_t Reserved5; /* 0x10 */ + uint16_t Reserved6; /* 0x14 */ + uint8_t Reserved7; /* 0x16 */ + uint8_t HostMSIxVectors; /* 0x17 */ + uint16_t Reserved8; /* 0x18 */ + uint16_t SystemRequestFrameSize; /* 0x1A */ + uint16_t ReplyDescriptorPostQueueDepth; /* 0x1C */ + uint16_t ReplyFreeQueueDepth; /* 0x1E */ + uint32_t SenseBufferAddressHigh; /* 0x20 */ + uint32_t SystemReplyAddressHigh; /* 0x24 */ + uint64_t SystemRequestFrameBaseAddress; /* 0x28 */ + uint64_t ReplyDescriptorPostQueueAddress;/* 0x30 */ + uint64_t ReplyFreeQueueAddress; /* 0x38 */ + uint64_t TimeStamp; /* 0x40 */ }; /* WhoInit values */ @@ -1530,47 +1543,40 @@ struct MPI2_IOC_INIT_REQUEST #define MPI2_WHOINIT_HOST_DRIVER (0x04) #define MPI2_WHOINIT_MANUFACTURER (0x05) -struct MPI2_SGE_CHAIN_UNION -{ - uint16_t Length; - uint8_t NextChainOffset; - uint8_t Flags; - union - { - uint32_t Address32; - uint64_t Address64; - } u; -}; - -struct MPI2_IEEE_SGE_SIMPLE32 -{ - uint32_t Address; - uint32_t FlagsLength; -}; - -struct MPI2_IEEE_SGE_SIMPLE64 -{ - uint64_t Address; - uint32_t Length; - uint16_t Reserved1; - uint8_t Reserved2; - uint8_t Flags; -}; - -typedef union _MPI2_IEEE_SGE_SIMPLE_UNION -{ - struct MPI2_IEEE_SGE_SIMPLE32 Simple32; - struct MPI2_IEEE_SGE_SIMPLE64 Simple64; +struct MPI2_SGE_CHAIN_UNION { + uint16_t Length; + uint8_t NextChainOffset; + uint8_t Flags; + union { + uint32_t Address32; + uint64_t Address64; + } u; +}; + +struct MPI2_IEEE_SGE_SIMPLE32 { + uint32_t Address; + uint32_t FlagsLength; +}; + +struct MPI2_IEEE_SGE_SIMPLE64 { + uint64_t Address; + uint32_t Length; + uint16_t Reserved1; + uint8_t Reserved2; + uint8_t Flags; +}; + +typedef union _MPI2_IEEE_SGE_SIMPLE_UNION { + struct MPI2_IEEE_SGE_SIMPLE32 Simple32; + struct MPI2_IEEE_SGE_SIMPLE64 Simple64; } MPI2_IEEE_SGE_SIMPLE_UNION; -typedef struct _MPI2_SGE_SIMPLE_UNION -{ - uint32_t FlagsLength; - union - { - uint32_t Address32; - uint64_t Address64; - } u; +typedef struct _MPI2_SGE_SIMPLE_UNION { + uint32_t FlagsLength; + union { + uint32_t Address32; + uint64_t Address64; + } u; } MPI2_SGE_SIMPLE_UNION; /**************************************************************************** @@ -1630,41 +1636,36 @@ typedef struct _MPI2_SGE_SIMPLE_UNION /*******************/ -typedef struct -{ - uint8_t CDB[20]; /* 0x00 */ - uint32_t PrimaryReferenceTag; /* 0x14 */ - uint16_t PrimaryApplicationTag; /* 0x18 */ - uint16_t PrimaryApplicationTagMask; /* 0x1A */ - uint32_t TransferLength; /* 0x1C */ +typedef struct { + uint8_t CDB[20]; /* 0x00 */ + uint32_t PrimaryReferenceTag; /* 0x14 */ + uint16_t PrimaryApplicationTag; /* 0x18 */ + uint16_t PrimaryApplicationTagMask; /* 0x1A */ + uint32_t TransferLength; /* 0x1C */ } MPI2_SCSI_IO_CDB_EEDP32; -typedef union _MPI2_IEEE_SGE_CHAIN_UNION -{ - struct MPI2_IEEE_SGE_SIMPLE32 Chain32; - struct MPI2_IEEE_SGE_SIMPLE64 Chain64; +typedef union _MPI2_IEEE_SGE_CHAIN_UNION { + struct MPI2_IEEE_SGE_SIMPLE32 Chain32; + struct MPI2_IEEE_SGE_SIMPLE64 Chain64; } MPI2_IEEE_SGE_CHAIN_UNION; -typedef union _MPI2_SIMPLE_SGE_UNION -{ - MPI2_SGE_SIMPLE_UNION MpiSimple; - MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; +typedef union _MPI2_SIMPLE_SGE_UNION { + MPI2_SGE_SIMPLE_UNION MpiSimple; + MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; } MPI2_SIMPLE_SGE_UNION; -typedef union _MPI2_SGE_IO_UNION -{ - MPI2_SGE_SIMPLE_UNION MpiSimple; - struct MPI2_SGE_CHAIN_UNION MpiChain; - MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; - MPI2_IEEE_SGE_CHAIN_UNION IeeeChain; +typedef union _MPI2_SGE_IO_UNION { + MPI2_SGE_SIMPLE_UNION MpiSimple; + struct MPI2_SGE_CHAIN_UNION MpiChain; + MPI2_IEEE_SGE_SIMPLE_UNION IeeeSimple; + MPI2_IEEE_SGE_CHAIN_UNION IeeeChain; } MPI2_SGE_IO_UNION; -typedef union -{ - uint8_t CDB32[32]; - MPI2_SCSI_IO_CDB_EEDP32 EEDP32; - MPI2_SGE_SIMPLE_UNION SGE; +typedef union { + uint8_t CDB32[32]; + MPI2_SCSI_IO_CDB_EEDP32 EEDP32; + MPI2_SGE_SIMPLE_UNION SGE; } MPI2_SCSI_IO_CDB_UNION; @@ -1672,13 +1673,12 @@ typedef union #define MPI25_IEEE_SGE_FLAGS_END_OF_LIST (0x40) -typedef struct _MPI25_IEEE_SGE_CHAIN64 -{ - uint64_t Address; - uint32_t Length; - uint16_t Reserved1; - uint8_t NextChainOffset; - uint8_t Flags; +typedef struct _MPI25_IEEE_SGE_CHAIN64 { + uint64_t Address; + uint32_t Length; + uint16_t Reserved1; + uint8_t NextChainOffset; + uint8_t Flags; } MPI25_IEEE_SGE_CHAIN64, *pMpi25IeeeSgeChain64_t; /* use MPI2_IEEE_SGE_FLAGS_ defines for the Flags field */ @@ -1690,8 +1690,7 @@ typedef struct _MPI25_IEEE_SGE_CHAIN64 * RAID SCSI IO Request Message * Total SGE count will be one less than _MPI2_SCSI_IO_REQUEST */ -struct mfi_mpi2_request_raid_scsi_io -{ +struct mfi_mpi2_request_raid_scsi_io { uint16_t DevHandle; /* 0x00 */ uint8_t ChainOffset; /* 0x02 */ uint8_t Function; /* 0x03 */ @@ -1729,16 +1728,16 @@ struct mfi_mpi2_request_raid_scsi_io * MPT RAID MFA IO Descriptor. */ typedef struct _MFI_RAID_MFA_IO_DESCRIPTOR { - uint32_t RequestFlags : 8; - uint32_t MessageAddress1 : 24; /* bits 31:8*/ - uint32_t MessageAddress2; /* bits 61:32 */ + uint32_t RequestFlags : 8; + uint32_t MessageAddress1 : 24; /* bits 31:8*/ + uint32_t MessageAddress2; /* bits 61:32 */ } MFI_RAID_MFA_IO_REQUEST_DESCRIPTOR,*PMFI_RAID_MFA_IO_REQUEST_DESCRIPTOR; struct mfi_mpi2_request_header { - uint8_t RequestFlags; /* 0x00 */ - uint8_t MSIxIndex; /* 0x01 */ - uint16_t SMID; /* 0x02 */ - uint16_t LMID; /* 0x04 */ + uint8_t RequestFlags; /* 0x00 */ + uint8_t MSIxIndex; /* 0x01 */ + uint16_t SMID; /* 0x02 */ + uint16_t LMID; /* 0x04 */ }; /* defines for the RequestFlags field */ @@ -1752,18 +1751,18 @@ struct mfi_mpi2_request_header { #define MPI2_REQ_DESCRIPT_FLAGS_IOC_FIFO_MARKER (0x01) struct mfi_mpi2_request_high_priority { - struct mfi_mpi2_request_header header; - uint16_t reserved; + struct mfi_mpi2_request_header header; + uint16_t reserved; }; struct mfi_mpi2_request_scsi_io { - struct mfi_mpi2_request_header header; - uint16_t scsi_io_dev_handle; + struct mfi_mpi2_request_header header; + uint16_t scsi_io_dev_handle; }; struct mfi_mpi2_request_scsi_target { - struct mfi_mpi2_request_header header; - uint16_t scsi_target_io_index; + struct mfi_mpi2_request_header header; + uint16_t scsi_target_io_index; }; /* Request Descriptors */ @@ -1777,9 +1776,9 @@ union mfi_mpi2_request_descriptor { struct mfi_mpi2_reply_header { - uint8_t ReplyFlags; /* 0x00 */ - uint8_t MSIxIndex; /* 0x01 */ - uint16_t SMID; /* 0x02 */ + uint8_t ReplyFlags; /* 0x00 */ + uint8_t MSIxIndex; /* 0x01 */ + uint16_t SMID; /* 0x02 */ }; /* defines for the ReplyFlags field */ @@ -1796,45 +1795,44 @@ struct mfi_mpi2_reply_header { #define MPI2_RPY_DESCRIPT_UNUSED_WORD1_MARK (0xFFFFFFFF) struct mfi_mpi2_reply_default { - struct mfi_mpi2_reply_header header; - uint32_t DescriptorTypeDependent2; + struct mfi_mpi2_reply_header header; + uint32_t DescriptorTypeDependent2; }; struct mfi_mpi2_reply_address { - struct mfi_mpi2_reply_header header; - uint32_t ReplyFrameAddress; + struct mfi_mpi2_reply_header header; + uint32_t ReplyFrameAddress; }; struct mfi_mpi2_reply_scsi_io { - struct mfi_mpi2_reply_header header; - uint16_t TaskTag; /* 0x04 */ - uint16_t Reserved1; /* 0x06 */ + struct mfi_mpi2_reply_header header; + uint16_t TaskTag; /* 0x04 */ + uint16_t Reserved1; /* 0x06 */ }; struct mfi_mpi2_reply_target_assist { - struct mfi_mpi2_reply_header header; - uint8_t SequenceNumber; /* 0x04 */ - uint8_t Reserved1; /* 0x04 */ - uint16_t IoIndex; /* 0x06 */ + struct mfi_mpi2_reply_header header; + uint8_t SequenceNumber; /* 0x04 */ + uint8_t Reserved1; /* 0x04 */ + uint16_t IoIndex; /* 0x06 */ }; struct mfi_mpi2_reply_target_cmd_buffer { - struct mfi_mpi2_reply_header header; - uint8_t SequenceNumber; /* 0x04 */ - uint8_t Flags; /* 0x04 */ - uint16_t InitiatorDevHandle; /* 0x06 */ - uint16_t IoIndex; /* 0x06 */ + struct mfi_mpi2_reply_header header; + uint8_t SequenceNumber; /* 0x04 */ + uint8_t Flags; /* 0x04 */ + uint16_t InitiatorDevHandle; /* 0x06 */ + uint16_t IoIndex; /* 0x06 */ }; struct mfi_mpi2_reply_raid_accel { - struct mfi_mpi2_reply_header header; - uint8_t SequenceNumber; /* 0x04 */ - uint32_t Reserved; /* 0x04 */ + struct mfi_mpi2_reply_header header; + uint8_t SequenceNumber; /* 0x04 */ + uint32_t Reserved; /* 0x04 */ }; /* union of Reply Descriptors */ -union mfi_mpi2_reply_descriptor -{ +union mfi_mpi2_reply_descriptor { struct mfi_mpi2_reply_header header; struct mfi_mpi2_reply_scsi_io scsi_io; struct mfi_mpi2_reply_target_assist target_assist; @@ -1845,13 +1843,13 @@ union mfi_mpi2_reply_descriptor }; struct IO_REQUEST_INFO { - uint64_t ldStartBlock; - uint32_t numBlocks; - uint16_t ldTgtId; - uint8_t isRead; - uint16_t devHandle; - uint64_t pdBlock; - uint8_t fpOkForIo; + uint64_t ldStartBlock; + uint32_t numBlocks; + uint16_t ldTgtId; + uint8_t isRead; + uint16_t devHandle; + uint64_t pdBlock; + uint8_t fpOkForIo; }; #define MFI_SCSI_MAX_TARGETS 128 Modified: projects/head_mfi/sys/dev/mfi/mfivar.h ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfivar.h Wed Nov 16 18:33:17 2011 (r227573) +++ projects/head_mfi/sys/dev/mfi/mfivar.h Wed Nov 16 18:34:06 2011 (r227574) @@ -73,8 +73,8 @@ struct mfi_hwcomms { uint32_t hw_ci; uint32_t hw_reply_q[1]; }; -#define MEGASAS_MAX_NAME 32 -#define MEGASAS_VERSION "4.23" +#define MEGASAS_MAX_NAME 32 +#define MEGASAS_VERSION "4.23" struct mfi_softc; struct disk; @@ -127,12 +127,12 @@ struct mfi_disk { }; struct mfi_system_pd { - TAILQ_ENTRY(mfi_system_pd) pd_link; + TAILQ_ENTRY(mfi_system_pd) pd_link; device_t pd_dev; int pd_id; int pd_unit; struct mfi_softc *pd_controller; - struct mfi_pd_info *pd_info; + struct mfi_pd_info *pd_info; struct disk *pd_disk; int pd_flags; }; @@ -153,8 +153,8 @@ typedef struct { volatile unsigned int val; } atomic_t; -#define atomic_read(v) ((v)->val) -#define atomic_set(v,i) ((v)->val - (i)) +#define atomic_read(v) ((v)->val) +#define atomic_set(v,i) ((v)->val - (i)) struct mfi_softc { device_t mfi_dev; @@ -246,7 +246,7 @@ struct mfi_softc { struct intr_config_hook mfi_ich; eventhandler_tag eh; - /*OCR flags*/ + /* OCR flags */ atomic_t fw_reset_no_pci_access; uint8_t adpreset; uint8_t issuepend_done; @@ -317,18 +317,21 @@ struct mfi_softc { uint32_t MFA_enabled; uint64_t map_id; struct mfi_command *map_update_cmd; - //Thunderbolt Related structure members - uint16_t reply_size; // Single Reply structure size - uint16_t raid_io_msg_size; // Singler message size + /* Single Reply structure size */ + uint16_t reply_size; + /* Singler message size. */ + uint16_t raid_io_msg_size; TAILQ_HEAD(TB, mfi_cmd_tbolt) mfi_cmd_tbolt_tqh; - bus_dma_tag_t mfi_tb_dmat; // ThunderBolt base contiguous memory mapping + /* ThunderBolt base contiguous memory mapping. */ + bus_dma_tag_t mfi_tb_dmat; bus_dmamap_t mfi_tb_dmamap; #if defined(__amd64__) uint64_t mfi_tb_busaddr; #else uint32_t mfi_tb_busaddr; #endif - uint8_t * request_message_pool; // ThunderBolt Contiguous DMA memory Mapping + /* ThunderBolt Contiguous DMA memory Mapping */ + uint8_t * request_message_pool; uint8_t * request_message_pool_align; uint8_t * request_desc_pool; //uint32_t request_desc_busaddr; @@ -341,14 +344,17 @@ struct mfi_softc { uint32_t reply_frame_busaddr; uint32_t sg_frame_busaddr; #endif - bus_dma_tag_t mfi_tb_ioc_init_dmat; // ThunderBolt IOC Init Descriptor + /* ThunderBolt IOC Init Descriptor */ + bus_dma_tag_t mfi_tb_ioc_init_dmat; bus_dmamap_t mfi_tb_ioc_init_dmamap; uint8_t * mfi_tb_ioc_init_desc; struct mfi_cmd_tbolt **mfi_cmd_pool_tbolt; - struct mfi_mpi2_reply_header* reply_frame_pool; // Virtual address of reply Frame Pool + /* Virtual address of reply Frame Pool */ + struct mfi_mpi2_reply_header* reply_frame_pool; struct mfi_mpi2_reply_header* reply_frame_pool_align; - uint8_t * reply_pool_limit; // Last reply frame address + /* Last reply frame address */ + uint8_t * reply_pool_limit; uint16_t last_reply_idx; uint8_t max_SGEs_in_chain_message; uint8_t max_SGEs_in_main_message; @@ -359,11 +365,11 @@ struct mfi_softc { }; union desc_value { - uint64_t word; + uint64_t word; struct { - uint32_t low; - uint32_t high; - }u; + uint32_t low; + uint32_t high; + }u; }; // TODO find the right definition @@ -387,21 +393,21 @@ union desc_value { #define MEGASAS_RD_WR_PROTECT_CHECK_NONE 0x60 #define MEGASAS_EEDPBLOCKSIZE 512 struct mfi_cmd_tbolt { - union mfi_mpi2_request_descriptor *request_desc; - struct mfi_mpi2_request_raid_scsi_io *io_request; - uintptr_t io_request_phys_addr; - uintptr_t sg_frame_phys_addr; - uintptr_t sense_phys_addr; - MPI2_SGE_IO_UNION *sg_frame; - uint8_t *sense; + union mfi_mpi2_request_descriptor *request_desc; + struct mfi_mpi2_request_raid_scsi_io *io_request; + uintptr_t io_request_phys_addr; + uintptr_t sg_frame_phys_addr; + uintptr_t sense_phys_addr; + MPI2_SGE_IO_UNION *sg_frame; + uint8_t *sense; TAILQ_ENTRY(mfi_cmd_tbolt) next; /* * Context for a MFI frame. * Used to get the mfi cmd from list when a MFI cmd is completed */ - uint32_t sync_cmd_idx; - uint16_t index; - uint8_t status; + uint32_t sync_cmd_idx; + uint16_t index; + uint8_t status; }; extern int mfi_attach(struct mfi_softc *); From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 18:43:59 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FF17106564A; Wed, 16 Nov 2011 18:43:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0330D8FC19; Wed, 16 Nov 2011 18:43:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGIhwpZ061862; Wed, 16 Nov 2011 18:43:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGIhwqD061860; Wed, 16 Nov 2011 18:43:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201111161843.pAGIhwqD061860@svn.freebsd.org> From: Alexander Motin Date: Wed, 16 Nov 2011 18:43:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227579 - projects/head_mfi/sys/dev/mfi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 18:43:59 -0000 Author: mav Date: Wed Nov 16 18:43:58 2011 New Revision: 227579 URL: http://svn.freebsd.org/changeset/base/227579 Log: Use bus_addr_t instead of uintXX_t and ifdefs for bus addresses. Do some formatting. Modified: projects/head_mfi/sys/dev/mfi/mfivar.h Modified: projects/head_mfi/sys/dev/mfi/mfivar.h ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfivar.h Wed Nov 16 18:42:43 2011 (r227578) +++ projects/head_mfi/sys/dev/mfi/mfivar.h Wed Nov 16 18:43:58 2011 (r227579) @@ -171,16 +171,12 @@ struct mfi_softc { // Start: LSIP200113393 bus_dma_tag_t verbuf_h_dmat; bus_dmamap_t verbuf_h_dmamap; - uint32_t verbuf_h_busaddr; - uint32_t *verbuf; - void * kbuff_arr[MAX_IOCTL_SGE]; + uint32_t verbuf_h_busaddr; + uint32_t *verbuf; + void *kbuff_arr[MAX_IOCTL_SGE]; bus_dma_tag_t mfi_kbuff_arr_dmat[2]; bus_dmamap_t mfi_kbuff_arr_dmamap[2]; - #if defined (__amd64__) - uint64_t mfi_kbuff_arr_busaddr[2]; - #else - uint32_t mfi_kbuff_arr_busaddr[2]; - #endif + bus_addr_t mfi_kbuff_arr_busaddr[2]; struct mfi_hwcomms *mfi_comms; TAILQ_HEAD(,mfi_command) mfi_free; @@ -199,30 +195,17 @@ struct mfi_softc { bus_dma_tag_t mfi_comms_dmat; bus_dmamap_t mfi_comms_dmamap; - #if defined(__amd64__) - uint64_t mfi_comms_busaddr; -#else - uint32_t mfi_comms_busaddr; -#endif + bus_addr_t mfi_comms_busaddr; bus_dma_tag_t mfi_frames_dmat; bus_dmamap_t mfi_frames_dmamap; -#if defined(__amd64__) - uint64_t mfi_frames_busaddr; -#else - uint32_t mfi_frames_busaddr; -#endif + bus_addr_t mfi_frames_busaddr; union mfi_frame *mfi_frames; bus_dma_tag_t mfi_tb_init_dmat; bus_dmamap_t mfi_tb_init_dmamap; - #if defined(__amd64__) - uint64_t mfi_tb_init_busaddr; - uint64_t mfi_tb_ioc_init_busaddr; - #else - uint32_t mfi_tb_init_busaddr; - uint32_t mfi_tb_ioc_init_busaddr; - #endif + bus_addr_t mfi_tb_init_busaddr; + bus_addr_t mfi_tb_ioc_init_busaddr; union mfi_frame *mfi_tb_init; TAILQ_HEAD(,mfi_aen) mfi_aen_pids; @@ -304,13 +287,10 @@ struct mfi_softc { void (*mfi_disable_intr)(struct mfi_softc *sc); int32_t (*mfi_read_fw_status)(struct mfi_softc *sc); int (*mfi_check_clear_intr)(struct mfi_softc *sc); - #if defined(__amd64__) - void (*mfi_issue_cmd)(struct mfi_softc *sc,uint64_t bus_add,uint32_t frame_cnt); - #else - void (*mfi_issue_cmd)(struct mfi_softc *sc,uint32_t bus_add,uint32_t frame_cnt); - #endif - int (*mfi_adp_reset)(struct mfi_softc *sc); - int (*mfi_adp_check_reset)(struct mfi_softc *sc); + void (*mfi_issue_cmd)(struct mfi_softc *sc, bus_addr_t bus_add, + uint32_t frame_cnt); + int (*mfi_adp_reset)(struct mfi_softc *sc); + int (*mfi_adp_check_reset)(struct mfi_softc *sc); /* ThunderBolt */ uint32_t mfi_tbolt; @@ -325,25 +305,15 @@ struct mfi_softc { /* ThunderBolt base contiguous memory mapping. */ bus_dma_tag_t mfi_tb_dmat; bus_dmamap_t mfi_tb_dmamap; - #if defined(__amd64__) - uint64_t mfi_tb_busaddr; - #else - uint32_t mfi_tb_busaddr; - #endif + bus_addr_t mfi_tb_busaddr; /* ThunderBolt Contiguous DMA memory Mapping */ uint8_t * request_message_pool; uint8_t * request_message_pool_align; uint8_t * request_desc_pool; //uint32_t request_desc_busaddr; - #if defined(__amd64__) - uint64_t request_msg_busaddr; - uint64_t reply_frame_busaddr; - uint64_t sg_frame_busaddr; - #else - uint32_t request_msg_busaddr; - uint32_t reply_frame_busaddr; - uint32_t sg_frame_busaddr; - #endif + bus_addr_t request_msg_busaddr; + bus_addr_t reply_frame_busaddr; + bus_addr_t sg_frame_busaddr; /* ThunderBolt IOC Init Descriptor */ bus_dma_tag_t mfi_tb_ioc_init_dmat; bus_dmamap_t mfi_tb_ioc_init_dmamap; From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 18:53:52 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80996106564A; Wed, 16 Nov 2011 18:53:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 705908FC12; Wed, 16 Nov 2011 18:53:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGIrqFx062236; Wed, 16 Nov 2011 18:53:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGIrqSR062227; Wed, 16 Nov 2011 18:53:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201111161853.pAGIrqSR062227@svn.freebsd.org> From: John Baldwin Date: Wed, 16 Nov 2011 18:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227580 - projects/head_mfi/sys/dev/mfi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 18:53:52 -0000 Author: jhb Date: Wed Nov 16 18:53:52 2011 New Revision: 227580 URL: http://svn.freebsd.org/changeset/base/227580 Log: MFC: Add single-message MSI support to mfi(4). Reviewed by: ambrisko, delphij Modified: projects/head_mfi/sys/dev/mfi/mfi.c projects/head_mfi/sys/dev/mfi/mfi_cam.c projects/head_mfi/sys/dev/mfi/mfi_debug.c projects/head_mfi/sys/dev/mfi/mfi_disk.c projects/head_mfi/sys/dev/mfi/mfi_pci.c projects/head_mfi/sys/dev/mfi/mfi_syspd.c projects/head_mfi/sys/dev/mfi/mfi_tbolt.c projects/head_mfi/sys/dev/mfi/mfivar.h Modified: projects/head_mfi/sys/dev/mfi/mfi.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi.c Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfi.c Wed Nov 16 18:53:52 2011 (r227580) @@ -675,12 +675,6 @@ mfi_attach(struct mfi_softc *sc) if((error = mfi_tbolt_alloc_cmd(sc)) != 0) return error; - sc->mfi_irq_rid = 0; - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); - return (EINVAL); - } if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr_tbolt, sc, &sc->mfi_intr)) { device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); @@ -695,12 +689,6 @@ mfi_attach(struct mfi_softc *sc) if ((error = mfi_comms_init(sc)) != 0) return (error); - sc->mfi_irq_rid = 0; - if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, - &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); - return (EINVAL); - } if (bus_setup_intr(sc->mfi_dev, sc->mfi_irq, INTR_MPSAFE|INTR_TYPE_BIO, NULL, mfi_intr, sc, &sc->mfi_intr)) { device_printf(sc->mfi_dev, "Cannot set up interrupt\n"); Modified: projects/head_mfi/sys/dev/mfi/mfi_cam.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_cam.c Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfi_cam.c Wed Nov 16 18:53:52 2011 (r227580) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/head_mfi/sys/dev/mfi/mfi_debug.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_debug.c Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfi_debug.c Wed Nov 16 18:53:52 2011 (r227580) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: projects/head_mfi/sys/dev/mfi/mfi_disk.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_disk.c Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfi_disk.c Wed Nov 16 18:53:52 2011 (r227580) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/head_mfi/sys/dev/mfi/mfi_pci.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_pci.c Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfi_pci.c Wed Nov 16 18:53:52 2011 (r227580) @@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -107,6 +108,11 @@ static devclass_t mfi_devclass; DRIVER_MODULE(mfi, pci, mfi_pci_driver, mfi_devclass, 0, 0); MODULE_VERSION(mfi, 1); +static int mfi_msi = 0; +TUNABLE_INT("hw.mfi.msi", &mfi_msi); +SYSCTL_INT(_hw_mfi, OID_AUTO, msi, CTLFLAG_RDTUN, &mfi_msi, 0, + "Enable use of MSI interrupts"); + struct mfi_ident { uint16_t vendor; uint16_t device; @@ -175,7 +181,7 @@ mfi_pci_attach(device_t dev) struct mfi_softc *sc; struct mfi_ident *m; uint32_t command; - int error; + int count, error; sc = device_get_softc(dev); bzero(sc, sizeof(*sc)); @@ -235,6 +241,20 @@ mfi_pci_attach(device_t dev) goto out; } + /* Allocate IRQ resource. */ + sc->mfi_irq_rid = 0; + count = 1; + if (mfi_msi && pci_alloc_msi(sc->mfi_dev, &count) == 0) { + device_printf(sc->mfi_dev, "Using MSI\n"); + sc->mfi_irq_rid = 1; + } + if ((sc->mfi_irq = bus_alloc_resource_any(sc->mfi_dev, SYS_RES_IRQ, + &sc->mfi_irq_rid, RF_SHAREABLE | RF_ACTIVE)) == NULL) { + device_printf(sc->mfi_dev, "Cannot allocate interrupt\n"); + error = EINVAL; + goto out; + } + error = mfi_attach(sc); out: if (error) { @@ -318,6 +338,8 @@ mfi_pci_free(struct mfi_softc *sc) bus_release_resource(sc->mfi_dev, SYS_RES_MEMORY, sc->mfi_regs_rid, sc->mfi_regs_resource); } + if (sc->mfi_irq_rid != 0) + pci_release_msi(sc->mfi_dev); return; } Modified: projects/head_mfi/sys/dev/mfi/mfi_syspd.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_syspd.c Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfi_syspd.c Wed Nov 16 18:53:52 2011 (r227580) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_ #include #include #include +#include #include #include Modified: projects/head_mfi/sys/dev/mfi/mfi_tbolt.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_tbolt.c Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfi_tbolt.c Wed Nov 16 18:53:52 2011 (r227580) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD: src/sys/dev/mfi/mfi_ #include #include #include +#include #include #include Modified: projects/head_mfi/sys/dev/mfi/mfivar.h ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfivar.h Wed Nov 16 18:43:58 2011 (r227579) +++ projects/head_mfi/sys/dev/mfi/mfivar.h Wed Nov 16 18:53:52 2011 (r227580) @@ -568,6 +568,7 @@ mfi_print_sense(struct mfi_softc *sc, vo (sc)->mfi_bhandle, (reg)) MALLOC_DECLARE(M_MFIBUF); +SYSCTL_DECL(_hw_mfi); #define MFI_RESET_WAIT_TIME 180 #define MFI_CMD_TIMEOUT 30 From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 20:16:21 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFBBB106567E; Wed, 16 Nov 2011 20:16:21 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9E7048FC1D; Wed, 16 Nov 2011 20:16:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGKGLAU064971; Wed, 16 Nov 2011 20:16:21 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGKGLZR064967; Wed, 16 Nov 2011 20:16:21 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201111162016.pAGKGLZR064967@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 16 Nov 2011 20:16:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227583 - projects/jbuild/usr.bin/jbuild/filemon X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 20:16:21 -0000 Author: obrien Date: Wed Nov 16 20:16:21 2011 New Revision: 227583 URL: http://svn.freebsd.org/changeset/base/227583 Log: Support FreeBSD 9.0+. Catch up with r225617 ("sys_" syscall routine prefixing), and r224778 (capability mask argument to fget(9) and friends). Modified: projects/jbuild/usr.bin/jbuild/filemon/Makefile projects/jbuild/usr.bin/jbuild/filemon/filemon.c projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Modified: projects/jbuild/usr.bin/jbuild/filemon/Makefile ============================================================================== --- projects/jbuild/usr.bin/jbuild/filemon/Makefile Wed Nov 16 19:25:26 2011 (r227582) +++ projects/jbuild/usr.bin/jbuild/filemon/Makefile Wed Nov 16 20:16:21 2011 (r227583) @@ -1,8 +1,14 @@ # $FreeBSD$ +MAINTAINER= obrien@FreeBSD.org + KMOD= filemon -SRCS= filemon.c -SRCS+= vnode_if.h +SRCS= ${KMOD}.c +SRCS+= vnode_if.h opt_compat.h opt_capsicum.h + +.if ${MACHINE_ARCH} == "amd64" +CFLAGS= -DCOMPAT_IA32 +.endif SUBDIR= test Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon.c ============================================================================== --- projects/jbuild/usr.bin/jbuild/filemon/filemon.c Wed Nov 16 19:25:26 2011 (r227582) +++ projects/jbuild/usr.bin/jbuild/filemon/filemon.c Wed Nov 16 20:16:21 2011 (r227583) @@ -48,9 +48,13 @@ __FBSDID("$FreeBSD$"); #include #include +#if __FreeBSD_version >= 900041 +#include +#endif + #include "filemon.h" -#ifdef COMPAT_IA32 +#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) #include #include @@ -188,8 +192,12 @@ filemon_ioctl(struct cdev *dev, u_long c switch (cmd) { /* Set the output file descriptor. */ case FILEMON_SET_FD: - if ((error = fget_write(td, *((int *) data), - &filemon->fp)) == 0) +#if __FreeBSD_version < 900041 +#define FGET_WRITE(a1, a2, a3) fget_write((a1), (a2), (a3)) +#else +#define FGET_WRITE(a1, a2, a3) fget_write((a1), (a2), CAP_WRITE | CAP_SEEK, (a3)) +#endif + if ((error = FGET_WRITE(td, *(int *)data, &filemon->fp)) == 0) /* Write the file header. */ filemon_comment(filemon); break; Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c ============================================================================== --- projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Wed Nov 16 19:25:26 2011 (r227582) +++ projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Wed Nov 16 20:16:21 2011 (r227583) @@ -28,6 +28,25 @@ #include __FBSDID("$FreeBSD$"); +#if __FreeBSD_version < 900044 /* r225617 (2011-09-16) failed to bump + __FreeBSD_version. This really should + be based on "900045". "900044" is r225469 + (2011-09-10) so this code is broken for + 9-CURRENT September 10th-16th. */ +#define sys_chdir chdir +#define sys_fork fork +#define sys_link link +#define sys_open open +#define sys_rename rename +#define sys_symlink symlink +#define sys_unlink unlink +#define sys_vfork vfork +#define sys_sys_exit sys_exit +#ifdef FILEMON_HAS_LINKAT +#define sys_linkat linkat +#endif +#endif /* __FreeBSD_version */ + static void filemon_output(struct filemon *filemon, char *msg, size_t len) { @@ -105,7 +124,7 @@ filemon_wrapper_chdir(struct thread *td, size_t len; struct filemon *filemon; - if ((ret = chdir(td, uap)) == 0) { + if ((ret = sys_chdir(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -144,7 +163,7 @@ filemon_wrapper_execve(struct thread *td copyinstr(uap->fname, fname, sizeof(fname), &done); - if ((ret = execve(td, uap)) == 0) { + if ((ret = sys_execve(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -169,7 +188,7 @@ filemon_wrapper_execve(struct thread *td return (ret); } -#ifdef COMPAT_IA32 +#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) static int filemon_wrapper_freebsd32_execve(struct thread *td, struct freebsd32_execve_args *uap) @@ -215,7 +234,7 @@ filemon_wrapper_fork(struct thread *td, size_t len; struct filemon *filemon; - if ((ret = fork(td, uap)) == 0) { + if ((ret = sys_fork(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -248,7 +267,7 @@ filemon_wrapper_open(struct thread *td, size_t len; struct filemon *filemon; - if ((ret = open(td, uap)) == 0) { + if ((ret = sys_open(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -297,7 +316,7 @@ filemon_wrapper_rename(struct thread *td size_t len; struct filemon *filemon; - if ((ret = rename(td, uap)) == 0) { + if ((ret = sys_rename(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -335,7 +354,7 @@ filemon_wrapper_link(struct thread *td, size_t len; struct filemon *filemon; - if ((ret = link(td, uap)) == 0) { + if ((ret = sys_link(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -373,7 +392,7 @@ filemon_wrapper_symlink(struct thread *t size_t len; struct filemon *filemon; - if ((ret = symlink(td, uap)) == 0) { + if ((ret = sys_symlink(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -416,7 +435,7 @@ filemon_wrapper_linkat(struct thread *td size_t len; struct filemon *filemon; - if ((ret = linkat(td, uap)) == 0) { + if ((ret = sys_linkat(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -455,7 +474,7 @@ filemon_wrapper_stat(struct thread *td, size_t len; struct filemon *filemon; - if ((ret = stat(td, uap)) == 0) { + if ((ret = sys_stat(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -483,7 +502,7 @@ filemon_wrapper_stat(struct thread *td, return (ret); } -#ifdef COMPAT_IA32 +#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) static int filemon_wrapper_freebsd32_stat(struct thread *td, struct freebsd32_stat_args *uap) @@ -561,7 +580,7 @@ filemon_wrapper_sys_exit(struct thread * /* Release the read lock. */ filemon_unlock_read(); - sys_exit(td, uap); + sys_sys_exit(td, uap); } static int @@ -572,7 +591,7 @@ filemon_wrapper_unlink(struct thread *td size_t len; struct filemon *filemon; - if ((ret = unlink(td, uap)) == 0) { + if ((ret = sys_unlink(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -607,7 +626,7 @@ filemon_wrapper_vfork(struct thread *td, size_t len; struct filemon *filemon; - if ((ret = vfork(td, uap)) == 0) { + if ((ret = sys_vfork(td, uap)) == 0) { /* Grab a read lock on the filemon inuse list. */ filemon_lock_read(); @@ -658,7 +677,7 @@ filemon_wrapper_install(void) sv_table[SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; #endif -#ifdef COMPAT_IA32 +#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) sv_table = ia32_freebsd_sysvec.sv_table; sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; @@ -675,7 +694,7 @@ filemon_wrapper_install(void) #ifdef FILEMON_HAS_LINKAT sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; #endif -#endif /* COMPAT_IA32 */ +#endif /* COMPAT_ARCH32 */ } static void @@ -689,37 +708,37 @@ filemon_wrapper_deinstall(void) #error Machine type not supported #endif - sv_table[SYS_chdir].sy_call = (sy_call_t *) chdir; - sv_table[SYS_exit].sy_call = (sy_call_t *) sys_exit; - sv_table[SYS_execve].sy_call = (sy_call_t *) execve; - sv_table[SYS_fork].sy_call = (sy_call_t *) fork; - sv_table[SYS_open].sy_call = (sy_call_t *) open; - sv_table[SYS_rename].sy_call = (sy_call_t *) rename; - sv_table[SYS_stat].sy_call = (sy_call_t *) stat; - sv_table[SYS_unlink].sy_call = (sy_call_t *) unlink; - sv_table[SYS_vfork].sy_call = (sy_call_t *) vfork; - sv_table[SYS_link].sy_call = (sy_call_t *) link; - sv_table[SYS_symlink].sy_call = (sy_call_t *) symlink; + sv_table[SYS_chdir].sy_call = (sy_call_t *)sys_chdir; + sv_table[SYS_exit].sy_call = (sy_call_t *)sys_sys_exit; + sv_table[SYS_execve].sy_call = (sy_call_t *)sys_execve; + sv_table[SYS_fork].sy_call = (sy_call_t *)sys_fork; + sv_table[SYS_open].sy_call = (sy_call_t *)sys_open; + sv_table[SYS_rename].sy_call = (sy_call_t *)sys_rename; + sv_table[SYS_stat].sy_call = (sy_call_t *)sys_stat; + sv_table[SYS_unlink].sy_call = (sy_call_t *)sys_unlink; + sv_table[SYS_vfork].sy_call = (sy_call_t *)sys_vfork; + sv_table[SYS_link].sy_call = (sy_call_t *)sys_link; + sv_table[SYS_symlink].sy_call = (sy_call_t *)sys_symlink; #ifdef FILEMON_HAS_LINKAT - sv_table[SYS_linkat].sy_call = (sy_call_t *) linkat; + sv_table[SYS_linkat].sy_call = (sy_call_t *)sys_linkat; #endif -#ifdef COMPAT_IA32 +#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) sv_table = ia32_freebsd_sysvec.sv_table; - sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *) chdir; - sv_table[FREEBSD32_SYS_exit].sy_call = (sy_call_t *) sys_exit; + sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *)sys_chdir; + sv_table[FREEBSD32_SYS_exit].sy_call = (sy_call_t *)sys_sys_exit; sv_table[FREEBSD32_SYS_freebsd32_execve].sy_call = (sy_call_t *)freebsd32_execve; - sv_table[FREEBSD32_SYS_fork].sy_call = (sy_call_t *) fork; - sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *) open; - sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) rename; - sv_table[FREEBSD32_SYS_freebsd32_stat].sy_call = (sy_call_t *) freebsd32_stat; - sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) unlink; - sv_table[FREEBSD32_SYS_vfork].sy_call = (sy_call_t *) vfork; - sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *) link; - sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *) symlink; + sv_table[FREEBSD32_SYS_fork].sy_call = (sy_call_t *)sys_fork; + sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *)sys_open; + sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *)sys_rename; + sv_table[FREEBSD32_SYS_freebsd32_stat].sy_call = (sy_call_t *)freebsd32_stat; + sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *)sys_unlink; + sv_table[FREEBSD32_SYS_vfork].sy_call = (sy_call_t *)sys_vfork; + sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *)sys_link; + sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *)sys_symlink; #ifdef FILEMON_HAS_LINKAT - sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) linkat; + sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *)sys_linkat; #endif -#endif /* COMPAT_IA32 */ +#endif /* COMPAT_ARCH32 */ } From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 20:17:27 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21967106564A; Wed, 16 Nov 2011 20:17:27 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC2ED8FC0A; Wed, 16 Nov 2011 20:17:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGKHQXt065039; Wed, 16 Nov 2011 20:17:26 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGKHQbN065036; Wed, 16 Nov 2011 20:17:26 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201111162017.pAGKHQbN065036@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 16 Nov 2011 20:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227584 - projects/jbuild/usr.bin/jbuild/filemon X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 20:17:27 -0000 Author: obrien Date: Wed Nov 16 20:17:26 2011 New Revision: 227584 URL: http://svn.freebsd.org/changeset/base/227584 Log: KNF. Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon.c projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon.c ============================================================================== --- projects/jbuild/usr.bin/jbuild/filemon/filemon.c Wed Nov 16 20:16:21 2011 (r227583) +++ projects/jbuild/usr.bin/jbuild/filemon/filemon.c Wed Nov 16 20:17:26 2011 (r227584) @@ -82,21 +82,17 @@ MALLOC_DECLARE(M_FILEMON); MALLOC_DEFINE(M_FILEMON, "filemon", "File access monitor"); struct filemon { - pid_t pid; /* The process ID being monitored. */ - char fname1[MAXPATHLEN]; /* Temporary filename buffer. */ - char fname2[MAXPATHLEN]; /* Temporary filename buffer. */ - char msgbufr[1024]; /* Output message buffer. */ - struct file - *fp; /* Output file pointer. */ - struct thread - *locker; /* Ptr to the thread locking this */ - /* filemon.*/ - struct mtx - mtx; /* Lock mutex for this filemon. */ - struct cv - cv; /* Lock condition variable for this */ - /* filemon. */ TAILQ_ENTRY(filemon) link; /* Link into the in-use list. */ + struct mtx mtx; /* Lock mutex for this filemon. */ + struct cv cv; /* Lock condition variable for this + filemon. */ + struct file *fp; /* Output file pointer. */ + struct thread *locker; /* Ptr to the thread locking this + filemon. */ + pid_t pid; /* The process ID being monitored. */ + char fname1[MAXPATHLEN]; /* Temporary filename buffer. */ + char fname2[MAXPATHLEN]; /* Temporary filename buffer. */ + char msgbufr[1024]; /* Output message buffer. */ }; static TAILQ_HEAD(, filemon) filemons_inuse = TAILQ_HEAD_INITIALIZER(filemons_inuse); Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c ============================================================================== --- projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Wed Nov 16 20:16:21 2011 (r227583) +++ projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Wed Nov 16 20:17:26 2011 (r227584) @@ -83,7 +83,7 @@ filemon_pid_check(struct proc *p) if (p->p_pptr == NULL) return (NULL); - + return (filemon_pid_check(p->p_pptr)); } From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 20:18:25 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A529D106566C; Wed, 16 Nov 2011 20:18:25 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 952288FC13; Wed, 16 Nov 2011 20:18:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGKIPnt065115; Wed, 16 Nov 2011 20:18:25 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGKIP1w065113; Wed, 16 Nov 2011 20:18:25 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201111162018.pAGKIP1w065113@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 16 Nov 2011 20:18:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227585 - projects/jbuild/usr.bin/jbuild/filemon/test X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 20:18:25 -0000 Author: obrien Date: Wed Nov 16 20:18:25 2011 New Revision: 227585 URL: http://svn.freebsd.org/changeset/base/227585 Log: * Don't need to add -Werror, WARNS does that. * Avoid needless exec. Modified: projects/jbuild/usr.bin/jbuild/filemon/test/Makefile Modified: projects/jbuild/usr.bin/jbuild/filemon/test/Makefile ============================================================================== --- projects/jbuild/usr.bin/jbuild/filemon/test/Makefile Wed Nov 16 20:17:26 2011 (r227584) +++ projects/jbuild/usr.bin/jbuild/filemon/test/Makefile Wed Nov 16 20:18:25 2011 (r227585) @@ -5,11 +5,10 @@ PROG= filemontest NO_MAN= WARNS?= 6 -CFLAGS= -Werror CFLAGS+= -I${.CURDIR}/.. -test: ${PROG} - @cd ${.CURDIR} ; ${MAKE} clean-test +# Cannot use .OBJDIR -- 'filemontest' expects 'test_script.sh' in . +test: ${PROG} clean-test cd ${.CURDIR} ; \ for A in 1 2 3 4 5 6 7 8 9 0; do \ for B in 1 2 3 4 5 6 7 8 9 0; do \ From owner-svn-src-projects@FreeBSD.ORG Wed Nov 16 22:14:13 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C11C1065670; Wed, 16 Nov 2011 22:14:13 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5C0868FC14; Wed, 16 Nov 2011 22:14:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGMEDMG069025; Wed, 16 Nov 2011 22:14:13 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGMEDk4069023; Wed, 16 Nov 2011 22:14:13 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201111162214.pAGMEDk4069023@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 16 Nov 2011 22:14:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227592 - projects/jbuild/usr.bin/jbuild/filemon X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 22:14:13 -0000 Author: obrien Date: Wed Nov 16 22:14:13 2011 New Revision: 227592 URL: http://svn.freebsd.org/changeset/base/227592 Log: Additional 8.x compatibility. Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Modified: projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c ============================================================================== --- projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Wed Nov 16 22:09:14 2011 (r227591) +++ projects/jbuild/usr.bin/jbuild/filemon/filemon_wrapper.c Wed Nov 16 22:14:13 2011 (r227592) @@ -28,16 +28,22 @@ #include __FBSDID("$FreeBSD$"); +#if __FreeBSD_version > 800032 +#define FILEMON_HAS_LINKAT +#endif + #if __FreeBSD_version < 900044 /* r225617 (2011-09-16) failed to bump __FreeBSD_version. This really should be based on "900045". "900044" is r225469 (2011-09-10) so this code is broken for 9-CURRENT September 10th-16th. */ #define sys_chdir chdir +#define sys_execve execve #define sys_fork fork #define sys_link link #define sys_open open #define sys_rename rename +#define sys_stat stat #define sys_symlink symlink #define sys_unlink unlink #define sys_vfork vfork @@ -422,10 +428,6 @@ filemon_wrapper_symlink(struct thread *t return (ret); } -#if __FreeBSD_version > 800032 -#define FILEMON_HAS_LINKAT -#endif - #ifdef FILEMON_HAS_LINKAT static int filemon_wrapper_linkat(struct thread *td, struct linkat_args *uap) From owner-svn-src-projects@FreeBSD.ORG Thu Nov 17 03:34:49 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1FED2106564A; Thu, 17 Nov 2011 03:34:49 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EB0DE8FC16; Thu, 17 Nov 2011 03:34:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAH3Ym9d079779; Thu, 17 Nov 2011 03:34:48 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAH3Ymi0079777; Thu, 17 Nov 2011 03:34:48 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201111170334.pAH3Ymi0079777@svn.freebsd.org> From: Mark Linimon Date: Thu, 17 Nov 2011 03:34:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227605 - projects/portbuild/scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 03:34:49 -0000 Author: linimon (doc,ports committer) Date: Thu Nov 17 03:34:48 2011 New Revision: 227605 URL: http://svn.freebsd.org/changeset/base/227605 Log: Automatically add new src branches after they are created. While here, improve error handling and make more verbose. Modified: projects/portbuild/scripts/updatesnap Modified: projects/portbuild/scripts/updatesnap ============================================================================== --- projects/portbuild/scripts/updatesnap Thu Nov 17 01:43:50 2011 (r227604) +++ projects/portbuild/scripts/updatesnap Thu Nov 17 03:34:48 2011 (r227605) @@ -36,22 +36,37 @@ echo "Started at $(date)" # We need to preserve group writability so portmgr group can write umask 002 -# for branch in 8; do for branch in $SRC_BRANCHES; do - cd ${base}${branch} + mountpoint=${base}${branch} + if [ ! -d ${mountpoint}/src ]; then + mkdir -p ${mountpoint} + echo "zfs create -o mountpoint=${mountpoint} ${zbase}${branch}" + zfs create -o mountpoint=${mountpoint} ${zbase}${branch} + mkdir -p ${mountpoint}/src + echo "zfs create -o mountpoint=${mountpoint}/src ${zbase}${branch}/src" + zfs create -o mountpoint=${mountpoint}/src ${zbase}${branch}/src + chown -R portmgr:portmgr ${mountpoint} + chmod -R g+w ${mountpoint} + fi + cd ${mountpoint} fulldate=$(date) supdate=$(supstamp ${fulldate}) eval tag=\$SRC_BRANCH_${branch}_TAG - cat ${SRC_MASTER_SUPFILE} | \ - sed "s|%%DATE%%|${supdate}|;s|%%PREFIX%%|${base}${branch}|;s|%%TAG%%|${tag}|" \ - > ${SRC_SUPFILE}.${branch}.now - # example destination directory: /a/snap/src-6/src/ (tricky!) - csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log - echo ${fulldate} > src/.updated - # hack for zfs breakiness - find . -group wheel|xargs chgrp portmgr - snapdate=$(stamp ${fulldate}) - zfs snapshot ${zbase}${branch}/src@${snapdate} + if [ ! -f ${SRC_MASTER_SUPFILE} ]; then + echo "${SRC_MASTER_SUPFILE} does not exist!" + else + sed "s|%%DATE%%|${supdate}|;s|%%PREFIX%%|${mountpoint}|;s|%%TAG%%|${tag}|" \ + ${SRC_MASTER_SUPFILE} > ${SRC_SUPFILE}.${branch}.now + # example destination directory: /a/snap/src-7/src/ (tricky!) + echo "csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log" + csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log + echo ${fulldate} > src/.updated + # hack for zfs breakiness + find . -group wheel|xargs chgrp portmgr + snapdate=$(stamp ${fulldate}) + echo "zfs snapshot ${zbase}${branch}/src@${snapdate}" + zfs snapshot ${zbase}${branch}/src@${snapdate} + fi done finish 0 From owner-svn-src-projects@FreeBSD.ORG Thu Nov 17 08:57:39 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E188A1065670; Thu, 17 Nov 2011 08:57:39 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D1C738FC18; Thu, 17 Nov 2011 08:57:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAH8vdWC090373; Thu, 17 Nov 2011 08:57:39 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAH8vdjR090371; Thu, 17 Nov 2011 08:57:39 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201111170857.pAH8vdjR090371@svn.freebsd.org> From: Xin LI Date: Thu, 17 Nov 2011 08:57:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227609 - projects/zfsd/head/etc/rc.d X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 08:57:40 -0000 Author: delphij Date: Thu Nov 17 08:57:39 2011 New Revision: 227609 URL: http://svn.freebsd.org/changeset/base/227609 Log: Install zfsd rc.d script. Modified: projects/zfsd/head/etc/rc.d/Makefile Modified: projects/zfsd/head/etc/rc.d/Makefile ============================================================================== --- projects/zfsd/head/etc/rc.d/Makefile Thu Nov 17 08:12:12 2011 (r227608) +++ projects/zfsd/head/etc/rc.d/Makefile Thu Nov 17 08:57:39 2011 (r227609) @@ -40,7 +40,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKI watchdogd wpa_supplicant \ ypbind yppasswdd ypserv \ ypset ypupdated ypxfrd \ - zfs zvol + zfs zfsd zvol .if ${MK_IPX} != "no" FILES+= ipxrouted From owner-svn-src-projects@FreeBSD.ORG Thu Nov 17 11:47:20 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 235B9106564A; Thu, 17 Nov 2011 11:47:20 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1289A8FC12; Thu, 17 Nov 2011 11:47:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAHBlK0c004357; Thu, 17 Nov 2011 11:47:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAHBlJYx004352; Thu, 17 Nov 2011 11:47:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201111171147.pAHBlJYx004352@svn.freebsd.org> From: Alexander Motin Date: Thu, 17 Nov 2011 11:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227612 - projects/head_mfi/sys/dev/mfi X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 11:47:20 -0000 Author: mav Date: Thu Nov 17 11:47:19 2011 New Revision: 227612 URL: http://svn.freebsd.org/changeset/base/227612 Log: Use bus_addr_t in more places. Remove most of "#ifdef __amd64__". Modified: projects/head_mfi/sys/dev/mfi/mfi.c projects/head_mfi/sys/dev/mfi/mfi_ioctl.h projects/head_mfi/sys/dev/mfi/mfi_tbolt.c projects/head_mfi/sys/dev/mfi/mfivar.h Modified: projects/head_mfi/sys/dev/mfi/mfi.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi.c Thu Nov 17 11:16:56 2011 (r227611) +++ projects/head_mfi/sys/dev/mfi/mfi.c Thu Nov 17 11:47:19 2011 (r227612) @@ -53,6 +53,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" #include "opt_mfi.h" #include @@ -117,8 +118,10 @@ static int32_t mfi_read_fw_status_xscale static int32_t mfi_read_fw_status_ppc(struct mfi_softc *sc); static int mfi_check_clear_intr_xscale(struct mfi_softc *sc); static int mfi_check_clear_intr_ppc(struct mfi_softc *sc); -static void mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add,uint32_t frame_cnt); -static void mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add,uint32_t frame_cnt); +static void mfi_issue_cmd_xscale(struct mfi_softc *sc, bus_addr_t bus_add, + uint32_t frame_cnt); +static void mfi_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, + uint32_t frame_cnt); static int mfi_config_lock(struct mfi_softc *sc, uint32_t opcode); static void mfi_config_unlock(struct mfi_softc *sc, int locked); static int mfi_check_command_pre(struct mfi_softc *sc, struct mfi_command *cm); @@ -1973,13 +1976,8 @@ mfi_build_syspdio(struct mfi_softc *sc,s pass->header.sense_len = MFI_SENSE_LEN; pass->header.data_len = bio->bio_bcount; pass->header.cdb_len = 10; - #if defined(__amd64__) - pass->sense_addr_lo = (cm->cm_sense_busaddr & 0xFFFFFFFF); - pass->sense_addr_hi = (cm->cm_sense_busaddr & 0xFFFFFFFF00000000) >> 32; - #else - pass->sense_addr_lo = cm->cm_sense_busaddr; - pass->sense_addr_hi = 0; - #endif + pass->sense_addr_lo = (uint32_t)cm->cm_sense_busaddr; + pass->sense_addr_hi = (uint32_t)((uint64_t)cm->cm_sense_busaddr >> 32); cm->cm_complete = mfi_bio_complete; cm->cm_private = bio; cm->cm_data = bio->bio_data; @@ -2027,13 +2025,8 @@ mfi_build_ldio(struct mfi_softc *sc,stru io->header.scsi_status = 0; io->header.sense_len = MFI_SENSE_LEN; io->header.data_len = blkcount; - #if defined(__amd64__) - io->sense_addr_lo = (cm->cm_sense_busaddr & 0xFFFFFFFF); - io->sense_addr_hi = (cm->cm_sense_busaddr & 0xFFFFFFFF00000000 ) >> 32; - #else - io->sense_addr_lo = cm->cm_sense_busaddr; - io->sense_addr_hi = 0; - #endif + io->sense_addr_lo = (uint32_t)cm->cm_sense_busaddr; + io->sense_addr_hi = (uint32_t)((uint64_t)cm->cm_sense_busaddr >> 32); io->lba_hi = (bio->bio_pblkno & 0xffffffff00000000) >> 32; io->lba_lo = bio->bio_pblkno & 0xffffffff; cm->cm_complete = mfi_bio_complete; @@ -2335,13 +2328,9 @@ mfi_abort(struct mfi_softc *sc, struct m abort->header.flags = 0; abort->header.scsi_status = 0; abort->abort_context = cm_abort->cm_frame->header.context; - #if defined(__amd64__) - abort->abort_mfi_addr_lo = cm_abort->cm_frame_busaddr & 0xFFFFFFFF; - abort->abort_mfi_addr_hi = (cm_abort->cm_frame_busaddr & 0xFFFFFFFF00000000 ) >> 32 ; - #else - abort->abort_mfi_addr_lo = cm_abort->cm_frame_busaddr; - abort->abort_mfi_addr_hi = 0; - #endif + abort->abort_mfi_addr_lo = (uint32_t)cm_abort->cm_frame_busaddr; + abort->abort_mfi_addr_hi = + (uint32_t)((uint64_t)cm_abort->cm_frame_busaddr >> 32); cm->cm_data = NULL; cm->cm_flags = MFI_CMD_POLLED; @@ -2382,13 +2371,8 @@ mfi_dump_blocks(struct mfi_softc *sc, in io->header.scsi_status = 0; io->header.sense_len = MFI_SENSE_LEN; io->header.data_len = (len + MFI_SECTOR_LEN - 1) / MFI_SECTOR_LEN; - #if defined(__amd64__) - io->sense_addr_lo = (cm->cm_sense_busaddr & 0xFFFFFFFF); - io->sense_addr_hi = (cm->cm_sense_busaddr & 0xFFFFFFFF00000000) >> 32; - #else - io->sense_addr_lo = cm->cm_sense_busaddr; - io->sense_addr_hi = 0; - #endif + io->sense_addr_lo = (uint32_t)cm->cm_sense_busaddr; + io->sense_addr_hi = (uint32_t)((uint64_t)cm->cm_sense_busaddr >> 32); io->lba_hi = (lba & 0xffffffff00000000) >> 32; io->lba_lo = lba & 0xffffffff; cm->cm_data = virt; @@ -2435,13 +2419,8 @@ mfi_dump_syspd_blocks(struct mfi_softc * pass->header.sense_len = MFI_SENSE_LEN; pass->header.data_len = len; pass->header.cdb_len = 10; - #if defined(__amd64__) - pass->sense_addr_lo = (cm->cm_sense_busaddr & 0xFFFFFFFF); - pass->sense_addr_hi = (cm->cm_sense_busaddr & 0xFFFFFFFF00000000) >> 32; - #else - pass->sense_addr_lo = cm->cm_sense_busaddr; - pass->sense_addr_hi = 0; - #endif + pass->sense_addr_lo = (uint32_t)cm->cm_sense_busaddr; + pass->sense_addr_hi = (uint32_t)((uint64_t)cm->cm_sense_busaddr >> 32); cm->cm_data = virt; cm->cm_len = len; cm->cm_sg = &pass->sgl; @@ -2774,12 +2753,6 @@ mfi_stp_cmd(struct mfi_softc *sc, struct return 0; } -#ifdef __amd64__ -#define PTRIN(p) ((void *)(uintptr_t)(p)) -#else -#define PTRIN(p) (p) -#endif - static int mfi_user_command(struct mfi_softc *sc, struct mfi_ioc_passthru *ioc) { @@ -2848,11 +2821,7 @@ out: return (error); } -#ifdef __amd64__ #define PTRIN(p) ((void *)(uintptr_t)(p)) -#else -#define PTRIN(p) (p) -#endif static int mfi_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) @@ -2860,7 +2829,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, struct mfi_softc *sc; union mfi_statrequest *ms; struct mfi_ioc_packet *ioc; -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 struct mfi_ioc_packet32 *ioc32; #endif struct mfi_ioc_aen *aen; @@ -2871,7 +2840,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, size_t len; int i, res; struct mfi_ioc_passthru *iop = (struct mfi_ioc_passthru *)arg; -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 struct mfi_ioc_passthru32 *iop32 = (struct mfi_ioc_passthru32 *)arg; struct mfi_ioc_passthru iop_swab; #endif @@ -2930,7 +2899,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, break; } case MFI_CMD: -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 case MFI_CMD32: #endif { @@ -2979,12 +2948,12 @@ mfi_ioctl(struct cdev *dev, u_long cmd, cm->cm_flags |= MFI_CMD_DATAIN | MFI_CMD_DATAOUT; cm->cm_len = cm->cm_frame->header.data_len; if (cm->cm_frame->header.cmd == MFI_CMD_STP) { -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 if (cmd == MFI_CMD) { #endif /* Native */ cm->cm_stp_len = ioc->mfi_sgl[0].iov_len; -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 } else { /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; @@ -3017,13 +2986,13 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if ((cm->cm_flags & MFI_CMD_DATAOUT) || (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 if (cmd == MFI_CMD) { #endif /* Native */ addr = ioc->mfi_sgl[i].iov_base; len = ioc->mfi_sgl[i].iov_len; -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 } else { /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; @@ -3046,13 +3015,10 @@ mfi_ioctl(struct cdev *dev, u_long cmd, locked = mfi_config_lock(sc, cm->cm_frame->dcmd.opcode); if (cm->cm_frame->header.cmd == MFI_CMD_PD_SCSI_IO) { - #if defined(__amd64__) - cm->cm_frame->pass.sense_addr_lo = (cm->cm_sense_busaddr & 0xFFFFFFFF); - cm->cm_frame->pass.sense_addr_hi = (cm->cm_sense_busaddr& 0xFFFFFFFF00000000) >> 32; - #else - cm->cm_frame->pass.sense_addr_lo = cm->cm_sense_busaddr; - cm->cm_frame->pass.sense_addr_hi = 0; - #endif + cm->cm_frame->pass.sense_addr_lo = + (uint32_t)cm->cm_sense_busaddr; + cm->cm_frame->pass.sense_addr_hi = + (uint32_t)((uint64_t)cm->cm_sense_busaddr >> 32); } mtx_lock(&sc->mfi_io_lock); skip_pre_post = mfi_check_for_sscd (sc, cm); @@ -3079,13 +3045,13 @@ mfi_ioctl(struct cdev *dev, u_long cmd, if ((cm->cm_flags & MFI_CMD_DATAIN) || (cm->cm_frame->header.cmd == MFI_CMD_STP)) { for (i = 0; i < ioc->mfi_sge_count; i++) { -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 if (cmd == MFI_CMD) { #endif /* Native */ addr = ioc->mfi_sgl[i].iov_base; len = ioc->mfi_sgl[i].iov_len; -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 } else { /* 32bit on 64bit */ ioc32 = (struct mfi_ioc_packet32 *)ioc; @@ -3109,7 +3075,7 @@ mfi_ioctl(struct cdev *dev, u_long cmd, bcopy(&ioc->mfi_frame.raw[ioc->mfi_sense_off], &sense_ptr.sense_ptr_data[0], sizeof(sense_ptr.sense_ptr_data)); -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 if (cmd != MFI_CMD) { /* * not 64bit native so zero out any address @@ -3202,7 +3168,7 @@ out: cmd, arg, flag, td)); break; } -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 case MFIIO_PASSTHRU32: iop_swab.ioc_frame = iop32->ioc_frame; iop_swab.buf_size = iop32->buf_size; @@ -3212,7 +3178,7 @@ out: #endif case MFIIO_PASSTHRU: error = mfi_user_command(sc, iop); -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 if (cmd == MFIIO_PASSTHRU32) iop32->ioc_frame = iop_swab.ioc_frame; #endif @@ -3315,13 +3281,10 @@ mfi_linux_ioctl_int(struct cdev *dev, u_ locked = mfi_config_lock(sc, cm->cm_frame->dcmd.opcode); if (cm->cm_frame->header.cmd == MFI_CMD_PD_SCSI_IO) { - #if defined(__amd64__) - cm->cm_frame->pass.sense_addr_lo = (cm->cm_sense_busaddr & 0xFFFFFFFF); - cm->cm_frame->pass.sense_addr_hi = (cm->cm_sense_busaddr & 0xFFFFFFFF00000000) >> 32; - #else - cm->cm_frame->pass.sense_addr_lo = cm->cm_sense_busaddr; - cm->cm_frame->pass.sense_addr_hi = 0; - #endif + cm->cm_frame->pass.sense_addr_lo = + (uint32_t)cm->cm_sense_busaddr; + cm->cm_frame->pass.sense_addr_hi = + (uint32_t)((uint64_t)cm->cm_sense_busaddr >> 32); } mtx_lock(&sc->mfi_io_lock); Modified: projects/head_mfi/sys/dev/mfi/mfi_ioctl.h ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_ioctl.h Thu Nov 17 11:16:56 2011 (r227611) +++ projects/head_mfi/sys/dev/mfi/mfi_ioctl.h Thu Nov 17 11:47:19 2011 (r227612) @@ -30,12 +30,10 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__amd64__) /* Assume amd64 wants 32 bit Linux */ struct iovec32 { u_int32_t iov_base; int iov_len; }; -#endif struct megasas_sge { @@ -86,7 +84,7 @@ struct mfi_ioc_packet { struct iovec mfi_sgl[MAX_IOCTL_SGE]; } __packed; -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 struct mfi_ioc_packet32 { uint16_t mfi_adapter_no; uint16_t mfi_pad1; @@ -111,7 +109,7 @@ struct mfi_ioc_aen { } __packed; #define MFI_CMD _IOWR('M', 1, struct mfi_ioc_packet) -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 #define MFI_CMD32 _IOWR('M', 1, struct mfi_ioc_packet32) #endif #define MFI_SET_AEN _IOW('M', 3, struct mfi_ioc_aen) @@ -143,7 +141,7 @@ struct mfi_ioc_passthru { uint8_t *buf; } __packed; -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 struct mfi_ioc_passthru32 { struct mfi_dcmd_frame ioc_frame; uint32_t buf_size; @@ -153,7 +151,7 @@ struct mfi_ioc_passthru32 { #define MFIIO_STATS _IOWR('Q', 101, union mfi_statrequest) #define MFIIO_PASSTHRU _IOWR('C', 102, struct mfi_ioc_passthru) -#ifdef __amd64__ +#ifdef COMPAT_FREEBSD32 #define MFIIO_PASSTHRU32 _IOWR('C', 102, struct mfi_ioc_passthru32) #endif Modified: projects/head_mfi/sys/dev/mfi/mfi_tbolt.c ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfi_tbolt.c Thu Nov 17 11:16:56 2011 (r227611) +++ projects/head_mfi/sys/dev/mfi/mfi_tbolt.c Thu Nov 17 11:47:19 2011 (r227612) @@ -134,13 +134,13 @@ mfi_tbolt_check_clear_intr_ppc(struct mf void -mfi_tbolt_issue_cmd_ppc(struct mfi_softc *sc, uintptr_t bus_add, +mfi_tbolt_issue_cmd_ppc(struct mfi_softc *sc, bus_addr_t bus_add, uint32_t frame_cnt) { bus_add |= (MFI_REQ_DESCRIPT_FLAGS_MFA << MFI_REQ_DESCRIPT_FLAGS_TYPE_SHIFT); - MFI_WRITE4(sc, MFI_IQPL, bus_add); - MFI_WRITE4(sc, MFI_IQPH, 0x00000000); + MFI_WRITE4(sc, MFI_IQPL, (uint32_t)bus_add); + MFI_WRITE4(sc, MFI_IQPH, (uint32_t)((uint64_t)bus_add >> 32)); } /** @@ -348,7 +348,7 @@ mfi_tbolt_init_MFI_queue(struct mfi_soft struct MPI2_IOC_INIT_REQUEST *mpi2IocInit; struct mfi_init_frame *mfi_init; uintptr_t offset = 0; - uintptr_t phyAddress; + bus_addr_t phyAddress; MFI_ADDRESS *mfiAddressTemp; struct mfi_command *cm; int error; @@ -395,48 +395,29 @@ mfi_tbolt_init_MFI_queue(struct mfi_soft phyAddress = sc->mfi_tb_busaddr + offset; mfiAddressTemp = (MFI_ADDRESS *)&mpi2IocInit->ReplyDescriptorPostQueueAddress; -#if defined(__amd64__) - mfiAddressTemp->u.addressLow = (phyAddress & 0xFFFFFFFF); - mfiAddressTemp->u.addressHigh = (phyAddress & 0xFFFFFFFF00000000) >> 32; -#else - mfiAddressTemp->u.addressLow = phyAddress & 0xFFFFFFFF; - mfiAddressTemp->u.addressHigh = 0; -#endif + mfiAddressTemp->u.addressLow = (uint32_t)phyAddress; + mfiAddressTemp->u.addressHigh = (uint32_t)((uint64_t)phyAddress >> 32); /* Get physical address of request message pool */ offset = sc->request_message_pool_align - sc->request_message_pool; phyAddress = sc->mfi_tb_busaddr + offset; mfiAddressTemp = (MFI_ADDRESS *)&mpi2IocInit->SystemRequestFrameBaseAddress; -#if defined(__amd64__) - mfiAddressTemp->u.addressLow = (phyAddress & 0xFFFFFFFF); - mfiAddressTemp->u.addressHigh = (phyAddress & 0xFFFFFFFF00000000) >> 32; -#else - mfiAddressTemp->u.addressLow = phyAddress & 0xFFFFFFFF; - mfiAddressTemp->u.addressHigh = 0; /* High Part */ -#endif + mfiAddressTemp->u.addressLow = (uint32_t)phyAddress; + mfiAddressTemp->u.addressHigh = (uint32_t)((uint64_t)phyAddress >> 32); mpi2IocInit->ReplyFreeQueueAddress = 0; // Not supported by MR. mpi2IocInit->TimeStamp = time_uptime; if (sc->verbuf) { snprintf((char *)sc->verbuf, strlen(MEGASAS_VERSION) + 2, "%s\n", MEGASAS_VERSION); -#if defined(__amd64__) - mfi_init->driver_ver_lo = (sc->verbuf_h_busaddr & 0xFFFFFFFF); - mfi_init->driver_ver_hi = (sc->verbuf_h_busaddr & 0xFFFFFFFF00000000) >> 32; -#else - mfi_init->driver_ver_lo = sc->verbuf_h_busaddr; - mfi_init->driver_ver_hi = 0; -#endif + mfi_init->driver_ver_lo = (uint32_t)sc->verbuf_h_busaddr; + mfi_init->driver_ver_hi = + (uint32_t)((uint64_t)sc->verbuf_h_busaddr >> 32); } /* Get the physical address of the mpi2 ioc init command */ phyAddress = sc->mfi_tb_ioc_init_busaddr; -#if defined(__amd64__) - mfi_init->qinfo_new_addr_lo = (phyAddress & 0xFFFFFFFF); - mfi_init->qinfo_new_addr_hi = (phyAddress & 0xFFFFFFFF00000000) >> 32; -#else - mfi_init->qinfo_new_addr_lo = phyAddress & 0xFFFFFFFF; - mfi_init->qinfo_new_addr_hi = 0; -#endif + mfi_init->qinfo_new_addr_lo = (uint32_t)phyAddress; + mfi_init->qinfo_new_addr_hi = (uint32_t)((uint64_t)phyAddress >> 32); mfi_init->header.flags |= MFI_FRAME_DONT_POST_IN_REPLY_QUEUE; mfi_init->header.cmd = MFI_CMD_INIT; @@ -472,9 +453,9 @@ mfi_tbolt_init_MFI_queue(struct mfi_soft int mfi_tbolt_alloc_cmd(struct mfi_softc *sc) { struct mfi_cmd_tbolt *cmd; - uint32_t io_req_base_phys, offset = 0; + bus_addr_t io_req_base_phys; uint8_t *io_req_base; - uint16_t i = 0, j = 0; + int i = 0, j = 0, offset = 0; /* * sc->mfi_cmd_pool_tbolt is an array of struct mfi_cmd_tbolt pointers. @@ -1080,7 +1061,6 @@ mfi_tbolt_make_sgl(struct mfi_softc *sc, uint8_t i, sg_processed,sg_to_process; uint8_t sge_count, sge_idx; union mfi_sgl *os_sgl; - uint64_t tmp = ~0x00; /* * Return 0 if there is no data transfer @@ -1121,7 +1101,7 @@ mfi_tbolt_make_sgl(struct mfi_softc *sc, sgl_ptr->Address = os_sgl->sg_skinny[i].addr; } else { sgl_ptr->Length = os_sgl->sg32[i].len; - sgl_ptr->Address = os_sgl->sg32[i].addr & tmp; + sgl_ptr->Address = os_sgl->sg32[i].addr; } sgl_ptr->Flags = 0; sgl_ptr++; @@ -1142,18 +1122,15 @@ mfi_tbolt_make_sgl(struct mfi_softc *sc, MPI2_IEEE_SGE_FLAGS_IOCPLBNTA_ADDR); sg_chain->Length = (sizeof(MPI2_SGE_IO_UNION) * (sge_count - sg_processed)); - sg_chain->Address = ((uintptr_t)cmd->sg_frame_phys_addr) & tmp; + sg_chain->Address = cmd->sg_frame_phys_addr; sgl_ptr = (pMpi25IeeeSgeChain64_t)cmd->sg_frame; for (; i < sge_count; i++) { if (sc->mfi_flags & MFI_FLAGS_SKINNY) { sgl_ptr->Length = os_sgl->sg_skinny[i].len; sgl_ptr->Address = os_sgl->sg_skinny[i].addr; - } - else - { + } else { sgl_ptr->Length = os_sgl->sg32[i].len; - sgl_ptr->Address = (os_sgl->sg32[i].addr) & - tmp; + sgl_ptr->Address = os_sgl->sg32[i].addr; } sgl_ptr->Flags = 0; sgl_ptr++; Modified: projects/head_mfi/sys/dev/mfi/mfivar.h ============================================================================== --- projects/head_mfi/sys/dev/mfi/mfivar.h Thu Nov 17 11:16:56 2011 (r227611) +++ projects/head_mfi/sys/dev/mfi/mfivar.h Thu Nov 17 11:47:19 2011 (r227612) @@ -365,9 +365,9 @@ union desc_value { struct mfi_cmd_tbolt { union mfi_mpi2_request_descriptor *request_desc; struct mfi_mpi2_request_raid_scsi_io *io_request; - uintptr_t io_request_phys_addr; - uintptr_t sg_frame_phys_addr; - uintptr_t sense_phys_addr; + bus_addr_t io_request_phys_addr; + bus_addr_t sg_frame_phys_addr; + bus_addr_t sense_phys_addr; MPI2_SGE_IO_UNION *sg_frame; uint8_t *sense; TAILQ_ENTRY(mfi_cmd_tbolt) next; @@ -401,7 +401,7 @@ extern void mfi_tbolt_enable_intr_ppc(st extern void mfi_tbolt_disable_intr_ppc(struct mfi_softc *); extern int32_t mfi_tbolt_read_fw_status_ppc(struct mfi_softc *); extern int32_t mfi_tbolt_check_clear_intr_ppc(struct mfi_softc *); -extern void mfi_tbolt_issue_cmd_ppc(struct mfi_softc *,bus_addr_t, uint32_t); +extern void mfi_tbolt_issue_cmd_ppc(struct mfi_softc *, bus_addr_t, uint32_t); extern void mfi_tbolt_init_globals(struct mfi_softc*); extern uint32_t mfi_tbolt_get_memory_requirement(struct mfi_softc *); extern int mfi_tbolt_init_desc_pool(struct mfi_softc *, uint8_t *, uint32_t); From owner-svn-src-projects@FreeBSD.ORG Fri Nov 18 06:03:11 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DC371065672; Fri, 18 Nov 2011 06:03:11 +0000 (UTC) (envelope-from linimon@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D8B98FC13; Fri, 18 Nov 2011 06:03:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAI63Bf9053959; Fri, 18 Nov 2011 06:03:11 GMT (envelope-from linimon@svn.freebsd.org) Received: (from linimon@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAI63B2W053957; Fri, 18 Nov 2011 06:03:11 GMT (envelope-from linimon@svn.freebsd.org) Message-Id: <201111180603.pAI63B2W053957@svn.freebsd.org> From: Mark Linimon Date: Fri, 18 Nov 2011 06:03:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227653 - projects/portbuild/scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 06:03:11 -0000 Author: linimon (doc,ports committer) Date: Fri Nov 18 06:03:11 2011 New Revision: 227653 URL: http://svn.freebsd.org/changeset/base/227653 Log: Make the new verbosity under control of a flag. Modified: projects/portbuild/scripts/updatesnap Modified: projects/portbuild/scripts/updatesnap ============================================================================== --- projects/portbuild/scripts/updatesnap Fri Nov 18 05:43:43 2011 (r227652) +++ projects/portbuild/scripts/updatesnap Fri Nov 18 06:03:11 2011 (r227653) @@ -10,6 +10,8 @@ pbc=${PORTBUILD_CHECKOUT:-/var/portbuild base=${ZFS_MOUNTPOINT}/${SNAP_SRC_DIRECTORY_PREFIX} zbase=${ZFS_VOLUME}/${SNAP_SRC_DIRECTORY_PREFIX} +VERBOSE=1 + supstamp() { fulldate=$1 date -j -f %+ "${fulldate}" +%Y.%m.%d.%H.%M.%S @@ -39,6 +41,7 @@ umask 002 for branch in $SRC_BRANCHES; do mountpoint=${base}${branch} if [ ! -d ${mountpoint}/src ]; then + echo "creating new source branch under ${mountpoint}" mkdir -p ${mountpoint} echo "zfs create -o mountpoint=${mountpoint} ${zbase}${branch}" zfs create -o mountpoint=${mountpoint} ${zbase}${branch} @@ -58,13 +61,17 @@ for branch in $SRC_BRANCHES; do sed "s|%%DATE%%|${supdate}|;s|%%PREFIX%%|${mountpoint}|;s|%%TAG%%|${tag}|" \ ${SRC_MASTER_SUPFILE} > ${SRC_SUPFILE}.${branch}.now # example destination directory: /a/snap/src-7/src/ (tricky!) - echo "csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log" + if [ $VERBOSE ]; then + echo "csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log" + fi csup -L 2 ${SRC_SUPFILE}.${branch}.now > src-csup.${branch}.log echo ${fulldate} > src/.updated # hack for zfs breakiness find . -group wheel|xargs chgrp portmgr snapdate=$(stamp ${fulldate}) - echo "zfs snapshot ${zbase}${branch}/src@${snapdate}" + if [ $VERBOSE ]; then + echo "zfs snapshot ${zbase}${branch}/src@${snapdate}" + fi zfs snapshot ${zbase}${branch}/src@${snapdate} fi done From owner-svn-src-projects@FreeBSD.ORG Fri Nov 18 18:19:14 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3A8D1065674; Fri, 18 Nov 2011 18:19:14 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AA8718FC1A; Fri, 18 Nov 2011 18:19:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIIJEHw090387; Fri, 18 Nov 2011 18:19:14 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIIJEI7090386; Fri, 18 Nov 2011 18:19:14 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201111181819.pAIIJEI7090386@svn.freebsd.org> From: Sean Bruno Date: Fri, 18 Nov 2011 18:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227671 - projects/sbruno_firewire X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 18:19:14 -0000 Author: sbruno Date: Fri Nov 18 18:19:14 2011 New Revision: 227671 URL: http://svn.freebsd.org/changeset/base/227671 Log: Delete this branch as I have moved into a user branch for testing Deleted: projects/sbruno_firewire/