提交 28ce5ce6 编写于 作者: A aurel32

PowerPC: mac-io DB-DMA support

This patch adds powermac Descriptor-Based DMA.
It is used by mac-io based IDE, ethernet, sounds and serial devices.
Signed-off-by: NLaurent Vivier <Laurent@lvivier.info>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6488 c046a42c-6fe2-441c-8c8c-71466251a162
上级 186a7495
此差异已折叠。
/*
* Copyright (c) 2009 Laurent Vivier
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
typedef struct {
void *opaque;
void *channel;
int len;
int is_last;
void *buf;
int buf_pos;
int buf_len;
} DBDMA_transfer;
typedef int (*DBDMA_transfer_cb)(DBDMA_transfer *info);
typedef int (*DBDMA_transfer_handler)(DBDMA_transfer *info,
DBDMA_transfer_cb cb);
void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
DBDMA_transfer_handler transfer_handler,
void *opaque);
void DBDMA_schedule(void);
void* DBDMA_init (int *dbdma_mem_index);
......@@ -25,6 +25,7 @@
#include "hw.h"
#include "ppc.h"
#include "ppc_mac.h"
#include "mac_dbdma.h"
#include "nvram.h"
#include "pc.h"
#include "pci.h"
......@@ -86,6 +87,7 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
int ppc_boot_device;
int index;
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
void *dbdma;
linux_boot = (kernel_filename != NULL);
......@@ -280,6 +282,7 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
else
hd[i] = NULL;
}
dbdma = DBDMA_init(&dbdma_mem_index);
#if 1
ide_mem_index[0] = pmac_ide_init(&hd[0], pic[0x13]);
ide_mem_index[1] = pmac_ide_init(&hd[2], pic[0x14]);
......@@ -292,7 +295,6 @@ static void ppc_core99_init (ram_addr_t ram_size, int vga_ram_size,
adb_kbd_init(&adb_bus);
adb_mouse_init(&adb_bus);
dbdma_init(&dbdma_mem_index);
macio_init(pci_bus, 0x0022, 0, pic_mem_index, dbdma_mem_index,
cuda_mem_index, NULL, 2, ide_mem_index, escc_mem_index);
......
......@@ -39,9 +39,6 @@
#define ESCC_CLOCK 3686400
/* DBDMA */
void dbdma_init (int *dbdma_mem_index);
/* Cuda */
void cuda_init (int *cuda_mem_index, qemu_irq irq);
......
......@@ -25,6 +25,7 @@
#include "hw.h"
#include "ppc.h"
#include "ppc_mac.h"
#include "mac_dbdma.h"
#include "nvram.h"
#include "pc.h"
#include "sysemu.h"
......@@ -132,6 +133,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
int index;
void *fw_cfg;
void *dbdma;
linux_boot = (kernel_filename != NULL);
......@@ -343,6 +345,9 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
hd[1] = NULL;
else
hd[1] = drives_table[index].bdrv;
dbdma = DBDMA_init(&dbdma_mem_index);
ide_mem_index[0] = -1;
ide_mem_index[1] = pmac_ide_init(hd, pic[0x0D]);
......@@ -355,8 +360,6 @@ static void ppc_heathrow_init (ram_addr_t ram_size, int vga_ram_size,
nvr = macio_nvram_init(&nvram_mem_index, 0x2000);
pmac_format_nvram_partition(nvr, 0x2000);
dbdma_init(&dbdma_mem_index);
macio_init(pci_bus, 0x0010, 1, pic_mem_index, dbdma_mem_index,
cuda_mem_index, nvr, 2, ide_mem_index, escc_mem_index);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册