Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2013 06:14:06 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r258836 - in projects/altix2/sys: amd64/amd64 amd64/include arm/arm arm/include conf dev/pci i386/i386 i386/include ia64/ia64 ia64/include kern mips/include mips/mips powerpc/include po...
Message-ID:  <201312020614.rB26E6Cc066256@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Mon Dec  2 06:14:05 2013
New Revision: 258836
URL: http://svnweb.freebsd.org/changeset/base/258836

Log:
  Replace option BUSDMA_MI with LEGACY_BUS_DMA and provide the beginning
  of a compatibility shim from the legacy bus_dma interface to the new
  busdma/mi interface. The shim makes it possible (by intent) to switch
  to busdma/mi without first having to port drivers to it. Use the new
  LEGACY_BUS_DMA option to compile-in the actual legacy implementation
  when *not* using busdma/mi and thus when now using the shim. Otherwise
  the shim provides the implementation, which tends to do something else.
  
  The shim needs fleshing out to be functional. In its current form it
  merely allows LINT to build (for amd64).

Added:
  projects/altix2/sys/sys/bus_dma_compat.h
Modified:
  projects/altix2/sys/amd64/amd64/vm_machdep.c
  projects/altix2/sys/amd64/include/md_var.h
  projects/altix2/sys/arm/arm/vm_machdep.c
  projects/altix2/sys/arm/include/md_var.h
  projects/altix2/sys/conf/files
  projects/altix2/sys/conf/files.amd64
  projects/altix2/sys/conf/files.arm
  projects/altix2/sys/conf/files.i386
  projects/altix2/sys/conf/files.ia64
  projects/altix2/sys/conf/files.mips
  projects/altix2/sys/conf/files.pc98
  projects/altix2/sys/conf/files.powerpc
  projects/altix2/sys/conf/options
  projects/altix2/sys/dev/pci/vga_pci.c
  projects/altix2/sys/i386/i386/vm_machdep.c
  projects/altix2/sys/i386/include/md_var.h
  projects/altix2/sys/ia64/ia64/vm_machdep.c
  projects/altix2/sys/ia64/include/md_var.h
  projects/altix2/sys/kern/kern_intr.c
  projects/altix2/sys/kern/subr_bus.c
  projects/altix2/sys/mips/include/md_var.h
  projects/altix2/sys/mips/mips/vm_machdep.c
  projects/altix2/sys/powerpc/include/md_var.h
  projects/altix2/sys/powerpc/powerpc/vm_machdep.c
  projects/altix2/sys/sparc64/sparc64/vm_machdep.c
  projects/altix2/sys/sys/bus.h
  projects/altix2/sys/sys/bus_dma.h

Modified: projects/altix2/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- projects/altix2/sys/amd64/amd64/vm_machdep.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/amd64/amd64/vm_machdep.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -697,15 +697,17 @@ cpu_reset_real()
 	while(1);
 }
 
+#if defined(LEGACY_BUS_DMA)
 /*
  * Software interrupt handler for queued VM system processing.
  */   
 void  
 swi_vm(void *dummy) 
-{     
+{
 	if (busdma_swi_pending != 0)
 		busdma_swi();
 }
+#endif
 
 /*
  * Tell whether this address is in some physical memory region.

Modified: projects/altix2/sys/amd64/include/md_var.h
==============================================================================
--- projects/altix2/sys/amd64/include/md_var.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/amd64/include/md_var.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -38,7 +38,12 @@
 
 extern	long	Maxmem;
 extern	u_int	basemem;
+
+#if defined(LEGACY_BUS_DMA)
 extern	int	busdma_swi_pending;
+void	busdma_swi(void);
+#endif
+
 extern	u_int	cpu_exthigh;
 extern	u_int	cpu_feature;
 extern	u_int	cpu_feature2;
@@ -87,7 +92,6 @@ struct	dumperinfo;
 
 void	*alloc_fpusave(int flags);
 void	amd64_syscall(struct thread *td, int traced);
-void	busdma_swi(void);
 void	cpu_setregs(void);
 void	ctx_fpusave(void *);
 void	doreti_iret(void) __asm(__STRING(doreti_iret));

Modified: projects/altix2/sys/arm/arm/vm_machdep.c
==============================================================================
--- projects/altix2/sys/arm/arm/vm_machdep.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/arm/arm/vm_machdep.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -466,6 +466,7 @@ cpu_set_fork_handler(struct thread *td, 
 	    ("cpu_set_fork_handler: Incorrect stack alignment"));
 }
 
+#if defined(LEGACY_BUS_DMA)
 /*
  * Software interrupt handler for queued VM system processing.
  */
@@ -476,6 +477,7 @@ swi_vm(void *dummy)
 	if (busdma_swi_pending)
 		busdma_swi();
 }
