?? syspccard.c
字號:
void sys16BitIoPoolAdd
(
CS_POOL_ID poolId
)
{
int i;
for (i = 0; i < NELEMENTS (pci142016BitIoResource); i += 2)
{
csPoolBaseSet (poolId, pci142016BitIoResource[i]);
csPoolAdd (poolId, 0, pci142016BitIoResource[i + 1]);
}
}
/***********************************************************************
*
* sys16BitMemPoolAdd - Add 16-bit memory space to resource pool
*
* This is called by Card Services to add memory to the 16-bit memory
* space pool.
*
* RETURNS: N/A
*/
void sys16BitMemPoolAdd
(
CS_POOL_ID poolId
)
{
int i;
for (i = 0; i < NELEMENTS (pci142016BitMemResource); i += 2)
{
csPoolBaseSet (poolId, pci142016BitMemResource[i]);
csPoolAdd (poolId, 0, pci142016BitMemResource[i + 1]);
}
}
/**************************************************************************
*
* sysPci1420BridgePreConfigInit - Reserve PC Card memory
*
* This routine is called by the PCI auto-configuration process when it
* encounters a bridge. It reserves the memory needed for PC Card
* 16-bit devices.
*
* RETURNS: OK/ERROR
*/
void sysPci1420BridgePreConfigInit
(
PCI_AUTO_CONFIG_OPTS * pSystem,
PCI_LOC * pPciLoc,
UINT dev_vend
)
{
UINT32 sizeAdj;
UINT32 alignedBase;
UINT8 subClass;
UINT32 pccard16BitMemSize = pci142016BitMemResource[1];
UINT32 pccard16BitIoSize = pci142016BitIoResource[1];
pciConfigInByte (pPciLoc->bus, pPciLoc->device, pPciLoc->function,
PCI_CFG_SUBCLASS, &subClass);
if (subClass != PCI_SUBCLASS_BRDG_CARDBUS)
return;
if (pPciLoc->function != 0)
return;
/* Reserve memory for PCCARD memory */
pciAutoAddrAlign(pSystem->pciMemIo32,
(pSystem->pciMemIo32 + pSystem->pciMemIo32Size),
pccard16BitMemSize,
&alignedBase);
PCI_AUTO_DEBUG_MSG("16-bit mem orig[0x%08x] new[0x%08x] adj[0x%08x]\n",
(pSystem->pciMemIo32),
alignedBase,
(alignedBase - (pSystem->pciMemIo32)),
0,
0,
0
);
sizeAdj = alignedBase - (pSystem->pciMemIo32) + pccard16BitMemSize;
(pSystem->pciMemIo32Used) += sizeAdj;
(pSystem->pciMemIo32Size) -= sizeAdj;
(pSystem->pciMemIo32) += sizeAdj;
pci142016BitMemResource[0] = alignedBase;
pci142016BitMemResource[1] = pccard16BitMemSize;
/* Reserve memory for PCCARD IO */
pciAutoAddrAlign(pSystem->pciIo16,
(pSystem->pciIo16 + pSystem->pciIo16Size),
pccard16BitIoSize,
&alignedBase);
PCI_AUTO_DEBUG_MSG("I/O 16 Base orig[0x%08x] new[0x%08x] adj[0x%08x]\n",
(pSystem->pciIo16),
alignedBase,
(alignedBase - (pSystem->pciIo16)),
0,
0,
0
);
sizeAdj = alignedBase - (pSystem->pciIo16) + pccard16BitIoSize;
(pSystem->pciIo16Used) += sizeAdj;
(pSystem->pciIo16Size) -= sizeAdj;
(pSystem->pciIo16) += sizeAdj;
pci142016BitIoResource[0] = alignedBase;
pci142016BitIoResource[1] = pccard16BitIoSize;
}
/**************************************************************************
*
* sysPci1420HwInit - PCI1420 initialization
*
* This routine finds out the PCI device, maps its memory and IO address.
* It must be done prior to initializing the driver.
*
* RETURNS: OK/ERROR
*/
STATUS sysPci1420HwInit (void)
{
int pciBus;
int pciDevice;
int socket;
int instance = 0;
UINT8 irq[YENTA_MAX_SOCKETS], temp2;
UINT32 temp1, i, j;
while (pciFindClass(YENTA_PCI_CLASS_CARDBUS_BRIDGE, instance,
&pciBus, &pciDevice, &socket) != ERROR)
{
/* read ExCA base */
pciConfigInLong(pciBus, pciDevice, socket, PCI_CFG_BASE_ADDRESS_0,
&pci1420SSDriver.baseAddr[socket]);
pci1420SSDriver.baseAddr[socket] &= PCI_MEMBASE_MASK;
/* Enable IO access, memory access, and bus mastering */
pciConfigOutWord (pciBus, pciDevice, socket, PCI_CFG_COMMAND,
PCI_CMD_IO_ENABLE |
PCI_CMD_MEM_ENABLE |
PCI_CMD_MASTER_ENABLE);
instance++;
}
/* write to the multi-function routing register */
pciConfigOutLong (pciBus, pciDevice, 0,
MULTIFUNC_REG,
0x00C01D22);
for (i=0; i < instance; i++)
{
/* set power switch clock to be generated internally */
pciConfigInLong (pciBus, pciDevice, i,
SYSTEM_CTRL_REG,
&temp1);
temp1 |= P2CCLK;
pciConfigOutLong (pciBus, pciDevice, i,
SYSTEM_CTRL_REG,
temp1);
/* we need to wait after we start the clock */
for(j=0; j<0x1FFFFF; j++);
/* set interrupt signaling mode */
pciConfigInByte (pciBus, pciDevice, i,
DEVICE_CTRL_REG,
&temp2);
temp2 &= PARALLEL_PCI_MASK;
pciConfigOutByte (pciBus, pciDevice, i,
DEVICE_CTRL_REG,
temp2);
/* Read back autoconfigured IRQ */
pciConfigInByte (pciBus, pciDevice, i, PCI_CFG_BRG_INT_LINE, &irq[i]);
}
/* Initialize driver structure */
pci1420SSDriver.bus = pciBus;
pci1420SSDriver.device = pciDevice;
pci1420SSDriver.numSockets = instance;
pci1420SSDriver.flags = YENTA_FLAGS_POLL_CSC;
/* set type to prevent socket interrupt sharing */
pci1420SSDriver.type = YENTA_TYPE_PCI142X;
pci1420SSDriver.typeInit = NULL;
pci1420SSDriver.sysCardbusIntConnect = sysCardbusIntConnect;
pci1420SSDriver.sysCardbusIntDisconnect = sysCardbusIntDisconnect;
pci1420SSDriver.sysCardbusIntEnable = sysCardbusIntEnable;
pci1420SSDriver.sysExcaIntConnect = sysCardbusIntConnect;
pci1420SSDriver.sysExcaIntDisconnect = sysCardbusIntDisconnect;
pci1420SSDriver.cscIntVector[0] = INUM_TO_IVEC (irq[0]);
pci1420SSDriver.cscIntLevel[0] = irq[0];
pci1420SSDriver.cscIntVector[1] = INUM_TO_IVEC (irq[1]);
pci1420SSDriver.cscIntLevel[1] = irq[1];
pci1420SSDriver.excaIntVector[0] = INUM_TO_IVEC (PIC1_PC_INTA_IRQ);
pci1420SSDriver.excaIntLevel[0] = PIC1_PC_INTA_IRQ;
pci1420SSDriver.excaIntVector[1] = INUM_TO_IVEC (PIC1_PC_INTB_IRQ);
pci1420SSDriver.excaIntLevel[1] = PIC1_PC_INTB_IRQ;
return OK;
}
/***********************************************************************
*
* sysPccardInit - Initialize PCCARD services and enablers
*
* This routine initializes the socket controller and PCCARD
* enablers. It is called from csInit.
*
* RETURNS: OK or ERROR
*/
STATUS sysPccardInit
(
)
{
sysPci1420HwInit ();
if (yentaInit (&pci1420SSDriver) == ERROR)
return ERROR;
/* Register enablers */
#ifdef INCLUDE_PCCARD_ATA
/* PCMCIA on both controllers */
ataResources[0].ctrlType = ATA_PCMCIA;
ataResources[1].ctrlType = ATA_PCMCIA;
_func_sysAtaIntConnect = (FUNCPTR) SYS_ATA_INT_CONNECT;
_func_sysAtaIntDisconnect = (FUNCPTR) SYS_ATA_INT_DISCONNECT;
_func_sysAtaIntEnable = (FUNCPTR) SYS_ATA_INT_ENABLE;
_func_sysAtaIntDisable = (FUNCPTR) SYS_ATA_INT_DISABLE;
sysAtaInit ();
#endif /* INCLUDE_PCCARD_ATA */
#ifdef INCLUDE_PCCARD_SERIAL
sysSerialInit ();
#endif /* INCLUDE_PCCARD_SERIAL */
#ifdef INCLUDE_PCCARD_ELT_3C589_END
sysElt3c589Init ();
#endif /* INCLUDE_PCCARD_ELT_3C589_END */
#ifdef INCLUDE_PCCARD_NE2K_END
ne2000EndIntConnect = (FUNCPTR) SYS_NE2K_INT_CONNECT;
ne2000EndIntDisconnect = (FUNCPTR) SYS_NE2K_INT_DISCONNECT;
ne2000EndIntEnable = (FUNCPTR) SYS_NE2K_INT_ENABLE;
ne2000EndIntDisable = (FUNCPTR) SYS_NE2K_INT_DISABLE;
sysNe2kInit ();
#endif /* INCLUDE_PCCARD_NE2k_END */
#ifdef INCLUDE_PCCARD_EL_3C575_END
sysEl3c575Init ();
#endif /* INCLUDE_PCCARD_EL_3C575_END */
#ifdef INCLUDE_PCCARD_NETGEAR_END
/* sysNetgearInit (); */
#endif /* INCLUDE_PCCARD_NETGEAR_END */
#ifdef INCLUDE_PCCARD_INTPR_END
sysIntPrInit ();
#endif /* INCLUDE_PCCARD_INTPR_END */
return OK;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -