/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */
/* All Rights Reserved */
/*
* This is the implementation of the kernel DMA interface for the
* AT Class machines using Intel 8237A DMAC.
*
* The following routines in the interface are implemented:
* i_dmae_init()
* _dmae_nxcookie()
* i_dmae_acquire()
* i_dmae_free()
* i_dmae_prog()
* i_dmae_swsetup()
* i_dmae_swstart()
* i_dmae_stop()
* i_dmae_enable()
* i_dmae_disable()
* i_dmae_get_best_mode()
* i_dmae_get_chan_stat()
*
*/
#include <sys/dma_engine.h>
#include <sys/dma_i8237A.h>
#ifdef DEBUG
static int dmaedebug = 0;
#else
#define dprintf(x)
#endif
/*
* routine: i_dmae_init()
* purpose: called to initialize the dma interface, the DMAC, and any
* dma data structures. Called during system initialization.
* caller: main()
* calls: d37A_init()
*/
int
{
int chnl;
dprintf(("i_dmae_init: initializing dma.\n"));
/* initialize semaphore map */
(void *)NULL);
}
}
/*
* routine: i_dmae_acquire()
* purpose: Request the semaphore for the indicated channel.
* wait for the semaphore.
* caller: drivers
* calls: sema_p(), sema_tryp(), ddi_set_callback()
*/
int
{
#if defined(lint)
#endif
dprintf(("i_dmae_acquire: channel %d, waitfp %p\n",
chnl, (void *)dmae_waitfp));
if (!d37A_dma_valid(chnl))
return (DDI_FAILURE);
if (dmae_waitfp == DDI_DMA_SLEEP) {
if (dmae_waitfp == DDI_DMA_DONTWAIT) {
} else {
&dmae_call_list[chnl]);
}
return (DDI_DMA_NORESOURCES);
}
/*
* XXX - save dip for authentication later ??
*/
return (DDI_SUCCESS);
}
/*
* routine: i_dmae_free()
* purpose: Release the channel semaphore on chnl. Assumes caller actually
* owns the semaphore (no check made for this).
* caller: drivers
* calls: none
*/
int
{
#if defined(lint)
#endif
/*
* XXX - should dip be authenticated as the one that did acquire?
*/
if (dmae_call_list[chnl])
return (DDI_SUCCESS);
}
/*
* routine: i_dmae_get_best_mode()
* purpose: confirm that data is aligned for efficient flyby mode
* caller: driver routines.
* calls: d37A_get_best_mode.
*/
{
#if defined(lint)
#endif
return (d37A_get_best_mode(dmaereqp));
}
/*
* routine: _dmae_nxcookie()
* purpose: service the interrupt by calling device driver routine for next
* DMA cookie.
* caller: d37A_intr()
* calls: routine provided in request structure
*/
{
/*
* expect a cookie pointer from user's routine;
* null cookie pointer will terminate chaining
*/
}
return (cookiep);
}
/*
* routine: i_dmae_prog()
* purpose: Program channel for the to_be_initiated_by_hardware operation.
* _dma_acquire is called to request the channel semaphore and
* mode is passed as the sleep parameter.
* The channel is enabled after it is setup.
* Note that the ddi_dmae_req pointer can be to NULL if the mode
* registers have already been setup by a prior call; this implements
* a prog_next() to update the address and count registers.
* caller: driver routines
* calls: d37A_prog_chan()
*/
int
{
int rval;
#if defined(lint)
#endif
if (rval != DDI_SUCCESS) {
dprintf(("i_dmae_prog: failure on channel %d dmaereq=%p\n",
} else {
dprintf(("i_dmae_prog: channel %d dmaereq=%p\n",
if (dmaereqp) {
}
}
return (rval);
}
/*
* routine: i_dmae_swsetup()
* purpose: Setup chan for the operation given in dmacbptr.
* _dma_acquire is first called
* to request the channel semaphore for chnl; mode is
* passed to _dma_acquire().
* caller: driver routines
* calls: d37A_dma_swsetup()
*/
int
{
int rval;
#if defined(lint)
#endif
if (rval != DDI_SUCCESS) {
dprintf(("i_dmae_swsetup: failure on channel %d dmaereq=%p\n",
} else {
dprintf(("i_dmae_swsetup: channel %d: dmaereq=%p\n",
}
return (rval);
}
/*
* routine: i_dmae_swstart()
* purpose: Start the operation setup by i_dmae_swsetup().
* caller: driver routines
* calls: d37A_dma_swstart().
*/
void
{
#if defined(lint)
#endif
}
/*
* routine: i_dmae_stop()
* purpose: stop DMA activity on chnl.
* caller: driver routines
* calls: splhi(), _dma_relse(), splx(),
* d37A_dma_stop().
*/
void
{
#if defined(lint)
#endif
/* call d37A the stop the channel */
}
/*
* routine: i_dmae_enable()
* purpose: Allow the hardware tied to channel chnl to request service
* from the DMAC. i_dmae_prog() should have been called prior
* to this.
* caller: driver routines.
* calls: d37A_dma_enable()
*/
void
{
#if defined(lint)
#endif
}
/*
* routine: i_dmae_disable()
* purpose: Called to mask off hardware requests on channel chnl. Assumes
* the caller owns the channel.
* caller: driver routines.
* calls: d37A_dma_disable()
*/
void
{
#if defined(lint)
#endif
/* dprintf(("i_dmae_disable: disable channel %d.\n", chnl)); */
}
/*
* routine: i_dmae_get_chan_stat()
* purpose: Obtain the current channel status from the DMAC
* caller: driver routines.
* calls: d37A_get_chan_stat()
*/
void
{
#if defined(lint)
#endif
}