+#endif
 
 void
 cpu_exit(struct thread *td)

Modified: projects/altix2/sys/arm/include/md_var.h
==============================================================================
--- projects/altix2/sys/arm/include/md_var.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/arm/include/md_var.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -71,8 +71,12 @@ enum cpu_class {
 extern enum cpu_class cpu_class;
 
 struct dumperinfo;
+
+#if defined(LEGACY_BUS_DMA)
 extern int busdma_swi_pending;
 void busdma_swi(void);
+#endif
+
 void dump_add_page(vm_paddr_t);
 void dump_drop_page(vm_paddr_t);
 void minidumpsys(struct dumperinfo *);

Modified: projects/altix2/sys/conf/files
==============================================================================
--- projects/altix2/sys/conf/files	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files	Mon Dec  2 06:14:05 2013	(r258836)
@@ -2863,7 +2863,7 @@ kern/subr_acl_posix1e.c		optional ufs_ac
 kern/subr_autoconf.c		standard
 kern/subr_blist.c		standard
 kern/subr_bus.c			standard
-kern/subr_bus_dma.c		standard
+kern/subr_bus_dma.c		optional legacy_bus_dma
 kern/subr_busdma.c		standard
 kern/subr_bufring.c		standard
 kern/subr_capability.c		standard

Modified: projects/altix2/sys/conf/files.amd64
==============================================================================
--- projects/altix2/sys/conf/files.amd64	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files.amd64	Mon Dec  2 06:14:05 2013	(r258836)
@@ -550,8 +550,8 @@ x86/isa/nmi.c			standard
 x86/isa/orm.c			optional	isa
 x86/pci/pci_bus.c		optional	pci
 x86/pci/qpi.c			optional	pci
-x86/x86/busdma_bounce.c		standard
-x86/x86/busdma_machdep.c	standard
+x86/x86/busdma_bounce.c		optional	legacy_bus_dma
+x86/x86/busdma_machdep.c	optional	legacy_bus_dma
 x86/x86/dump_machdep.c		standard
 x86/x86/fdt_machdep.c		optional	fdt
 x86/x86/intr_machdep.c		standard

Modified: projects/altix2/sys/conf/files.arm
==============================================================================
--- projects/altix2/sys/conf/files.arm	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files.arm	Mon Dec  2 06:14:05 2013	(r258836)
@@ -5,8 +5,21 @@ arm/arm/bcopyinout.S		standard
 arm/arm/blockio.S		standard
 arm/arm/bootconfig.c		standard
 arm/arm/bus_space_asm_generic.S	standard
-arm/arm/busdma_machdep.c 	optional	cpu_arm9 | cpu_arm9e | cpu_fa526 | cpu_sa1100 | cpu_sa1110 | cpu_xscale_80219 | cpu_xscale_80321 | cpu_xscale_81342 | cpu_xscale_ixp425 | cpu_xscale_ixp435 | cpu_xscale_pxa2x0
-arm/arm/busdma_machdep-v6.c 	optional	cpu_arm1136 | cpu_arm1176 | cpu_cortexa | cpu_mv_pj4b
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_arm9
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_arm9e
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_fa526
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_sa1100
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_sa1110
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_xscale_80219
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_xscale_80321
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_xscale_81342
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_xscale_ixp425
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_xscale_ixp435
+arm/arm/busdma_machdep.c 	optional	legacy_bus_dma cpu_xscale_pxa2x0
+arm/arm/busdma_machdep-v6.c 	optional	legacy_bus_dma cpu_arm1136
+arm/arm/busdma_machdep-v6.c 	optional	legacy_bus_dma cpu_arm1176
+arm/arm/busdma_machdep-v6.c 	optional	legacy_bus_dma cpu_cortexa
+arm/arm/busdma_machdep-v6.c 	optional	legacy_bus_dma cpu_mv_pj4b
 arm/arm/copystr.S		standard
 arm/arm/cpufunc.c		standard
 arm/arm/cpufunc_asm.S		standard
@@ -72,7 +85,7 @@ font.h				optional	sc			\
 	compile-with	"uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h" \
 	no-obj no-implicit-rule before-depend				\
 	clean	"font.h ${SC_DFLT_FONT}-8x14 ${SC_DFLT_FONT}-8x16 ${SC_DFLT_FONT}-8x8"
-kern/subr_busdma_bufalloc.c	standard
+kern/subr_busdma_bufalloc.c	optional	legacy_bus_dma
 kern/subr_dummy_vdso_tc.c	standard
 libkern/arm/aeabi_unwind.c	standard
 libkern/arm/divsi3.S		standard

Modified: projects/altix2/sys/conf/files.i386
==============================================================================
--- projects/altix2/sys/conf/files.i386	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files.i386	Mon Dec  2 06:14:05 2013	(r258836)
@@ -573,8 +573,8 @@ x86/isa/nmi.c			standard
 x86/isa/orm.c			optional isa
 x86/pci/pci_bus.c		optional pci
 x86/pci/qpi.c			optional pci
-x86/x86/busdma_bounce.c		standard
-x86/x86/busdma_machdep.c	standard
+x86/x86/busdma_bounce.c		optional legacy_bus_dma
+x86/x86/busdma_machdep.c	optional legacy_bus_dma
 x86/x86/dump_machdep.c		standard
 x86/x86/fdt_machdep.c		optional fdt
 x86/x86/intr_machdep.c		standard

Modified: projects/altix2/sys/conf/files.ia64
==============================================================================
--- projects/altix2/sys/conf/files.ia64	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files.ia64	Mon Dec  2 06:14:05 2013	(r258836)
@@ -72,7 +72,7 @@ ia64/ia32/ia32_signal.c		optional	compat
 ia64/ia32/ia32_trap.c		optional	compat_freebsd32
 ia64/ia64/autoconf.c		standard
 ia64/ia64/bus_machdep.c		standard
-ia64/ia64/busdma_machdep.c	standard
+ia64/ia64/busdma_machdep.c	optional	legacy_bus_dma
 ia64/ia64/clock.c		standard
 ia64/ia64/context.S		standard
 ia64/ia64/db_machdep.c		optional	ddb

Modified: projects/altix2/sys/conf/files.mips
==============================================================================
--- projects/altix2/sys/conf/files.mips	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files.mips	Mon Dec  2 06:14:05 2013	(r258836)
@@ -8,7 +8,7 @@
 mips/mips/autoconf.c			standard
 mips/mips/bus_space_generic.c		standard
 mips/mips/bus_space_fdt.c		optional	fdt
-mips/mips/busdma_machdep.c		standard
+mips/mips/busdma_machdep.c		optional	legacy_bus_dma
 mips/mips/cache.c			standard
 mips/mips/cache_mipsNN.c		standard
 mips/mips/cpu.c				standard

Modified: projects/altix2/sys/conf/files.pc98
==============================================================================
--- projects/altix2/sys/conf/files.pc98	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files.pc98	Mon Dec  2 06:14:05 2013	(r258836)
@@ -247,8 +247,8 @@ x86/isa/atpic.c			optional atpic	
 x86/isa/clock.c			standard
 x86/isa/isa.c			optional isa
 x86/pci/pci_bus.c		optional pci
-x86/x86/busdma_bounce.c		standard
-x86/x86/busdma_machdep.c	standard
+x86/x86/busdma_bounce.c		optional legacy_bus_dma
+x86/x86/busdma_machdep.c	optional legacy_bus_dma
 x86/x86/dump_machdep.c		standard
 x86/x86/intr_machdep.c		standard
 x86/x86/io_apic.c		optional apic

Modified: projects/altix2/sys/conf/files.powerpc
==============================================================================
--- projects/altix2/sys/conf/files.powerpc	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/files.powerpc	Mon Dec  2 06:14:05 2013	(r258836)
@@ -169,7 +169,7 @@ powerpc/powerpc/altivec.c	standard
 powerpc/powerpc/autoconf.c	standard
 powerpc/powerpc/bcopy.c		standard
 powerpc/powerpc/bus_machdep.c	standard
-powerpc/powerpc/busdma_machdep.c standard
+powerpc/powerpc/busdma_machdep.c optional	legacy_bus_dma
 powerpc/powerpc/clock.c		standard
 powerpc/powerpc/copyinout.c	standard
 powerpc/powerpc/copystr.c	standard

Modified: projects/altix2/sys/conf/options
==============================================================================
--- projects/altix2/sys/conf/options	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/conf/options	Mon Dec  2 06:14:05 2013	(r258836)
@@ -73,7 +73,6 @@ ATSE_CFI_HACK	opt_cfi.h
 AUDIT		opt_global.h
 BOOTHOWTO	opt_global.h
 BOOTVERBOSE	opt_global.h
-BUSDMA_MI	opt_global.h
 CALLOUT_PROFILING
 CAPABILITIES	opt_capsicum.h
 CAPABILITY_MODE	opt_capsicum.h
@@ -132,6 +131,7 @@ KSTACK_MAX_PAGES
 KSTACK_PAGES
 KTRACE
 KTRACE_REQUEST_POOL	opt_ktrace.h
+LEGACY_BUS_DMA	opt_global.h
 LIBICONV
 MAC		opt_global.h
 MAC_BIBA	opt_dontuse.h

Modified: projects/altix2/sys/dev/pci/vga_pci.c
==============================================================================
--- projects/altix2/sys/dev/pci/vga_pci.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/dev/pci/vga_pci.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -508,12 +508,14 @@ vga_pci_msix_count(device_t dev, device_
 	return (pci_msix_count(dev));
 }
 
+#if defined(LEGACY_BUS_DMA)
 static bus_dma_tag_t
 vga_pci_get_dma_tag(device_t bus, device_t child)
 {
 
 	return (bus_get_dma_tag(bus));
 }
+#endif
 
 static device_method_t vga_pci_methods[] = {
 	/* Device interface */
@@ -532,7 +534,9 @@ static device_method_t vga_pci_methods[]
 	DEVMETHOD(bus_release_resource,	vga_pci_release_resource),
 	DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
 	DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
+#if defined(LEGACY_BUS_DMA)
 	DEVMETHOD(bus_get_dma_tag,	vga_pci_get_dma_tag),
+#endif
 
 	/* PCI interface */
 	DEVMETHOD(pci_read_config,	vga_pci_read_config),

Modified: projects/altix2/sys/i386/i386/vm_machdep.c
==============================================================================
--- projects/altix2/sys/i386/i386/vm_machdep.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/i386/i386/vm_machdep.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -946,15 +946,17 @@ sf_buf_free(struct sf_buf *sf)
 	mtx_unlock(&sf_buf_lock);
 }
 
+#if defined(LEGACY_BUS_DMA)
 /*
  * Software interrupt handler for queued VM system processing.
  */   
 void  
 swi_vm(void *dummy) 
-{     
+{
 	if (busdma_swi_pending != 0)
 		busdma_swi();
 }
+#endif
 
 /*
  * Tell whether this address is in some physical memory region.

Modified: projects/altix2/sys/i386/include/md_var.h
==============================================================================
--- projects/altix2/sys/i386/include/md_var.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/i386/include/md_var.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -38,7 +38,12 @@
 
 extern	long	Maxmem;
 extern	u_int	basemem;	/* PA of original top of base memory */
+
+#if defined(LEGACY_BUS_DMA)
 extern	int	busdma_swi_pending;
+void	busdma_swi(void);
+#endif
+
 extern	u_int	cpu_exthigh;
 extern	u_int	cpu_feature;
 extern	u_int	cpu_feature2;
@@ -81,7 +86,6 @@ struct  dbreg;
 struct	dumperinfo;
 
 void	bcopyb(const void *from, void *to, size_t len);
-void	busdma_swi(void);
 void	cpu_setregs(void);
 void	cpu_switch_load_gs(void) __asm(__STRING(cpu_switch_load_gs));
 void	doreti_iret(void) __asm(__STRING(doreti_iret));

Modified: projects/altix2/sys/ia64/ia64/vm_machdep.c
==============================================================================
--- projects/altix2/sys/ia64/ia64/vm_machdep.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/ia64/ia64/vm_machdep.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -351,6 +351,7 @@ cpu_exit(struct thread *td)
 {
 }
 
+#if defined(LEGACY_BUS_DMA)
 /*
  * Software interrupt handler for queued VM system processing.
  */   
@@ -361,3 +362,4 @@ swi_vm(void *dummy) 
 	if (busdma_swi_pending != 0)
 		busdma_swi();
 }
+#endif

Modified: projects/altix2/sys/ia64/include/md_var.h
==============================================================================
--- projects/altix2/sys/ia64/include/md_var.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/ia64/include/md_var.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -75,10 +75,13 @@ struct ia64_init_return {
 
 extern uint64_t ia64_lapic_addr;
 extern vm_paddr_t paddr_max;
+
+#if defined(LEGACY_BUS_DMA)
 extern u_int busdma_swi_pending;
+void	busdma_swi(void);
+#endif
 
 void	*acpi_find_table(const char *sig);
-void	busdma_swi(void);
 int	copyout_regstack(struct thread *, uint64_t *, uint64_t *);
 void	cpu_mp_add(u_int, u_int, u_int);
 void	cpu_pcpu_setup(struct pcpu *, u_int, u_int);

Modified: projects/altix2/sys/kern/kern_intr.c
==============================================================================
--- projects/altix2/sys/kern/kern_intr.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/kern/kern_intr.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -119,7 +119,6 @@ static void	priv_ithread_execute_handler
 #endif
 static void	ithread_loop(void *);
 static void	ithread_update(struct intr_thread *ithd);
-static void	start_softintr(void *);
 
 /* Map an interrupt type to an ithread priority. */
 u_char
@@ -1861,6 +1860,7 @@ DB_SHOW_COMMAND(intr, db_show_intr)
 }
 #endif /* DDB */
 
+#if defined(LEGACY_BUS_DMA)
 /*
  * Start standard software interrupt threads
  */
@@ -1873,6 +1873,7 @@ start_softintr(void *dummy)
 }
 SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr,
     NULL);
