Re: API change for bus_dma
From: Scott Long (scottl_at_freebsd.org)
Date: 06/28/03
- Previous message: Bosko Milekic: "Re: dynamically linked root and nscd"
- In reply to: John Baldwin: "RE: API change for bus_dma"
- Next in thread: Justin T. Gibbs: "Re: API change for bus_dma"
- Reply: Justin T. Gibbs: "Re: API change for bus_dma"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 28 Jun 2003 10:31:43 -0600 To: John Baldwin <jhb@freebsd.org>
John Baldwin wrote:
> Using this approach is more flexible in case there is a driver
> that uses a sx lock or a (not yet implemented) reader-writer lock
> or a critical section, or whatever. This just means that the
> callback uses a wrapper function but that really isn't that hard to
> do and there are other cases (callouts in general) that need this.
> To me this seems to be adding a special case to the API that won't
> work for all situations anyways. I also don't see wrapper functions
> as being all that hard.
>
Ok, after many semi-private discussions, how about this:
1) New flag, BUS_DMA_INSWI, to signal that the caller is busdma_swi().
2) Remove callback_mtx and replace it with callback2, a function
pointer that wraps the callback with driver-dependent locking. This
makes thing more flexible for alternate locking strategies.
3) Move vm_swi to be INTR_MPSAFE. On every single arch, vm_swi
only exists to call busdma_swi(). This should not preclude other
tasks from being added to this SWI as long as appropriate locking
is done.
4) Have busdma_swi() check that callback2==NULL. If it does,
grab Giant before calling bus_dmamap_load(). If it doesn't, call
bus_dmamap_load() with callback2 instead of the original callback.
5) bus_dmamap_load() checks BUS_DMA_INSWI==0 before overwriting
the callback and callback_args fields of the map. It will blindly
call 'callback' and rely on the caller (either the driver or
busdma_swi) giving it the right pointer.
Scott
_______________________________________________
freebsd-arch@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
To unsubscribe, send any mail to "freebsd-arch-unsubscribe@freebsd.org"
- Previous message: Bosko Milekic: "Re: dynamically linked root and nscd"
- In reply to: John Baldwin: "RE: API change for bus_dma"
- Next in thread: Justin T. Gibbs: "Re: API change for bus_dma"
- Reply: Justin T. Gibbs: "Re: API change for bus_dma"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
- [PATCH 1/5] call i2c_probe from i2c core
... If you want to write a `sensors' driver, ... Whenever a new adapter is
inserted, or for all adapters if the driver is ... the callback attach_adapteris called.
... -contains -1 for a probed detection, 0 for a forced detection, or a positive ...
(Linux-Kernel) - Re: Cross Process Callbacks
... If you have the help of a wrapper API in the application space, ... application
calls a function, CallMeBackWithData(Callback fcn, DWORD ... DeviceIoControl(driver,
set up callback, event) ... Driver -> handles buffer cleanup and continues in device.exe
context ... (microsoft.public.windowsce.platbuilder) - Re: Delay inside a worker thread
... Create invisible windows and use PostMessage to communicate between the threads ...
>>hardware interupt which is signalled to your callback function in real ... >>by
the device driver, you should simply have to call an API with an On Off ... >>the
operation has completed with a callback. ... (microsoft.public.vc.mfc) - Re: Thread in driver
... And the driver is able to do the callback ... whenever there is an interrupt.
... This kind of solution will work only if your callback is inside ... If you need
to implement such a mechanism, use a named event and set ... (microsoft.public.windowsce.platbuilder) - Re: VFW Streaming Transfer under WME
... list, fill them with capture data, and complete by the callback. ... > user-mode
only Video Capture Driver. ... so suppose client will supply the buffer ...
> times, then my driver fill the buffer and callback, and this repeat. ... (microsoft.public.development.device.drivers)