// SPDX-License-Identifier: GPL-2.0
/*
* PCI support for the Sega Dreamcast
*
* Copyright ( C ) 2001 , 2002 M . R . Brown
* Copyright ( C ) 2002 , 2003 Paul Mundt
*
* This file originally bore the message ( with enclosed - $ ) :
* Id : pci . c , v 1 . 3 2003 / 05 / 04 19 : 29 : 46 lethal Exp
* Dreamcast PCI : Supports SEGA Broadband Adaptor only .
*/
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/pci.h>
#include <linux/module.h>
#include <asm /io.h>
#include <asm /irq.h>
#include <mach/pci.h>
static struct resource gapspci_resources[] = {
{
.name = "GAPSPCI IO" ,
.start = GAPSPCI_BBA_CONFIG,
.end = GAPSPCI_BBA_CONFIG + GAPSPCI_BBA_CONFIG_SIZE - 1 ,
.flags = IORESOURCE_IO,
}, {
.name = "GAPSPCI mem" ,
.start = GAPSPCI_DMA_BASE,
.end = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1 ,
.flags = IORESOURCE_MEM,
},
};
static struct pci_channel dreamcast_pci_controller = {
.pci_ops = &gapspci_pci_ops,
.resources = gapspci_resources,
.nr_resources = ARRAY_SIZE(gapspci_resources),
.io_offset = 0 x00000000,
.mem_offset = 0 x00000000,
};
/*
* gapspci init
*/
static int __init gapspci_init(void )
{
char idbuf[16 ];
int i;
/*
* FIXME : All of this wants documenting to some degree ,
* even some basic register definitions would be nice .
*
* I haven ' t seen anything this ugly since . . maple .
*/
for (i=0 ; i<16 ; i++)
idbuf[i] = inb(GAPSPCI_REGS+i);
if (strncmp(idbuf, "GAPSPCI_BRIDGE_2" , 16 ))
return -ENODEV;
outl(0 x5a14a501, GAPSPCI_REGS+0 x18);
for (i=0 ; i<1000000 ; i++)
cpu_relax();
if (inl(GAPSPCI_REGS+0 x18) != 1 )
return -EINVAL;
outl(0 x01000000, GAPSPCI_REGS+0 x20);
outl(0 x01000000, GAPSPCI_REGS+0 x24);
outl(GAPSPCI_DMA_BASE, GAPSPCI_REGS+0 x28);
outl(GAPSPCI_DMA_BASE+GAPSPCI_DMA_SIZE, GAPSPCI_REGS+0 x2c);
outl(1 , GAPSPCI_REGS+0 x14);
outl(1 , GAPSPCI_REGS+0 x34);
/* Setting Broadband Adapter */
outw(0 xf900, GAPSPCI_BBA_CONFIG+0 x06);
outl(0 x00000000, GAPSPCI_BBA_CONFIG+0 x30);
outb(0 x00, GAPSPCI_BBA_CONFIG+0 x3c);
outb(0 xf0, GAPSPCI_BBA_CONFIG+0 x0d);
outw(0 x0006, GAPSPCI_BBA_CONFIG+0 x04);
outl(0 x00002001, GAPSPCI_BBA_CONFIG+0 x10);
outl(0 x01000000, GAPSPCI_BBA_CONFIG+0 x14);
return register_pci_controller(&dreamcast_pci_controller);
}
arch_initcall(gapspci_init);
Messung V0.5 in Prozent C=96 H=87 G=91
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-09-28)
¤
*© Formatika GbR, Deutschland