+#endif
 
 /*
  * Sysctls used by systat and others: hw.intrnames and hw.intrcnt.

Modified: projects/altix2/sys/kern/subr_bus.c
==============================================================================
--- projects/altix2/sys/kern/subr_bus.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/kern/subr_bus.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -4434,6 +4434,7 @@ bus_child_location_str(device_t child, c
 	return (BUS_CHILD_LOCATION_STR(parent, child, buf, buflen));
 }
 
+#if defined(LEGACY_BUS_DMA)
 /**
  * @brief Wrapper function for BUS_GET_DMA_TAG().
  *
@@ -4450,6 +4451,7 @@ bus_get_dma_tag(device_t dev)
 		return (NULL);
 	return (BUS_GET_DMA_TAG(parent, dev));
 }
+#endif /* LEGACY_BUS_DMA */
 
 /* Resume all devices and then notify userland that we're up again. */
 static int

Modified: projects/altix2/sys/mips/include/md_var.h
==============================================================================
--- projects/altix2/sys/mips/include/md_var.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/mips/include/md_var.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -73,8 +73,10 @@ void	mips_pcpu0_init(void);
 void	mips_proc0_init(void);
 void	mips_postboot_fixup(void);
 
+#if defined(LEGACY_BUS_DMA)
 extern int busdma_swi_pending;
 void	busdma_swi(void);
