DevDMA.cpp revision da957c069c2a3c582fe265ff88170ce4c42b499d
af062818b47340eef15700d2f0211576ba3506eevboxsync * DMA Controller Device.
af062818b47340eef15700d2f0211576ba3506eevboxsync * Copyright (C) 2006-2007 innotek GmbH
af062818b47340eef15700d2f0211576ba3506eevboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
af062818b47340eef15700d2f0211576ba3506eevboxsync * available from http://www.virtualbox.org. This file is free software;
af062818b47340eef15700d2f0211576ba3506eevboxsync * you can redistribute it and/or modify it under the terms of the GNU
af062818b47340eef15700d2f0211576ba3506eevboxsync * General Public License as published by the Free Software Foundation,
af062818b47340eef15700d2f0211576ba3506eevboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
af062818b47340eef15700d2f0211576ba3506eevboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
af062818b47340eef15700d2f0211576ba3506eevboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
af062818b47340eef15700d2f0211576ba3506eevboxsync * If you received this file as part of a commercial VirtualBox
af062818b47340eef15700d2f0211576ba3506eevboxsync * distribution, then only the terms of your commercial VirtualBox
af062818b47340eef15700d2f0211576ba3506eevboxsync * license agreement apply instead of the previous paragraph.
af062818b47340eef15700d2f0211576ba3506eevboxsync * --------------------------------------------------------------------
4b9d6701570cb98fd36e209314239d104ec584d3vboxsync * This code is based on:
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * QEMU DMA emulation
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * Copyright (c) 2003 Vassili Karpov (malc)
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * Permission is hereby granted, free of charge, to any person obtaining a copy
b955672b950093ff7416d1269dd4d3b69983bd8fvboxsync * of this software and associated documentation files (the "Software"), to deal
af062818b47340eef15700d2f0211576ba3506eevboxsync * in the Software without restriction, including without limitation the rights
af062818b47340eef15700d2f0211576ba3506eevboxsync * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
af062818b47340eef15700d2f0211576ba3506eevboxsync * copies of the Software, and to permit persons to whom the Software is
af062818b47340eef15700d2f0211576ba3506eevboxsync * furnished to do so, subject to the following conditions:
af062818b47340eef15700d2f0211576ba3506eevboxsync * The above copyright notice and this permission notice shall be included in
af062818b47340eef15700d2f0211576ba3506eevboxsync * all copies or substantial portions of the Software.
af062818b47340eef15700d2f0211576ba3506eevboxsync * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
af062818b47340eef15700d2f0211576ba3506eevboxsync * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
af062818b47340eef15700d2f0211576ba3506eevboxsync * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
af062818b47340eef15700d2f0211576ba3506eevboxsync * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
af062818b47340eef15700d2f0211576ba3506eevboxsync * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
af062818b47340eef15700d2f0211576ba3506eevboxsync * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
af062818b47340eef15700d2f0211576ba3506eevboxsync * THE SOFTWARE.
af062818b47340eef15700d2f0211576ba3506eevboxsync/*******************************************************************************
af062818b47340eef15700d2f0211576ba3506eevboxsync* Header Files *
af062818b47340eef15700d2f0211576ba3506eevboxsync*******************************************************************************/
af062818b47340eef15700d2f0211576ba3506eevboxsync#define LOG_GROUP LOG_GROUP_DEFAULT ///@todo LOG_GROUP_DEV_DMA
#include <stdio.h>
#include <stdlib.h>
#include "Builtins.h"
#include "../vl_vbox.h"
#include "vl.h"
#ifndef VBOX
#ifndef __WIN32__
#ifdef DEBUG_DMA
#define lwarn(...)
#define linfo(...)
#define ldebug(...)
#define dolog()
#define lwarn()
#define linfo()
#define ldebug()
#ifdef LOG_ENABLED
# ifdef LOG_ENABLED
# define DEBUG_DMA
if (LogIsEnabled ()) {
#define LENOFA(a) ((int) (sizeof(a)/sizeof(a[0])))
struct dma_regs {
void *opaque;
#define ADDR 0
struct dma_cont {
unsigned int dshift;
} DMAState;
int ichan;
int ichan;
int ichan;
int ichan;
struct dma_regs *r;
int ff;
return ff;
struct dma_regs *r;
if (nreg)
struct dma_regs *r;
if (getff (d)) {
switch (iport) {
#ifdef DEBUG_DMA
d->flip_flop = 0;
d->flip_flop = 0;
d->mask = ~0;
d->status = 0;
d->command = 0;
d->mask = 0;
#ifdef DEBUG_DMA
switch (iport) {
val = 0;
return val;
#ifdef DEBUG_DMA
if (dir) {
struct dma_cont *d;
d = s->dma_controllers;
int mask;
void *opaque)
struct dma_regs *r;
unsigned nchan,
void *buf,
#ifdef VBOX
#ifdef VBOX
return len;
unsigned nchan,
const void *buf,
#ifdef VBOX
for (i = 0; i < len; i++) {
#ifdef VBOX
return len;
#ifndef VBOX
#ifdef VBOX
#define IO_READ_PROTO(n) \
void *pvUser, \
unsigned cb)
#define IO_WRITE_PROTO(n) \
void *pvUser, \
unsigned cb)
#ifdef PARANOID
return VINF_SUCCESS;
#ifdef PARANOID
return VINF_SUCCESS;
#ifdef PARANOID
return VINF_SUCCESS;
#ifdef PARANOID
return VINF_SUCCESS;
return VINF_SUCCESS;
return VERR_IOM_IOPORT_UNUSED;
return VINF_SUCCESS;
return VERR_IOM_IOPORT_UNUSED;
return VINF_SUCCESS;
return VERR_IOM_IOPORT_UNUSED;
return VINF_SUCCESS;
return VERR_IOM_IOPORT_UNUSED;
#ifdef VBOX
#ifdef VBOX
write_page, d);
read_page, d);
if (pageh_base >= 0) {
#ifdef VBOX
write_pageh, d);
read_pageh, d);
#ifdef VBOX
write_cont, d);
read_cont, d);
#ifndef VBOX
dma_reset(d);
#ifdef VBOX
return -EINVAL;
#ifndef VBOX
#ifdef VBOX
unsigned nchan,
void *opaque)
unsigned nchan,
void *buf,
unsigned nchan,
const void *buf,
unsigned nchan,
unsigned level)
if (level) {
return VINF_SUCCESS;
AssertFailed ();
int iInstance,
bool high_page_enable = 0;
int rc;
return rc;
return rc;
return rc;
return VINF_SUCCESS;
sizeof(DMAState),
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,