mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
Staging: Lindent sxg.c
Lindent drivers/staging/sxg/sxg.c Signed-off by: J.R. Mauro <jrm8005@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
f25fda728d
commit
5c7514e061
1 changed files with 81 additions and 65 deletions
|
@ -80,9 +80,15 @@
|
|||
#include "sxgphycode.h"
|
||||
#include "saharadbgdownload.h"
|
||||
|
||||
static int sxg_allocate_buffer_memory(p_adapter_t adapter, u32 Size, SXG_BUFFER_TYPE BufferType);
|
||||
static void sxg_allocate_rcvblock_complete(p_adapter_t adapter, void * RcvBlock, dma_addr_t PhysicalAddress, u32 Length);
|
||||
static void sxg_allocate_sgl_buffer_complete(p_adapter_t adapter, PSXG_SCATTER_GATHER SxgSgl, dma_addr_t PhysicalAddress, u32 Length);
|
||||
static int sxg_allocate_buffer_memory(p_adapter_t adapter, u32 Size,
|
||||
SXG_BUFFER_TYPE BufferType);
|
||||
static void sxg_allocate_rcvblock_complete(p_adapter_t adapter, void *RcvBlock,
|
||||
dma_addr_t PhysicalAddress,
|
||||
u32 Length);
|
||||
static void sxg_allocate_sgl_buffer_complete(p_adapter_t adapter,
|
||||
PSXG_SCATTER_GATHER SxgSgl,
|
||||
dma_addr_t PhysicalAddress,
|
||||
u32 Length);
|
||||
|
||||
static void sxg_mcast_init_crc32(void);
|
||||
|
||||
|
@ -115,7 +121,8 @@ static void sxg_mcast_set_mask(p_adapter_t adapter);
|
|||
|
||||
static int sxg_initialize_adapter(p_adapter_t adapter);
|
||||
static void sxg_stock_rcv_buffers(p_adapter_t adapter);
|
||||
static void sxg_complete_descriptor_blocks(p_adapter_t adapter, unsigned char Index);
|
||||
static void sxg_complete_descriptor_blocks(p_adapter_t adapter,
|
||||
unsigned char Index);
|
||||
static int sxg_initialize_link(p_adapter_t adapter);
|
||||
static int sxg_phy_init(p_adapter_t adapter);
|
||||
static void sxg_link_event(p_adapter_t adapter);
|
||||
|
@ -127,8 +134,6 @@ static int sxg_read_mdio_reg(p_adapter_t adapter,
|
|||
u32 DevAddr, u32 RegAddr, u32 *pValue);
|
||||
static void sxg_mcast_set_list(p_net_device dev);
|
||||
|
||||
|
||||
|
||||
#define XXXTODO 0
|
||||
|
||||
static unsigned int sxg_first_init = 1;
|
||||
|
@ -164,6 +169,7 @@ static struct pci_device_id sxg_pci_tbl[] __devinitdata = {
|
|||
{PCI_DEVICE(SXG_VENDOR_ID, SXG_DEVICE_ID)},
|
||||
{0,}
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(pci, sxg_pci_tbl);
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -695,14 +701,16 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
|
|||
mmio_start, mmio_len);
|
||||
|
||||
memmapped_ioaddr = ioremap(mmio_start, mmio_len);
|
||||
DBG_ERROR("sxg: %s MEMMAPPED_IOADDR [%p]\n", __FUNCTION__, memmapped_ioaddr);
|
||||
DBG_ERROR("sxg: %s MEMMAPPED_IOADDR [%p]\n", __FUNCTION__,
|
||||
memmapped_ioaddr);
|
||||
if (!memmapped_ioaddr) {
|
||||
DBG_ERROR("%s cannot remap MMIO region %lx @ %lx\n",
|
||||
__FUNCTION__, mmio_len, mmio_start);
|
||||
goto err_out_free_mmio_region;
|
||||
}
|
||||
|
||||
DBG_ERROR("sxg: %s found Alacritech SXG PCI, MMIO at %p, start[%lx] len[%lx], IRQ %d.\n",
|
||||
DBG_ERROR
|
||||
("sxg: %s found Alacritech SXG PCI, MMIO at %p, start[%lx] len[%lx], IRQ %d.\n",
|
||||
__func__, memmapped_ioaddr, mmio_start, mmio_len, pcidev->irq);
|
||||
|
||||
adapter->HwRegs = (void *)memmapped_ioaddr;
|
||||
|
@ -715,7 +723,8 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
|
|||
mmio_start, mmio_len);
|
||||
|
||||
memmapped_ioaddr = ioremap(mmio_start, mmio_len);
|
||||
DBG_ERROR("sxg: %s MEMMAPPED_IOADDR [%p]\n", __func__, memmapped_ioaddr);
|
||||
DBG_ERROR("sxg: %s MEMMAPPED_IOADDR [%p]\n", __func__,
|
||||
memmapped_ioaddr);
|
||||
if (!memmapped_ioaddr) {
|
||||
DBG_ERROR("%s cannot remap MMIO region %lx @ %lx\n",
|
||||
__FUNCTION__, mmio_len, mmio_start);
|
||||
|
@ -845,7 +854,6 @@ static int sxg_entry_probe(struct pci_dev *pcidev,
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* LINE BASE Interrupt routines..
|
||||
***********************************************************************/
|
||||
|
@ -957,7 +965,8 @@ static irqreturn_t sxg_isr(int irq, void *dev_id)
|
|||
PSXG_EVENT_RING EventRing = &adapter->EventRings[i];
|
||||
PSXG_EVENT Event =
|
||||
&EventRing->Ring[adapter->NextEvent[i]];
|
||||
unsigned char Cpu = adapter->RssSystemInfo->RssIdToCpu[i];
|
||||
unsigned char Cpu =
|
||||
adapter->RssSystemInfo->RssIdToCpu[i];
|
||||
if (Event->Status & EVENT_STATUS_VALID) {
|
||||
adapter->IsrDpcsPending++;
|
||||
CpuMask |= (1 << Cpu);
|
||||
|
@ -1078,7 +1087,8 @@ static int sxg_process_isr(p_adapter_t adapter, u32 MessageId)
|
|||
if (Isr & SXG_ISR_DEAD) {
|
||||
// Set aside the crash info and set the adapter state to RESET
|
||||
adapter->CrashCpu =
|
||||
(unsigned char) ((Isr & SXG_ISR_CPU) >> SXG_ISR_CPU_SHIFT);
|
||||
(unsigned char)((Isr & SXG_ISR_CPU) >>
|
||||
SXG_ISR_CPU_SHIFT);
|
||||
adapter->CrashLocation = (ushort) (Isr & SXG_ISR_CRASH);
|
||||
adapter->Dead = TRUE;
|
||||
DBG_ERROR("%s: ISR_DEAD %x, CPU: %d\n", __FUNCTION__,
|
||||
|
@ -1380,11 +1390,9 @@ static struct sk_buff *sxg_slow_receive(p_adapter_t adapter, PSXG_EVENT Event)
|
|||
SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "RcvError",
|
||||
Event, Event->Status, Event->HostHandle, 0);
|
||||
// XXXTODO - Remove this print later
|
||||
DBG_ERROR("SXG: Receive error %x\n",
|
||||
*(u32 *)
|
||||
DBG_ERROR("SXG: Receive error %x\n", *(u32 *)
|
||||
SXG_RECEIVE_DATA_LOCATION(RcvDataBufferHdr));
|
||||
sxg_process_rcv_error(adapter,
|
||||
*(u32 *)
|
||||
sxg_process_rcv_error(adapter, *(u32 *)
|
||||
SXG_RECEIVE_DATA_LOCATION
|
||||
(RcvDataBufferHdr));
|
||||
goto drop;
|
||||
|
@ -1406,8 +1414,7 @@ static struct sk_buff *sxg_slow_receive(p_adapter_t adapter, PSXG_EVENT Event)
|
|||
//
|
||||
// Dumb-nic frame. See if it passes our mac filter and update stats
|
||||
//
|
||||
if (!sxg_mac_filter(adapter,
|
||||
(p_ether_header)
|
||||
if (!sxg_mac_filter(adapter, (p_ether_header)
|
||||
SXG_RECEIVE_DATA_LOCATION(RcvDataBufferHdr),
|
||||
Event->Length)) {
|
||||
SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "RcvFiltr",
|
||||
|
@ -1527,7 +1534,8 @@ static void sxg_process_rcv_error(p_adapter_t adapter, u32 ErrorStatus)
|
|||
* Return Value:
|
||||
* TRUE if the frame is to be allowed
|
||||
*/
|
||||
static bool sxg_mac_filter(p_adapter_t adapter, p_ether_header EtherHdr, ushort length)
|
||||
static bool sxg_mac_filter(p_adapter_t adapter, p_ether_header EtherHdr,
|
||||
ushort length)
|
||||
{
|
||||
bool EqualAddr;
|
||||
|
||||
|
@ -1600,7 +1608,8 @@ static int sxg_register_interrupt(p_adapter_t adapter)
|
|||
("sxg: %s AllocAdaptRsrcs adapter[%p] dev->irq[%x] %x\n",
|
||||
__FUNCTION__, adapter, adapter->netdev->irq, NR_IRQS);
|
||||
|
||||
spin_unlock_irqrestore(&sxg_global.driver_lock, sxg_global.flags);
|
||||
spin_unlock_irqrestore(&sxg_global.driver_lock,
|
||||
sxg_global.flags);
|
||||
|
||||
retval = request_irq(adapter->netdev->irq,
|
||||
&sxg_isr,
|
||||
|
@ -1729,7 +1738,6 @@ static int sxg_entry_open(p_net_device dev)
|
|||
sxg_global.num_sxg_ports_active++;
|
||||
adapter->activated = 1;
|
||||
}
|
||||
|
||||
// Initialize the adapter
|
||||
DBG_ERROR("sxg: %s ENTER sxg_initialize_adapter\n", __FUNCTION__);
|
||||
status = sxg_initialize_adapter(adapter);
|
||||
|
@ -2038,7 +2046,9 @@ static void sxg_dumb_sgl(PSCATTER_GATHER_LIST pSgl, PSXG_SCATTER_GATHER SxgSgl)
|
|||
#endif
|
||||
// Fill in the command
|
||||
// Copy out the first SGE to the command and adjust for offset
|
||||
phys_addr = pci_map_single(adapter->pcidev, skb->data, skb->len, PCI_DMA_TODEVICE);
|
||||
phys_addr =
|
||||
pci_map_single(adapter->pcidev, skb->data, skb->len,
|
||||
PCI_DMA_TODEVICE);
|
||||
XmtCmd->Buffer.FirstSgeAddress = SXG_GET_ADDR_HIGH(phys_addr);
|
||||
XmtCmd->Buffer.FirstSgeAddress = XmtCmd->Buffer.FirstSgeAddress << 32;
|
||||
XmtCmd->Buffer.FirstSgeAddress =
|
||||
|
@ -2422,7 +2432,8 @@ static SXG_LINK_STATE sxg_get_link_state(p_adapter_t adapter)
|
|||
return (SXG_LINK_DOWN);
|
||||
}
|
||||
|
||||
static void sxg_indicate_link_state(p_adapter_t adapter, SXG_LINK_STATE LinkState)
|
||||
static void sxg_indicate_link_state(p_adapter_t adapter,
|
||||
SXG_LINK_STATE LinkState)
|
||||
{
|
||||
if (adapter->LinkState == SXG_LINK_UP) {
|
||||
DBG_ERROR("%s: LINK now UP, call netif_start_queue\n",
|
||||
|
@ -2857,12 +2868,10 @@ static void sxg_mcast_set_mask(p_adapter_t adapter)
|
|||
((adapter->MulticastMask >> 32) & 0xFFFFFFFF)));
|
||||
|
||||
WRITE_REG(sxg_regs->McastLow,
|
||||
(u32) (adapter->MulticastMask & 0xFFFFFFFF),
|
||||
FLUSH);
|
||||
(u32) (adapter->MulticastMask & 0xFFFFFFFF), FLUSH);
|
||||
WRITE_REG(sxg_regs->McastHigh,
|
||||
(u32) ((adapter->
|
||||
MulticastMask >> 32) & 0xFFFFFFFF),
|
||||
FLUSH);
|
||||
MulticastMask >> 32) & 0xFFFFFFFF), FLUSH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3008,8 +3017,7 @@ static void sxg_allocate_complete(p_adapter_t adapter,
|
|||
PhysicalAddress, Length);
|
||||
break;
|
||||
case SXG_BUFFER_TYPE_SGL:
|
||||
sxg_allocate_sgl_buffer_complete(adapter,
|
||||
(PSXG_SCATTER_GATHER)
|
||||
sxg_allocate_sgl_buffer_complete(adapter, (PSXG_SCATTER_GATHER)
|
||||
VirtualAddress,
|
||||
PhysicalAddress, Length);
|
||||
break;
|
||||
|
@ -3084,7 +3092,8 @@ static int sxg_allocate_buffer_memory(p_adapter_t adapter,
|
|||
*/
|
||||
static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
|
||||
void *RcvBlock,
|
||||
dma_addr_t PhysicalAddress, u32 Length)
|
||||
dma_addr_t PhysicalAddress,
|
||||
u32 Length)
|
||||
{
|
||||
u32 i;
|
||||
u32 BufferSize = adapter->ReceiveBufferSize;
|
||||
|
@ -3160,7 +3169,8 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
|
|||
}
|
||||
|
||||
// Locate the descriptor block and put it on a separate free queue
|
||||
RcvDescriptorBlock = (PSXG_RCV_DESCRIPTOR_BLOCK) ((unsigned char *)RcvBlock +
|
||||
RcvDescriptorBlock =
|
||||
(PSXG_RCV_DESCRIPTOR_BLOCK) ((unsigned char *)RcvBlock +
|
||||
SXG_RCV_DESCRIPTOR_BLOCK_OFFSET
|
||||
(BufferSize));
|
||||
RcvDescriptorBlockHdr =
|
||||
|
@ -3211,7 +3221,8 @@ static void sxg_allocate_rcvblock_complete(p_adapter_t adapter,
|
|||
*/
|
||||
static void sxg_allocate_sgl_buffer_complete(p_adapter_t adapter,
|
||||
PSXG_SCATTER_GATHER SxgSgl,
|
||||
dma_addr_t PhysicalAddress, u32 Length)
|
||||
dma_addr_t PhysicalAddress,
|
||||
u32 Length)
|
||||
{
|
||||
SXG_TRACE(TRACE_SXG, SxgTraceBuffer, TRACE_NOISY, "AlSglCmp",
|
||||
adapter, SxgSgl, Length, 0);
|
||||
|
@ -3228,7 +3239,8 @@ static void sxg_allocate_sgl_buffer_complete(p_adapter_t adapter,
|
|||
adapter, SxgSgl, Length, 0);
|
||||
}
|
||||
|
||||
static unsigned char temp_mac_address[6] = { 0x00, 0xab, 0xcd, 0xef, 0x12, 0x69 };
|
||||
static unsigned char temp_mac_address[6] =
|
||||
{ 0x00, 0xab, 0xcd, 0xef, 0x12, 0x69 };
|
||||
|
||||
static void sxg_adapter_set_hwaddr(p_adapter_t adapter)
|
||||
{
|
||||
|
@ -3400,7 +3412,8 @@ static int sxg_initialize_adapter(p_adapter_t adapter)
|
|||
* status
|
||||
*/
|
||||
static int sxg_fill_descriptor_block(p_adapter_t adapter,
|
||||
PSXG_RCV_DESCRIPTOR_BLOCK_HDR RcvDescriptorBlockHdr)
|
||||
PSXG_RCV_DESCRIPTOR_BLOCK_HDR
|
||||
RcvDescriptorBlockHdr)
|
||||
{
|
||||
u32 i;
|
||||
PSXG_RING_INFO RcvRingInfo = &adapter->RcvRingZeroInfo;
|
||||
|
@ -3436,7 +3449,8 @@ static int sxg_fill_descriptor_block(p_adapter_t adapter,
|
|||
ASSERT(RcvDataBufferHdr);
|
||||
SXG_REINIATIALIZE_PACKET(RcvDataBufferHdr->SxgDumbRcvPacket);
|
||||
RcvDataBufferHdr->State = SXG_BUFFER_ONCARD;
|
||||
RcvDescriptorBlock->Descriptors[i].VirtualAddress = (void *)RcvDataBufferHdr;
|
||||
RcvDescriptorBlock->Descriptors[i].VirtualAddress =
|
||||
(void *)RcvDataBufferHdr;
|
||||
RcvDescriptorBlock->Descriptors[i].PhysicalAddress =
|
||||
RcvDataBufferHdr->PhysicalAddress;
|
||||
}
|
||||
|
@ -3497,7 +3511,9 @@ static void sxg_stock_rcv_buffers(p_adapter_t adapter)
|
|||
RcvDescriptorBlockHdr = NULL;
|
||||
if (adapter->FreeRcvBlockCount) {
|
||||
_ple = RemoveHeadList(&adapter->FreeRcvBlocks);
|
||||
RcvDescriptorBlockHdr = container_of(_ple, SXG_RCV_DESCRIPTOR_BLOCK_HDR, FreeList);
|
||||
RcvDescriptorBlockHdr =
|
||||
container_of(_ple, SXG_RCV_DESCRIPTOR_BLOCK_HDR,
|
||||
FreeList);
|
||||
adapter->FreeRcvBlockCount--;
|
||||
RcvDescriptorBlockHdr->State = SXG_BUFFER_BUSY;
|
||||
}
|
||||
|
@ -3533,7 +3549,8 @@ static void sxg_stock_rcv_buffers(p_adapter_t adapter)
|
|||
* Return
|
||||
* None
|
||||
*/
|
||||
static void sxg_complete_descriptor_blocks(p_adapter_t adapter, unsigned char Index)
|
||||
static void sxg_complete_descriptor_blocks(p_adapter_t adapter,
|
||||
unsigned char Index)
|
||||
{
|
||||
PSXG_RCV_RING RingZero = &adapter->RcvRings[0];
|
||||
PSXG_RING_INFO RcvRingInfo = &adapter->RcvRingZeroInfo;
|
||||
|
@ -3576,7 +3593,6 @@ static void sxg_complete_descriptor_blocks(p_adapter_t adapter, unsigned char In
|
|||
adapter, Index, RcvRingInfo->Head, RcvRingInfo->Tail);
|
||||
}
|
||||
|
||||
|
||||
static struct pci_driver sxg_driver = {
|
||||
.name = DRV_NAME,
|
||||
.id_table = sxg_pci_tbl,
|
||||
|
|
Loading…
Reference in a new issue