+#endif
 
 struct	dumperinfo;
 void	dump_add_page(vm_paddr_t);

Modified: projects/altix2/sys/mips/mips/vm_machdep.c
==============================================================================
--- projects/altix2/sys/mips/mips/vm_machdep.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/mips/mips/vm_machdep.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -590,6 +590,7 @@ sf_buf_free(struct sf_buf *sf)
 }
 #endif	/* !__mips_n64 */
 
+#if defined(LEGACY_BUS_DMA)
 /*
  * Software interrupt handler for queued VM system processing.
  */
@@ -600,6 +601,7 @@ swi_vm(void *dummy)
 	if (busdma_swi_pending)
 		busdma_swi();
 }
+#endif
 
 int
 cpu_set_user_tls(struct thread *td, void *tls_base)

Modified: projects/altix2/sys/powerpc/include/md_var.h
==============================================================================
--- projects/altix2/sys/powerpc/include/md_var.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/powerpc/include/md_var.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -42,7 +42,11 @@ extern	int	szsigcode64;
 #endif
 
 extern	long	Maxmem;
+
+#if defined(LEGACY_BUS_DMA)
 extern	int	busdma_swi_pending;
+void	busdma_swi(void);
+#endif
 
 extern	vm_offset_t	kstack0;
 extern	vm_offset_t	kstack0_phys;
