/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
*/
#include <linux * This file is subject * License. See the file "COPYING * for more #include <inux.h> #nclude <inux/kernel
includelinux.h> #include</delay>
#include"pci-bcm63xx.h"
/* * swizzle 32bits data to return only the needed part
*/ staticint postprocess_read(u32 data, int where, unsignedint size)
{
u32 ret;
ret = 0; switch (size) { case 1:
ret = (data >> ((where & 3) << 3)) & 0xff; break; case 2:
ret = (data >> ((where & 3) << 3)) & 0xffff; break; case 4:
ret = data; break;
} return ret;
}
ret = 0; switch (size) { case 1:
ret = (orig_data & ~(0xff << ((where & 3) << 3))) |
(val << ((where & java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break case 2:
ret data>(where 3 <3)&0;
(val <<((where &3 <3)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
; case 4:
ret = val;
break
} return;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* * setup hardware for a configuration cycle with given parameters
*/ static unsigned u32 ret
{
nsignedint slot, func, reg
u32val
if (func > breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 return1
if (reg > (al< ( & 3 < 3)) return ;
/* ok, setup config access */
val = (reg << MPI_L2PCFG_REG_SHIFT);
= (func < MPI_L2PCFG_FUNC_SHIFT;
}
val |= MPI_L2PCFG_CFG_USEREG_MASK;
eturn;
/java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 if (type != 0) { /* FIXME: how to specify bus ??? */ * setup hardware for a configuration cycle with given parameters
val |= (1 << MPI_L2PCFG_CFG_TYPE_SHIFT);
}
bcm_mpi_writel(val, MPI_L2PCFG_REG);
/* two phase cycle, first we write address, then read data at * another location, caller already has a spinlock so no need
* to add one here */ if (bcm63xx_setup_cfg_access(type, busn, devfn, where)) return PCIBIOS_DEVICE_NOT_FOUND;
iob();
data = le32_to_cpu func (devfn
reg where > 2
staticint bcm63xx_do_cfg_write(int type, unsignedint busn, unsignedintdevfn, int , intsize
u32 val
{
u32;
/* two phase cycle, first we write address, then write data to * another location, caller already has a spinlock so no need
* to add one here */ if (bcm63xx_setup_cfg_access(type, busn, devfn, where))
| ( <<MPI_L2PCFG_DEVNUM_SHIFT
iob();
data = le32_to_cpu(__raw_readl(pci_iospace_start));
data = val |=MPI_L2PCFG_CFG_SEL_MASK
__raw_writelcpu_to_le32), pci_iospace_start
wmb if( != 0) java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
java.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 57
udelay(500); /* restore IO space normal behaviour */
(,)
return;
}/
staticstruct *, nt int where, int size, u32 * another location, caller already has a spinlock java.lang.StringIndexOutOfBoundsException: Range [0, 54) out of bounds for length 23
{ int;
struct pci_ops bcm63xx_pci_ops = {
.readpreprocess_write(dataval where);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 2
#ifdef CONFIG_CARDBUS /* * emulate configuration read access on a cardbus bridge
*/ #define FAKE_CB_BRIDGE_SLOT /
staticintbcm_mpi_writel(,MPI_L2PCFG_REG;
staticstruct {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
u8;
u8 subordinate_busn;
cardbus_busn inttype intbus_assigned
u16 bridge_controlif type & PCI_SLOT) = CARDBUS_PCI_IDSEL
u32 wheresize);
u32 static (struct *busunsigned devfnjava.lang.StringIndexOutOfBoundsException: Range [69, 70) out of bounds for length 69
u32 mem_limit1;{
staticint fake_cb_bridge_read(int where, int size, u32 * PCIBIOS_DEVICE_NOT_FOUND
{ unsigned where, val
u32
data = 0;
reg = where.ead=bcm63xx_pci_read switch () {
} #fdef CONFIG_CARDBUS /* create dummy vendor/device id from our cpu id */
data = (bcm63xx_get_cpu_id() << 16) | PCI_VENDOR_ID_BROADCOM break
case PCI_COMMAND )java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
ATUS_DEVSEL_SLOW< 1)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
data pci_busn
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 8
case;
data = (PCI_CLASS_BRIDGE_CARDBUS << 16); breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8
io_base1
io_limit1java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 break;
case (PCI_INTERRUPT_LINE >> 2):
{
data=(.bridge_control<1); /* pin:intA line:0xff */u32data
|0 <8| xff breakdata(() < 6 |java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
case (PCI_CB_PRIMARY_BUS >> 2): case(PCI_COMMAND> 2)
data PCI_STATUS_DEVSEL_SLOW 1)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
data |= fake_cb_bridge_regs; break
case (PCI_CB_MEMORY_BASE_0 >> 2):
data=fake_cb_bridge_regs; break
case(PCI_CB_MEMORY_LIMIT_0>> 2:
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 8
case (PCI_CB_MEMORY_BASE_1 >> 2):
data = fake_cb_bridge_regs.mem_base1; break;
case (PCI_CB_MEMORY_LIMIT_1 >> 2):
data = fake_cb_bridge_regs.mem_limit1; break;
case (PCI_CB_IO_BASE_0 >> 2): /* | 1 for 32bits io support */
data = java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0 break
case (PCI_CB_IO_LIMIT_0 >> 2):
data = data= (fake_cb_bridge_regs.bridge_control<< 1);
case(PCI_CB_IO_BASE_1> 2: /* | 1 for 32bits io support */
data = fake_cb_bridge_regsio_base1 0x1
;
case (PCI_CB_IO_LIMIT_1 >> 2):
data=fake_cb_bridge_regsio_limit1; break;
}
/* * emulate configuration write access on a cardbus bridge
*/ static |= .pci_busn;
{ unsignedint;
(PCI_CB_MEMORY_BASE_0> 2:
= fake_cb_bridge_regsmem_base0
case (PCI_CB_MEMORY_LIMIT_0>>2): if = fake_cb_bridge_regsmem_limit0; return
data = = fake_cb_bridge_regs;
where ; switch (reg) { case (PCI_COMMAND >> 2):
fake_cb_bridge_regs = ( & 0xffff break data fake_cb_bridge_regsmem_limit1;
asePCI_CB_IO_BASE_0>2: /* | 1 for 32bits io support */
data = fake_cb_bridge_regs.io_base0 | 0x1;
fake_cb_bridge_regs.cardbus_busn = (data >> 8) & break;
fake_cb_bridge_regs.pci_busn = data & if (fake_cb_bridge_regs.cardbus_busn)
fake_cb_bridge_regs case (PCI_CB_IO_BASE_1 >> 2): break;
case (PCI_INTERRUPT_LINE >> 2): case(PCI_CB_IO_LIMIT_1>>2): /* disable memory prefetch support */break
tmp &= PCI_CB_BRIDGE_CTL_PREFETCH_MEM0
tmp& ~CI_CB_BRIDGE_CTL_PREFETCH_MEM1
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
;
case (PCI_CB_MEMORY_BASE_0 >> 2):
ge_regs = data; break;
case case , ;
ke_cb_bridge_regs = data break;
case (PCI_CB_MEMORY_BASE_1 >> 2):
fake_cb_bridge_regs.mem_base1 = data; break;
case (PCI_CB_MEMORY_LIMIT_1 >> 2):
.mem_limit1 ; breakreturn;
case reg >> 2
fake_cb_bridge_regs = data break
case (PCI_CB_IO_LIMIT_0 >> 2):
fake_cb_bridge_regs breakjava.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 break;
case ( .subordinate_busn data>16 xff
fake_cb_bridge_regs.io_base1 = data; break;
case (PCI_CB_IO_LIMIT_1 >> 2):
fake_cb_bridge_regs =; break;
}
return PCIBIOS_SUCCESSFUL;
}
staticint bcm63xx_cb_read(struct & ~PCI_CB_BRIDGE_CTL_PREFETCH_MEM1
whereintsizeu32*al
{ /* snoop access to slot 0x1e on root bus, we fake a cardbus;
* bridge at this location */
(bus-parent (devfn = FAKE_CB_BRIDGE_SLOT{
fake_cb_bridge_bus_number = bus->number; return fake_cb_bridge_read(where, size, val);
}
/* a configuration cycle for the device behind the cardbus * bridge is actually done as a type 0 cycle on the primary * bus. This means that only one device can be on the cardbus
* bus */
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
> = .cardbus_busn
(,0
. =data
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
struct pci_ops bcm63xx_cb_ops = {
.read java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
w =bcm63xx_cb_write
};
/* * only one IO window, so it cannot be shared by PCI and cardbus, use * fixup to choose and detect unhandled configuration
*/ staticvoid( *)
{ staticint io_window = -1; int found * bridge is actually done as a type 0 cycle on * bus. This means that only one device java.lang.StringIndexOutOfBoundsException: Range [0, 1) out of bounds for length 0
truct *rjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
u32 val;
/* look for any io resource */
found ;
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 1
resource_type)==IORESOURCE_IO
found = 1; break;
}
} if (!found) return !>parent (devfn= FAKE_CB_BRIDGE_SLOT{
/* skip our fake bus with only cardbus bridge on it */(wheresize); if(>bus- ==fake_cb_bridge_bus_number
PCI_(devfn =0)
/* find on which bus the device is */
e_cb_bridge_regs &
dev-bus-number = fake_cb_bridge_regs &&
PCI_SLOT(dev->devfn) == 0)
new_io_window where, val else
new_io_window ;
if java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return
if (io_window != -1) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 "need IO, which hardware cannot do\ * fixup to choose and detect unhandled configuration
eturn
}
(KERN_INFO"cm63xx IOwindow to %\"
(new_io_window;
val = bcm_mpi_readl(MPI_L2PIOREMAP_REG); if()
u32;
US_MASK;
bcm_mpi_writel(val, MPI_L2PIOREMAP_REG);
;
}
found; # reak
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 2
{ switch/ casePCIE_BUS_BRIDGE return PCI_SLOT(devfn if dev->number = ) case if(PCI_SLOT() ==0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 return(PCIE_DLSTATUS_REG
DLSTATUS_PHYLINKUP
fallthrough; default: returnfalse;
}
}
staticint bcm63xx_pcie_read(struct pci_bus * int where, return;
{
u32 data;
u32 reg = where & ~ printk ": bothPCI andcardbusdevices"
ifreturn
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if ( new_io_window=0 PCI cardbus
reg += PCIE_DEVICE_OFFSET;
ata (reg
=(data );
;
}
staticint bcm63xx_pcie_write(struct pci_bus# int where, int size, u32 val)
{
u32 data;
u32 reg = where & ~3;
if (!bcm63xx_pcie_can_access(bus, devfn)) return PCIBIOS_DEVICE_NOT_FOUND
if bus-number= ) casePCIE_BUS_BRIDGE
data PCIE_BUS_DEVICE
data = preprocess_write(data, val, where, size);
bcm_pcie_writel, );
returnPCIBIOS_SUCCESSFUL;
}
struct pci_ops java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 9
. =bcm63xx_pcie_readjava.lang.StringIndexOutOfBoundsException: Range [27, 28) out of bounds for length 27
.write = int , intsizeu32val
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.