@@ -53,7 +57,6 @@ extern  int hw_direct_map;
 
 void	__syncicache(void *, int);
 
-void	busdma_swi(void);
 int	is_physical_memory(vm_offset_t addr);
 int	mem_valid(vm_offset_t addr, int len);
 

Modified: projects/altix2/sys/powerpc/powerpc/vm_machdep.c
==============================================================================
--- projects/altix2/sys/powerpc/powerpc/vm_machdep.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/powerpc/powerpc/vm_machdep.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -362,6 +362,7 @@ sf_buf_free(struct sf_buf *sf)
 	mtx_unlock(&sf_buf_lock);
 }
 
+#if defined(LEGACY_BUS_DMA)
 /*
  * Software interrupt handler for queued VM system processing.
  */
@@ -372,6 +373,7 @@ swi_vm(void *dummy)
 	if (busdma_swi_pending != 0)
 		busdma_swi();
 }
+#endif
 
 /*
  * Tell whether this address is in some physical memory region.

Modified: projects/altix2/sys/sparc64/sparc64/vm_machdep.c
==============================================================================
--- projects/altix2/sys/sparc64/sparc64/vm_machdep.c	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/sparc64/sparc64/vm_machdep.c	Mon Dec  2 06:14:05 2013	(r258836)
@@ -494,12 +494,14 @@ sf_buf_free(struct sf_buf *sf)
 	mtx_unlock(&sf_freelist.sf_lock);
 }
 
+#if defined(LEGACY_BUS_DMA)
 void
 swi_vm(void *v)
 {
 
 	/* Nothing to do here - busdma bounce buffers are not implemented. */
 }
+#endif
 
 void *
 uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait)

Modified: projects/altix2/sys/sys/bus.h
==============================================================================
--- projects/altix2/sys/sys/bus.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/sys/bus.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -388,7 +388,6 @@ int	bus_activate_resource(device_t dev, 
 			      struct resource *r);
 int	bus_deactivate_resource(device_t dev, int type, int rid,
 				struct resource *r);
-bus_dma_tag_t bus_get_dma_tag(device_t dev);
 int	bus_release_resource(device_t dev, int type, int rid,
 			     struct resource *r);
 int	bus_free_resource(device_t dev, int type, struct resource *r);
@@ -411,6 +410,10 @@ int	bus_child_pnpinfo_str(device_t child
 int	bus_child_location_str(device_t child, char *buf, size_t buflen);
 void	bus_enumerate_hinted_children(device_t bus);
 
+#if defined(LEGACY_BUS_DMA)
+bus_dma_tag_t bus_get_dma_tag(device_t dev);
+#endif
+
 static __inline struct resource *
 bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
 {

Modified: projects/altix2/sys/sys/bus_dma.h
==============================================================================
--- projects/altix2/sys/sys/bus_dma.h	Mon Dec  2 06:09:52 2013	(r258835)
+++ projects/altix2/sys/sys/bus_dma.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -128,17 +128,6 @@ struct uio;
 #define	BUS_DMASYNC_POSTWRITE	8
 
 /*
- *	bus_dma_segment_t
- *
- *	Describes a single contiguous DMA transaction.  Values
- *	are suitable for programming into DMA registers.
- */
-typedef struct bus_dma_segment {
-	bus_addr_t	ds_addr;	/* DMA address */
-	bus_size_t	ds_len;		/* length of transfer */
-} bus_dma_segment_t;
-
-/*
  * A function that returns 1 if the address cannot be accessed by
  * a device and 0 if it can be.
  */
@@ -149,6 +138,19 @@ typedef int bus_dma_filter_t(void *, bus
  */
 void busdma_lock_mutex(void *arg, bus_dma_lock_op_t op);
 
+#if defined(LEGACY_BUS_DMA)
+
+/*
+ *	bus_dma_segment_t
+ *
+ *	Describes a single contiguous DMA transaction.  Values
+ *	are suitable for programming into DMA registers.
+ */
+typedef struct bus_dma_segment {
+	bus_addr_t	ds_addr;	/* DMA address */
+	bus_size_t	ds_len;		/* length of transfer */
+} bus_dma_segment_t;
+
 /*
  * Allocate a device specific dma_tag encapsulating the constraints of
  * the parent tag in addition to other restrictions specified:
@@ -344,4 +346,11 @@ bus_dma_segment_t *_bus_dmamap_complete(
 
 #endif /* __sparc64__ */
 
+#else /* LEGACY_BUS_DMA */
+
+#include <sys/busdma.h>
+#include <sys/bus_dma_compat.h>
+
+#endif /* LEGACY_BUS_DMA */
+
 #endif /* _BUS_DMA_H_ */

Added: projects/altix2/sys/sys/bus_dma_compat.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/altix2/sys/sys/bus_dma_compat.h	Mon Dec  2 06:14:05 2013	(r258836)
@@ -0,0 +1,185 @@
+#ifndef _SYS_BUS_DMA_COMPAT_H_
+#define	_SYS_BUS_DMA_COMPAT_H_
+
+#include <sys/errno.h>
+#include <sys/systm.h>
+
+#include <machine/bus.h>
+
+typedef struct bus_dma_segment {
+	TAILQ_ENTRY(bus_dma_segment) ds_link;
+	u_int		ds_idx;
+	bus_addr_t	ds_addr;	/* bus address */
+	vm_paddr_t	ds_physaddr;
+	vm_offset_t	ds_virtaddr;
+	vm_size_t	ds_len;
+} bus_dma_segment_t;
+
+typedef void bus_dmamap_callback_t(void *, bus_dma_segment_t *, int, int);
+typedef void bus_dmamap_callback2_t(void *, bus_dma_segment_t *, int,
+    bus_size_t, int);
+
+#define	bus_dmamap_t		busdma_md_t
+
+#ifdef CTASSERT
+CTASSERT(__alignof(device_t) > 1);
+CTASSERT(__alignof(bus_dma_tag_t) > 1);
+#endif
+
+static bus_dma_tag_t __inline
+bus_get_dma_tag(device_t dev)
+{
+	bus_dma_tag_t tag;
+	uintptr_t token;
+
+	token = (uintptr_t)(void *)dev;
+	token |= 1;
+	tag = (bus_dma_tag_t)(void *)token;
+	return (tag);
+}
+
+static int __inline
+bus_dma_tag_create(bus_dma_tag_t dt, bus_size_t align, bus_addr_t bndry,
+    bus_addr_t lowaddr, bus_addr_t highaddr, bus_dma_filter_t *filtfunc,
+    void *filtfuncarg, bus_size_t maxsz, int nsegs, bus_size_t maxsegsz,
+    int flags, bus_dma_lock_t *lockfunc, void *lockfuncarg,
+    bus_dma_tag_t *tag_p)
+{
+	busdma_tag_t tag;
+	device_t dev;
+	uintptr_t token;
+	int error;
+
+	KASSERT(highaddr == BUS_SPACE_MAXADDR, ("%s: bad highaddr", __func__));
+
+	token = (uintptr_t)(void *)dt;
+	if (token & 1UL) {
+		dev = (device_t)(void *)(token - 1UL);
+		error = busdma_tag_create(dev, align, bndry, lowaddr, maxsz,
+		    nsegs, maxsegsz, 0, flags, &tag);
+	} else {
+		tag = (busdma_tag_t)(void *)dt;
+		error = busdma_tag_derive(tag, align, bndry, lowaddr, maxsz,
+		    nsegs, maxsegsz, 0, flags, &tag);
+	}
+	*tag_p = (bus_dma_tag_t)(void *)tag;
+
+	/* XXX lockfunc, lockfuncarg */
+	/* XXX filtfunc, filtfuncarg */
+	return (error);
+}
+
+static int __inline
+bus_dma_tag_destroy(bus_dma_tag_t tag)
+{
+	uintptr_t token;
+
+	token = (uintptr_t)(void *)tag;
+	KASSERT((token & 1) == 0, ("%s: bad tag", __func__));
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_create(bus_dma_tag_t tag, int flags, bus_dmamap_t *mapp)
+{
+
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_destroy(bus_dma_tag_t tag, bus_dmamap_t map)
+{
+
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_load(bus_dma_tag_t tag, bus_dmamap_t map, void *buf,
+    bus_size_t buflen, bus_dmamap_callback_t *callback, void *callback_arg,
+    int flags)
+{
+
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_load_bio(bus_dma_tag_t tag, bus_dmamap_t map, struct bio *bio,
+    bus_dmamap_callback_t *callback, void *callback_arg, int flags)
+{
+
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_load_ccb(bus_dma_tag_t tag, bus_dmamap_t map, union ccb *ccb,
+    bus_dmamap_callback_t *callback, void *callback_arg, int flags)
+{
+
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_load_mbuf(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *mbuf,
+    bus_dmamap_callback2_t *callback, void *callback_arg, int flags)
+{
+
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_load_mbuf_sg(bus_dma_tag_t tag, bus_dmamap_t map, struct mbuf *mbuf,
+    bus_dma_segment_t *segs, int *nsegs, int flags)
+{
+
+	return (ENOSYS);
+}
+
+static int __inline
+bus_dmamap_load_uio(bus_dma_tag_t tag, bus_dmamap_t map, struct uio *ui,
+    bus_dmamap_callback2_t *callback, void *callback_arg, int flags)
+{
+
+	return (ENOSYS);
+}
+
+static void __inline
+bus_dmamap_sync(bus_dma_tag_t tag, bus_dmamap_t map, bus_dmasync_op_t op)
+{
+	u_int nop;
+	int error;
+
+	nop = 0;
+	if (op & BUS_DMASYNC_PREREAD)
+		nop |= BUSDMA_SYNC_PREREAD;
+	if (op & BUS_DMASYNC_POSTREAD)
+		nop |= BUSDMA_SYNC_POSTREAD;
+	if (op & BUS_DMASYNC_PREWRITE)
+		nop |= BUSDMA_SYNC_PREWRITE;
+	if (op & BUS_DMASYNC_POSTWRITE)
+		nop |= BUSDMA_SYNC_POSTWRITE;
+	KASSERT((nop & (BUSDMA_SYNC_BEFORE | BUSDMA_SYNC_AFTER)) !=
+	    (BUSDMA_SYNC_BEFORE | BUSDMA_SYNC_AFTER),
+	    ("%s: bad op", __func__));
+	error = busdma_sync_range(map, op, 0UL, ~0UL);
+	KASSERT(error == 0, ("%s: got error", __func__));
+}
+
+static void __inline
+bus_dmamap_unload(bus_dma_tag_t tag, bus_dmamap_t map)
+{
+}
+
+static int __inline
+bus_dmamem_alloc(bus_dma_tag_t tag, void **vaddr, int flags,
+    bus_dmamap_t *mapp)
+{
+
+	return (ENOSYS);
+}
+
+static void __inline
+bus_dmamem_free(bus_dma_tag_t tag, void *vaddr, bus_dmamap_t map)
+{
+}
+
+#endif /* _SYS_BUS_DMA_COMPAT_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312020614.rB26E6Cc066256>