Minor cleanup. When I see kernel code like this, I'm very tempted to delete
it altogether. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17992 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,6 +7,8 @@
|
|||||||
#include <ByteOrder.h>
|
#include <ByteOrder.h>
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
typedef vint32 MM_ATOMIC_T;
|
typedef vint32 MM_ATOMIC_T;
|
||||||
|
|
||||||
//#define MM_SWAP_LE16(x) B_SWAP_INT16(x)
|
//#define MM_SWAP_LE16(x) B_SWAP_INT16(x)
|
||||||
|
|||||||
@@ -1,19 +1,30 @@
|
|||||||
#include <PCI.h>
|
/*
|
||||||
#include <Drivers.h>
|
* Copyright 2006, Nathan Whitehorn.
|
||||||
#include <KernelExport.h>
|
* Distributed under the terms of the GPL License.
|
||||||
#include <malloc.h>
|
*/
|
||||||
#include <string.h>
|
|
||||||
#include <ether_driver.h>
|
|
||||||
|
|
||||||
#include "b44mm.h"
|
#include "b44mm.h"
|
||||||
#include "b44lm.h"
|
#include "b44lm.h"
|
||||||
#include "mempool.h"
|
#include "mempool.h"
|
||||||
|
|
||||||
|
#include <ether_driver.h>
|
||||||
|
|
||||||
|
#include <PCI.h>
|
||||||
|
#include <Drivers.h>
|
||||||
|
#include <KernelExport.h>
|
||||||
|
|
||||||
|
#include <malloc.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
struct pci_module_info *pci = NULL;
|
struct pci_module_info *pci = NULL;
|
||||||
|
|
||||||
const char *dev_list[11];
|
#define MAX_CARDS 4
|
||||||
struct be_b44_dev be_b44_dev_cards[10];
|
|
||||||
int cards_found = 0;
|
static char *sDeviceNames[MAX_CARDS + 1];
|
||||||
|
static int sCardsFound = 0;
|
||||||
|
struct be_b44_dev be_b44_dev_cards[MAX_CARDS];
|
||||||
|
|
||||||
int b44_Packet_Desc_Size = sizeof(struct B_UM_PACKET);
|
int b44_Packet_Desc_Size = sizeof(struct B_UM_PACKET);
|
||||||
|
|
||||||
@@ -30,65 +41,95 @@ status_t b44_write(void *cookie,off_t pos,const void *data,size_t *numBytes);
|
|||||||
int32 b44_interrupt(void *cookie);
|
int32 b44_interrupt(void *cookie);
|
||||||
int32 tx_cleanup_thread(void *us);
|
int32 tx_cleanup_thread(void *us);
|
||||||
|
|
||||||
device_hooks b44_hooks = {b44_open,b44_close,b44_free,b44_ioctl,b44_read,b44_write,NULL,NULL,NULL,NULL};
|
|
||||||
|
|
||||||
status_t init_hardware(void) {
|
status_t
|
||||||
|
init_hardware(void)
|
||||||
|
{
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char **publish_devices() {
|
|
||||||
return dev_list;
|
const char **
|
||||||
|
publish_devices()
|
||||||
|
{
|
||||||
|
return (const char **)sDeviceNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
device_hooks *find_device(const char *name) {
|
|
||||||
|
device_hooks *
|
||||||
|
find_device(const char *name)
|
||||||
|
{
|
||||||
|
static device_hooks b44_hooks = {
|
||||||
|
b44_open,
|
||||||
|
b44_close,
|
||||||
|
b44_free,
|
||||||
|
b44_ioctl,
|
||||||
|
b44_read,
|
||||||
|
b44_write,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
return &b44_hooks;
|
return &b44_hooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t init_driver(void) {
|
|
||||||
|
status_t
|
||||||
|
init_driver(void)
|
||||||
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
pci_info dev_info;
|
pci_info dev_info;
|
||||||
|
|
||||||
if (pci == NULL)
|
|
||||||
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
|
||||||
|
|
||||||
while (pci->get_nth_pci_info(i++,&dev_info) == 0) {
|
|
||||||
if (!((dev_info.class_base == PCI_network) && (dev_info.class_sub == PCI_ethernet)
|
|
||||||
&& (dev_info.vendor_id == 0x14e4) && ((dev_info.device_id == 0x4401) || (dev_info.device_id == 0x4402) || (dev_info.device_id == 0x170c))))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (cards_found >= 10)
|
|
||||||
break;
|
|
||||||
|
|
||||||
dev_list[cards_found] = (char *)malloc(16 /* net/bcm440x/xx */);
|
|
||||||
sprintf(dev_list[cards_found],"net/bcm440x/%d",cards_found);
|
|
||||||
be_b44_dev_cards[cards_found].pci_data = dev_info;
|
|
||||||
be_b44_dev_cards[cards_found].packet_release_sem = create_sem(0,dev_list[cards_found]);
|
|
||||||
be_b44_dev_cards[cards_found].mem_list_num = 0;
|
|
||||||
be_b44_dev_cards[cards_found].lockmem_list_num = 0;
|
|
||||||
be_b44_dev_cards[cards_found].opened = 0;
|
|
||||||
be_b44_dev_cards[cards_found].block = 1;
|
|
||||||
be_b44_dev_cards[cards_found].lock = 0;
|
|
||||||
|
|
||||||
if (b44_LM_GetAdapterInfo(&be_b44_dev_cards[cards_found].lm_dev) != LM_STATUS_SUCCESS)
|
|
||||||
return ENODEV;
|
|
||||||
|
|
||||||
QQ_InitQueue(&be_b44_dev_cards[cards_found].RxPacketReadQ.Container,MAX_RX_PACKET_DESC_COUNT);
|
|
||||||
|
|
||||||
cards_found++;
|
|
||||||
}
|
|
||||||
|
|
||||||
mempool_init((MAX_RX_PACKET_DESC_COUNT+10) * cards_found);
|
|
||||||
|
|
||||||
dev_list[cards_found] = NULL;
|
|
||||||
|
|
||||||
|
if (pci == NULL)
|
||||||
|
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
||||||
|
|
||||||
|
while (pci->get_nth_pci_info(i++, &dev_info) == 0) {
|
||||||
|
if (dev_info.class_base != PCI_network
|
||||||
|
|| dev_info.class_sub != PCI_ethernet
|
||||||
|
|| dev_info.vendor_id != 0x14e4
|
||||||
|
|| (dev_info.device_id != 0x4401
|
||||||
|
&& dev_info.device_id != 0x4402
|
||||||
|
&& dev_info.device_id != 0x170c))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (sCardsFound >= MAX_CARDS)
|
||||||
|
break;
|
||||||
|
|
||||||
|
sDeviceNames[sCardsFound] = (char *)malloc(16 /* net/bcm440x/xx */);
|
||||||
|
sprintf(sDeviceNames[sCardsFound], "net/bcm440x/%d", sCardsFound);
|
||||||
|
be_b44_dev_cards[sCardsFound].pci_data = dev_info;
|
||||||
|
be_b44_dev_cards[sCardsFound].packet_release_sem = create_sem(0,
|
||||||
|
sDeviceNames[sCardsFound]);
|
||||||
|
be_b44_dev_cards[sCardsFound].mem_list_num = 0;
|
||||||
|
be_b44_dev_cards[sCardsFound].lockmem_list_num = 0;
|
||||||
|
be_b44_dev_cards[sCardsFound].opened = 0;
|
||||||
|
be_b44_dev_cards[sCardsFound].block = 1;
|
||||||
|
be_b44_dev_cards[sCardsFound].lock = 0;
|
||||||
|
|
||||||
|
if (b44_LM_GetAdapterInfo(&be_b44_dev_cards[sCardsFound].lm_dev) != LM_STATUS_SUCCESS)
|
||||||
|
return ENODEV;
|
||||||
|
|
||||||
|
QQ_InitQueue(&be_b44_dev_cards[sCardsFound].RxPacketReadQ.Container,
|
||||||
|
MAX_RX_PACKET_DESC_COUNT);
|
||||||
|
|
||||||
|
sCardsFound++;
|
||||||
|
}
|
||||||
|
|
||||||
|
mempool_init((MAX_RX_PACKET_DESC_COUNT+10) * sCardsFound);
|
||||||
|
|
||||||
|
sDeviceNames[sCardsFound] = NULL;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninit_driver(void) {
|
|
||||||
int i,j;
|
void
|
||||||
|
uninit_driver(void)
|
||||||
|
{
|
||||||
struct be_b44_dev *pUmDevice;
|
struct be_b44_dev *pUmDevice;
|
||||||
|
int i, j;
|
||||||
for (j = 0; j < cards_found; j++) {
|
|
||||||
|
for (j = 0; j < sCardsFound; j++) {
|
||||||
pUmDevice = &be_b44_dev_cards[j];
|
pUmDevice = &be_b44_dev_cards[j];
|
||||||
for (i = 0; i < pUmDevice->mem_list_num; i++)
|
for (i = 0; i < pUmDevice->mem_list_num; i++)
|
||||||
free(pUmDevice->mem_list[i]);
|
free(pUmDevice->mem_list[i]);
|
||||||
@@ -97,72 +138,84 @@ void uninit_driver(void) {
|
|||||||
|
|
||||||
delete_area(pUmDevice->mem_base);
|
delete_area(pUmDevice->mem_base);
|
||||||
|
|
||||||
free((void *)dev_list[j]);
|
free((void *)sDeviceNames[j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mempool_exit();
|
mempool_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t b44_open(const char *name, uint32 flags, void **cookie) {
|
|
||||||
|
status_t
|
||||||
|
b44_open(const char *name, uint32 flags, void **cookie)
|
||||||
|
{
|
||||||
struct be_b44_dev *pDevice = NULL;
|
struct be_b44_dev *pDevice = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
*cookie = NULL;
|
*cookie = NULL;
|
||||||
for (i = 0; i < cards_found; i++) {
|
for (i = 0; i < sCardsFound; i++) {
|
||||||
if (strcmp(dev_list[i],name) == 0) {
|
if (strcmp(sDeviceNames[i], name) == 0) {
|
||||||
*cookie = pDevice = &be_b44_dev_cards[i];
|
*cookie = pDevice = &be_b44_dev_cards[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*cookie == NULL)
|
if (*cookie == NULL)
|
||||||
return B_FILE_NOT_FOUND;
|
return B_FILE_NOT_FOUND;
|
||||||
|
|
||||||
if (atomic_or(&pDevice->opened,1)) {
|
if (atomic_or(&pDevice->opened,1)) {
|
||||||
*cookie = pDevice = NULL;
|
*cookie = pDevice = NULL;
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
install_io_interrupt_handler(pDevice->pci_data.u.h0.interrupt_line,b44_interrupt,*cookie,0);
|
install_io_interrupt_handler(pDevice->pci_data.u.h0.interrupt_line,
|
||||||
if (b44_LM_InitializeAdapter(&pDevice->lm_dev) != LM_STATUS_SUCCESS) {
|
b44_interrupt, *cookie, 0);
|
||||||
atomic_and(&pDevice->opened,0);
|
if (b44_LM_InitializeAdapter(&pDevice->lm_dev) != LM_STATUS_SUCCESS) {
|
||||||
remove_io_interrupt_handler(pDevice->pci_data.u.h0.interrupt_line,b44_interrupt,*cookie);
|
atomic_and(&pDevice->opened, 0);
|
||||||
|
remove_io_interrupt_handler(pDevice->pci_data.u.h0.interrupt_line,
|
||||||
|
b44_interrupt, *cookie);
|
||||||
*cookie = NULL;
|
*cookie = NULL;
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*QQ_InitQueue(&pDevice->rx_out_of_buf_q.Container,
|
/*QQ_InitQueue(&pDevice->rx_out_of_buf_q.Container,
|
||||||
MAX_RX_PACKET_DESC_COUNT);*/
|
MAX_RX_PACKET_DESC_COUNT);*/
|
||||||
|
|
||||||
b44_LM_EnableInterrupt(&pDevice->lm_dev);
|
b44_LM_EnableInterrupt(&pDevice->lm_dev);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t b44_close(void *cookie) {
|
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)(cookie);
|
status_t
|
||||||
|
b44_close(void *cookie)
|
||||||
|
{
|
||||||
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
||||||
if (cookie == NULL)
|
if (cookie == NULL)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
atomic_and(&pUmDevice->opened,0);
|
atomic_and(&pUmDevice->opened,0);
|
||||||
b44_LM_Halt(&pUmDevice->lm_dev);
|
b44_LM_Halt(&pUmDevice->lm_dev);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t b44_free(void *cookie) {
|
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)(cookie);
|
status_t
|
||||||
|
b44_free(void *cookie)
|
||||||
|
{
|
||||||
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
||||||
if (cookie == NULL)
|
if (cookie == NULL)
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
remove_io_interrupt_handler(pUmDevice->pci_data.u.h0.interrupt_line,b44_interrupt,cookie);
|
remove_io_interrupt_handler(pUmDevice->pci_data.u.h0.interrupt_line,
|
||||||
|
b44_interrupt, cookie);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t b44_ioctl(void *cookie,uint32 op,void *data,size_t len) {
|
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)(cookie);
|
status_t
|
||||||
|
b44_ioctl(void *cookie,uint32 op,void *data,size_t len)
|
||||||
|
{
|
||||||
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case ETHER_INIT:
|
case ETHER_INIT:
|
||||||
@@ -170,11 +223,11 @@ status_t b44_ioctl(void *cookie,uint32 op,void *data,size_t len) {
|
|||||||
case ETHER_GETADDR:
|
case ETHER_GETADDR:
|
||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
memcpy(data,pUmDevice->lm_dev.NodeAddress,6);
|
memcpy(data, pUmDevice->lm_dev.NodeAddress, 6);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
case ETHER_NONBLOCK:
|
case ETHER_NONBLOCK:
|
||||||
pUmDevice->block = !*((uint8 *)(data));
|
pUmDevice->block = !*((uint8 *)data);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
case ETHER_ADDMULTI:
|
case ETHER_ADDMULTI:
|
||||||
return (b44_LM_MulticastAdd(&pUmDevice->lm_dev,(PLM_UINT8)(data)) == LM_STATUS_SUCCESS) ? B_OK : B_ERROR;
|
return (b44_LM_MulticastAdd(&pUmDevice->lm_dev,(PLM_UINT8)(data)) == LM_STATUS_SUCCESS) ? B_OK : B_ERROR;
|
||||||
@@ -198,58 +251,62 @@ status_t b44_ioctl(void *cookie,uint32 op,void *data,size_t len) {
|
|||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 b44_interrupt(void *cookie) {
|
|
||||||
|
int32
|
||||||
|
b44_interrupt(void *cookie)
|
||||||
|
{
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
||||||
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK) pUmDevice;
|
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK) pUmDevice;
|
||||||
|
|
||||||
|
|
||||||
if (!pDevice->InitDone)
|
if (!pDevice->InitDone)
|
||||||
return B_UNHANDLED_INTERRUPT;
|
return B_UNHANDLED_INTERRUPT;
|
||||||
|
|
||||||
if (b44_LM_ServiceInterrupts(pDevice) == 12)
|
if (b44_LM_ServiceInterrupts(pDevice) == 12)
|
||||||
return B_UNHANDLED_INTERRUPT;
|
return B_UNHANDLED_INTERRUPT;
|
||||||
|
|
||||||
if (QQ_GetEntryCnt(&pDevice->RxPacketFreeQ.Container)) {
|
if (QQ_GetEntryCnt(&pDevice->RxPacketFreeQ.Container)) {
|
||||||
b44_LM_QueueRxPackets(pDevice);
|
b44_LM_QueueRxPackets(pDevice);
|
||||||
return B_INVOKE_SCHEDULER;
|
return B_INVOKE_SCHEDULER;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_HANDLED_INTERRUPT;
|
return B_HANDLED_INTERRUPT;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t b44_read(void *cookie,off_t pos,void *data,size_t *numBytes) {
|
|
||||||
|
status_t
|
||||||
|
b44_read(void *cookie, off_t pos, void *data, size_t *numBytes)
|
||||||
|
{
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
||||||
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK) pUmDevice;
|
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK) pUmDevice;
|
||||||
PLM_PACKET pPacket;
|
PLM_PACKET pPacket;
|
||||||
struct B_UM_PACKET *pUmPacket;
|
struct B_UM_PACKET *pUmPacket;
|
||||||
cpu_status cpu;
|
cpu_status cpu;
|
||||||
|
|
||||||
if (pUmDevice->block)
|
if (pUmDevice->block)
|
||||||
acquire_sem(pUmDevice->packet_release_sem);
|
acquire_sem(pUmDevice->packet_release_sem);
|
||||||
else
|
else
|
||||||
acquire_sem_etc(pUmDevice->packet_release_sem,1,B_RELATIVE_TIMEOUT,0); // Decrement the receive sem anyway, but don't block
|
acquire_sem_etc(pUmDevice->packet_release_sem,1,B_RELATIVE_TIMEOUT,0); // Decrement the receive sem anyway, but don't block
|
||||||
|
|
||||||
cpu = disable_interrupts();
|
cpu = disable_interrupts();
|
||||||
acquire_spinlock(&pUmDevice->lock);
|
acquire_spinlock(&pUmDevice->lock);
|
||||||
|
|
||||||
pPacket = (PLM_PACKET)
|
pPacket = (PLM_PACKET)
|
||||||
QQ_PopHead(&pUmDevice->RxPacketReadQ.Container);
|
QQ_PopHead(&pUmDevice->RxPacketReadQ.Container);
|
||||||
|
|
||||||
release_spinlock(&pUmDevice->lock);
|
release_spinlock(&pUmDevice->lock);
|
||||||
restore_interrupts(cpu);
|
restore_interrupts(cpu);
|
||||||
|
|
||||||
if (pPacket == 0) {
|
if (pPacket == 0) {
|
||||||
*numBytes = -1;
|
*numBytes = -1;
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
pUmPacket = (struct B_UM_PACKET *) pPacket;
|
pUmPacket = (struct B_UM_PACKET *)pPacket;
|
||||||
if ((pPacket->PacketStatus != LM_STATUS_SUCCESS) ||
|
if (pPacket->PacketStatus != LM_STATUS_SUCCESS
|
||||||
((pPacket->PacketSize) > 1518)) {
|
|| pPacket->PacketSize > 1518) {
|
||||||
|
|
||||||
cpu = disable_interrupts();
|
cpu = disable_interrupts();
|
||||||
acquire_spinlock(&pUmDevice->lock);
|
acquire_spinlock(&pUmDevice->lock);
|
||||||
|
|
||||||
QQ_PushTail(&pDevice->RxPacketFreeQ.Container, pPacket);
|
QQ_PushTail(&pDevice->RxPacketFreeQ.Container, pPacket);
|
||||||
|
|
||||||
release_spinlock(&pUmDevice->lock);
|
release_spinlock(&pUmDevice->lock);
|
||||||
@@ -257,113 +314,139 @@ status_t b44_read(void *cookie,off_t pos,void *data,size_t *numBytes) {
|
|||||||
*numBytes = -1;
|
*numBytes = -1;
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((pPacket->PacketSize/*-pDevice->rxoffset*/) < *numBytes)
|
if (pPacket->PacketSize/*-pDevice->rxoffset*/ < *numBytes)
|
||||||
*numBytes = pPacket->PacketSize/*-pDevice->rxoffset*/;
|
*numBytes = pPacket->PacketSize/*-pDevice->rxoffset*/;
|
||||||
|
|
||||||
memcpy(data,pUmPacket->data+pDevice->rxoffset,*numBytes);
|
memcpy(data, pUmPacket->data + pDevice->rxoffset, *numBytes);
|
||||||
cpu = disable_interrupts();
|
cpu = disable_interrupts();
|
||||||
acquire_spinlock(&pUmDevice->lock);
|
acquire_spinlock(&pUmDevice->lock);
|
||||||
|
|
||||||
QQ_PushTail(&pDevice->RxPacketFreeQ.Container, pPacket);
|
QQ_PushTail(&pDevice->RxPacketFreeQ.Container, pPacket);
|
||||||
|
|
||||||
release_spinlock(&pUmDevice->lock);
|
release_spinlock(&pUmDevice->lock);
|
||||||
restore_interrupts(cpu);
|
restore_interrupts(cpu);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t b44_write(void *cookie,off_t pos,const void *data,size_t *numBytes) {
|
|
||||||
|
status_t
|
||||||
|
b44_write(void *cookie, off_t pos, const void *data, size_t *numBytes)
|
||||||
|
{
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie;
|
||||||
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK) pUmDevice;
|
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK) pUmDevice;
|
||||||
PLM_PACKET pPacket;
|
PLM_PACKET pPacket;
|
||||||
struct B_UM_PACKET *pUmPacket;
|
struct B_UM_PACKET *pUmPacket;
|
||||||
|
|
||||||
/*if ((pDevice->LinkStatus == LM_STATUS_LINK_DOWN) || !pDevice->InitDone)
|
/*if ((pDevice->LinkStatus == LM_STATUS_LINK_DOWN) || !pDevice->InitDone)
|
||||||
{
|
{
|
||||||
return ENETDOWN;
|
return ENETDOWN;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
pPacket = (PLM_PACKET)
|
pPacket = (PLM_PACKET)
|
||||||
QQ_PopHead(&pDevice->TxPacketFreeQ.Container);
|
QQ_PopHead(&pDevice->TxPacketFreeQ.Container);
|
||||||
if (pPacket == 0)
|
if (pPacket == 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
pUmPacket = (struct B_UM_PACKET *) pPacket;
|
pUmPacket = (struct B_UM_PACKET *)pPacket;
|
||||||
pUmPacket->data = chunk_pool_get();
|
pUmPacket->data = chunk_pool_get();
|
||||||
|
|
||||||
memcpy(pUmPacket->data/*+pDevice->dataoffset*/,data,*numBytes); /* no guarantee data is contiguous, so we have to copy */
|
memcpy(pUmPacket->data/*+pDevice->dataoffset*/,data,*numBytes); /* no guarantee data is contiguous, so we have to copy */
|
||||||
pPacket->PacketSize = pUmPacket->size = *numBytes/*+pDevice->rxoffset*/;
|
pPacket->PacketSize = pUmPacket->size = *numBytes/*+pDevice->rxoffset*/;
|
||||||
|
|
||||||
pPacket->u.Tx.FragCount = 1;
|
pPacket->u.Tx.FragCount = 1;
|
||||||
|
|
||||||
tx_cleanup_thread(pUmDevice);
|
tx_cleanup_thread(pUmDevice);
|
||||||
|
|
||||||
b44_LM_SendPacket(pDevice, pPacket);
|
b44_LM_SendPacket(pDevice, pPacket);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- Broadcom MM hooks ----------- */
|
|
||||||
|
|
||||||
LM_STATUS b44_MM_ReadConfig16(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
// #pragma mark - Broadcom MM hooks
|
||||||
LM_UINT16 *pValue16) {
|
|
||||||
if (pci == NULL)
|
|
||||||
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
LM_STATUS
|
||||||
|
b44_MM_ReadConfig16(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
||||||
*pValue16 = (LM_UINT16)pci->read_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT16));
|
LM_UINT16 *pValue16)
|
||||||
return LM_STATUS_SUCCESS;
|
{
|
||||||
}
|
if (pci == NULL)
|
||||||
|
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
||||||
LM_STATUS b44_MM_WriteConfig16(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
|
||||||
LM_UINT16 Value16) {
|
*pValue16 = (LM_UINT16)pci->read_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT16));
|
||||||
if (pci == NULL)
|
return LM_STATUS_SUCCESS;
|
||||||
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
|
||||||
|
|
||||||
pci->write_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT16),(uint32)Value16);
|
|
||||||
return LM_STATUS_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_ReadConfig32(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
|
||||||
LM_UINT32 *pValue32) {
|
LM_STATUS
|
||||||
if (pci == NULL)
|
b44_MM_WriteConfig16(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
||||||
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
LM_UINT16 Value16)
|
||||||
|
{
|
||||||
*pValue32 = (LM_UINT32)pci->read_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT32));
|
if (pci == NULL)
|
||||||
return LM_STATUS_SUCCESS;
|
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
||||||
|
|
||||||
|
pci->write_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT16),(uint32)Value16);
|
||||||
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_WriteConfig32(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
|
||||||
LM_UINT32 Value32){
|
LM_STATUS
|
||||||
if (pci == NULL)
|
b44_MM_ReadConfig32(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
||||||
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
LM_UINT32 *pValue32)
|
||||||
|
{
|
||||||
pci->write_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT32),(uint32)Value32);
|
if (pci == NULL)
|
||||||
return LM_STATUS_SUCCESS;
|
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
||||||
|
|
||||||
|
*pValue32 = (LM_UINT32)pci->read_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT32));
|
||||||
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_MapMemBase(PLM_DEVICE_BLOCK pDevice) {
|
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)(pDevice);
|
LM_STATUS
|
||||||
size_t size = pUmDevice->pci_data.u.h0.base_register_sizes[0];
|
b44_MM_WriteConfig32(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Offset,
|
||||||
|
LM_UINT32 Value32)
|
||||||
if (pci == NULL)
|
{
|
||||||
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
if (pci == NULL)
|
||||||
|
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
||||||
size = ROUNDUP(size,B_PAGE_SIZE);
|
|
||||||
pUmDevice->mem_base = map_physical_memory("bcm440x_regs",(void *)(pUmDevice->pci_data.u.h0.base_registers[0]),size,B_ANY_KERNEL_BLOCK_ADDRESS,B_READ_AREA | B_WRITE_AREA,(void **)(&pDevice->pMappedMemBase));
|
pci->write_pci_config(((struct be_b44_dev *)(pDevice))->pci_data.bus,((struct be_b44_dev *)(pDevice))->pci_data.device,((struct be_b44_dev *)(pDevice))->pci_data.function,(uchar)Offset,sizeof(LM_UINT32),(uint32)Value32);
|
||||||
|
return LM_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LM_STATUS
|
||||||
|
b44_MM_MapMemBase(PLM_DEVICE_BLOCK pDevice)
|
||||||
|
{
|
||||||
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)(pDevice);
|
||||||
|
size_t size = pUmDevice->pci_data.u.h0.base_register_sizes[0];
|
||||||
|
|
||||||
|
if (pci == NULL)
|
||||||
|
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
||||||
|
|
||||||
|
size = ROUNDUP(size,B_PAGE_SIZE);
|
||||||
|
pUmDevice->mem_base = map_physical_memory("bcm440x_regs",(void *)(pUmDevice->pci_data.u.h0.base_registers[0]),size,B_ANY_KERNEL_BLOCK_ADDRESS,B_READ_AREA | B_WRITE_AREA,(void **)(&pDevice->pMappedMemBase));
|
||||||
|
|
||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*LM_STATUS b44_MM_MapIoBase(PLM_DEVICE_BLOCK pDevice) {
|
|
||||||
if (pci == NULL)
|
/*
|
||||||
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
LM_STATUS
|
||||||
|
b44_MM_MapIoBase(PLM_DEVICE_BLOCK pDevice)
|
||||||
|
{
|
||||||
|
if (pci == NULL)
|
||||||
|
get_module(B_PCI_MODULE_NAME,(module_info **)&pci);
|
||||||
|
|
||||||
pDevice->pMappedMemBase = pci->ram_address(((struct be_b44_dev *)(pDevice))->pci_data.memory_base);
|
pDevice->pMappedMemBase = pci->ram_address(((struct be_b44_dev *)(pDevice))->pci_data.memory_base);
|
||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
}*/
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
LM_STATUS b44_MM_IndicateRxPackets(PLM_DEVICE_BLOCK pDevice) {
|
|
||||||
|
LM_STATUS
|
||||||
|
b44_MM_IndicateRxPackets(PLM_DEVICE_BLOCK pDevice)
|
||||||
|
{
|
||||||
struct be_b44_dev *dev = (struct be_b44_dev *)pDevice;
|
struct be_b44_dev *dev = (struct be_b44_dev *)pDevice;
|
||||||
PLM_PACKET pPacket;
|
PLM_PACKET pPacket;
|
||||||
|
|
||||||
@@ -372,42 +455,49 @@ LM_STATUS b44_MM_IndicateRxPackets(PLM_DEVICE_BLOCK pDevice) {
|
|||||||
QQ_PopHead(&pDevice->RxPacketReceivedQ.Container);
|
QQ_PopHead(&pDevice->RxPacketReceivedQ.Container);
|
||||||
if (pPacket == 0)
|
if (pPacket == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
acquire_spinlock(&dev->lock);
|
acquire_spinlock(&dev->lock);
|
||||||
release_sem_etc(dev->packet_release_sem,1,B_DO_NOT_RESCHEDULE);
|
release_sem_etc(dev->packet_release_sem, 1, B_DO_NOT_RESCHEDULE);
|
||||||
release_spinlock(&dev->lock);
|
release_spinlock(&dev->lock);
|
||||||
QQ_PushTail(&dev->RxPacketReadQ.Container, pPacket);
|
QQ_PushTail(&dev->RxPacketReadQ.Container, pPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_IndicateTxPackets(PLM_DEVICE_BLOCK pDevice) {
|
|
||||||
|
LM_STATUS
|
||||||
|
b44_MM_IndicateTxPackets(PLM_DEVICE_BLOCK pDevice)
|
||||||
|
{
|
||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 tx_cleanup_thread(void *us) {
|
|
||||||
|
int32
|
||||||
|
tx_cleanup_thread(void *us)
|
||||||
|
{
|
||||||
PLM_PACKET pPacket;
|
PLM_PACKET pPacket;
|
||||||
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK)(us);
|
PLM_DEVICE_BLOCK pDevice = (PLM_DEVICE_BLOCK)(us);
|
||||||
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)(us);
|
struct be_b44_dev *pUmDevice = (struct be_b44_dev *)(us);
|
||||||
struct B_UM_PACKET *pUmPacket;
|
struct B_UM_PACKET *pUmPacket;
|
||||||
cpu_status cpu;
|
cpu_status cpu;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
cpu = disable_interrupts();
|
cpu = disable_interrupts();
|
||||||
acquire_spinlock(&pUmDevice->lock);
|
acquire_spinlock(&pUmDevice->lock);
|
||||||
|
|
||||||
pPacket = (PLM_PACKET)
|
pPacket = (PLM_PACKET)
|
||||||
QQ_PopHead(&pDevice->TxPacketXmittedQ.Container);
|
QQ_PopHead(&pDevice->TxPacketXmittedQ.Container);
|
||||||
|
|
||||||
release_spinlock(&pUmDevice->lock);
|
release_spinlock(&pUmDevice->lock);
|
||||||
restore_interrupts(cpu);
|
restore_interrupts(cpu);
|
||||||
if (pPacket == 0)
|
if (pPacket == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
pUmPacket = (struct B_UM_PACKET *)(pPacket);
|
pUmPacket = (struct B_UM_PACKET *)(pPacket);
|
||||||
chunk_pool_put(pUmPacket->data);
|
chunk_pool_put(pUmPacket->data);
|
||||||
pUmPacket->data = NULL;
|
pUmPacket->data = NULL;
|
||||||
|
|
||||||
cpu = disable_interrupts();
|
cpu = disable_interrupts();
|
||||||
acquire_spinlock(&pUmDevice->lock);
|
acquire_spinlock(&pUmDevice->lock);
|
||||||
QQ_PushTail(&pDevice->TxPacketFreeQ.Container, pPacket);
|
QQ_PushTail(&pDevice->TxPacketFreeQ.Container, pPacket);
|
||||||
@@ -420,40 +510,50 @@ int32 tx_cleanup_thread(void *us) {
|
|||||||
/*LM_STATUS b44_MM_StartTxDma(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket);
|
/*LM_STATUS b44_MM_StartTxDma(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket);
|
||||||
LM_STATUS b44_MM_CompleteTxDma(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket);*/
|
LM_STATUS b44_MM_CompleteTxDma(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket);*/
|
||||||
|
|
||||||
LM_STATUS b44_MM_AllocateMemory(PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlockSize,
|
|
||||||
PLM_VOID *pMemoryBlockVirt) {
|
LM_STATUS
|
||||||
struct be_b44_dev *dev = (struct be_b44_dev *)(pDevice);
|
b44_MM_AllocateMemory(PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlockSize,
|
||||||
|
PLM_VOID *pMemoryBlockVirt)
|
||||||
if (dev->mem_list_num == 16)
|
{
|
||||||
return LM_STATUS_FAILURE;
|
struct be_b44_dev *dev = (struct be_b44_dev *)(pDevice);
|
||||||
|
|
||||||
*pMemoryBlockVirt = dev->mem_list[(dev->mem_list_num)++] = (void *)malloc(BlockSize);
|
if (dev->mem_list_num == 16)
|
||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_FAILURE;
|
||||||
}
|
|
||||||
|
*pMemoryBlockVirt = dev->mem_list[(dev->mem_list_num)++] = (void *)malloc(BlockSize);
|
||||||
|
return LM_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_AllocateSharedMemory(PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlockSize,
|
|
||||||
PLM_VOID *pMemoryBlockVirt, PLM_PHYSICAL_ADDRESS pMemoryBlockPhy) {
|
LM_STATUS
|
||||||
struct be_b44_dev *dev;
|
b44_MM_AllocateSharedMemory(PLM_DEVICE_BLOCK pDevice, LM_UINT32 BlockSize,
|
||||||
void *pvirt = NULL;
|
PLM_VOID *pMemoryBlockVirt, PLM_PHYSICAL_ADDRESS pMemoryBlockPhy)
|
||||||
area_id area_desc;
|
{
|
||||||
physical_entry entry;
|
struct be_b44_dev *dev;
|
||||||
|
void *pvirt = NULL;
|
||||||
dev = (struct be_b44_dev *)(pDevice);
|
area_id area_desc;
|
||||||
area_desc = dev->lockmem_list[dev->lockmem_list_num++] = create_area("broadcom_shared_mem",&pvirt,B_ANY_KERNEL_ADDRESS,ROUND_UP_TO_PAGE(BlockSize),/*B_CONTIGUOUS | B_FULL_LOCK*/ B_LOMEM,B_READ_AREA | B_WRITE_AREA);
|
physical_entry entry;
|
||||||
|
|
||||||
if (pvirt == NULL)
|
dev = (struct be_b44_dev *)(pDevice);
|
||||||
return LM_STATUS_FAILURE;
|
area_desc = dev->lockmem_list[dev->lockmem_list_num++] = create_area("broadcom_shared_mem",
|
||||||
|
&pvirt, B_ANY_KERNEL_ADDRESS, ROUND_UP_TO_PAGE(BlockSize),
|
||||||
memset(pvirt, 0, BlockSize);
|
/*B_CONTIGUOUS*/ B_FULL_LOCK, B_READ_AREA | B_WRITE_AREA);
|
||||||
*pMemoryBlockVirt = (PLM_VOID) pvirt;
|
if (area_desc < B_OK)
|
||||||
|
return LM_STATUS_FAILURE;
|
||||||
get_memory_map(pvirt,BlockSize,&entry,1);
|
|
||||||
*pMemoryBlockPhy = (LM_PHYSICAL_ADDRESS) entry.address;
|
memset(pvirt, 0, BlockSize);
|
||||||
|
*pMemoryBlockVirt = (PLM_VOID) pvirt;
|
||||||
return LM_STATUS_SUCCESS;
|
|
||||||
|
get_memory_map(pvirt,BlockSize,&entry,1);
|
||||||
|
*pMemoryBlockPhy = (LM_PHYSICAL_ADDRESS) entry.address;
|
||||||
|
|
||||||
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_GetConfig(PLM_DEVICE_BLOCK pDevice){
|
|
||||||
|
LM_STATUS
|
||||||
|
b44_MM_GetConfig(PLM_DEVICE_BLOCK pDevice)
|
||||||
|
{
|
||||||
pDevice->DisableAutoNeg = FALSE;
|
pDevice->DisableAutoNeg = FALSE;
|
||||||
pDevice->RequestedLineSpeed = LM_LINE_SPEED_AUTO;
|
pDevice->RequestedLineSpeed = LM_LINE_SPEED_AUTO;
|
||||||
pDevice->RequestedDuplexMode = LM_DUPLEX_MODE_FULL;
|
pDevice->RequestedDuplexMode = LM_DUPLEX_MODE_FULL;
|
||||||
@@ -464,17 +564,21 @@ LM_STATUS b44_MM_GetConfig(PLM_DEVICE_BLOCK pDevice){
|
|||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_IndicateStatus(PLM_DEVICE_BLOCK pDevice, LM_STATUS Status) {
|
|
||||||
|
LM_STATUS
|
||||||
|
b44_MM_IndicateStatus(PLM_DEVICE_BLOCK pDevice, LM_STATUS Status)
|
||||||
|
{
|
||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LM_STATUS
|
LM_STATUS
|
||||||
b44_MM_InitializeUmPackets(PLM_DEVICE_BLOCK pDevice)
|
b44_MM_InitializeUmPackets(PLM_DEVICE_BLOCK pDevice)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct B_UM_PACKET *pUmPacket;
|
struct B_UM_PACKET *pUmPacket;
|
||||||
PLM_PACKET pPacket;
|
PLM_PACKET pPacket;
|
||||||
|
|
||||||
for (i = 0; i < pDevice->RxPacketDescCnt; i++) {
|
for (i = 0; i < pDevice->RxPacketDescCnt; i++) {
|
||||||
pPacket = QQ_PopHead(&pDevice->RxPacketFreeQ.Container);
|
pPacket = QQ_PopHead(&pDevice->RxPacketFreeQ.Container);
|
||||||
pUmPacket = (struct B_UM_PACKET *) pPacket;
|
pUmPacket = (struct B_UM_PACKET *) pPacket;
|
||||||
@@ -490,9 +594,12 @@ b44_MM_InitializeUmPackets(PLM_DEVICE_BLOCK pDevice)
|
|||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
LM_STATUS b44_MM_FreeRxBuffer(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket) {
|
|
||||||
|
LM_STATUS
|
||||||
|
b44_MM_FreeRxBuffer(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket)
|
||||||
|
{
|
||||||
struct B_UM_PACKET *pUmPacket;
|
struct B_UM_PACKET *pUmPacket;
|
||||||
pUmPacket = (struct B_UM_PACKET *) pPacket;
|
pUmPacket = (struct B_UM_PACKET *)pPacket;
|
||||||
chunk_pool_put(pUmPacket->data);
|
chunk_pool_put(pUmPacket->data);
|
||||||
pUmPacket->data = NULL;
|
pUmPacket->data = NULL;
|
||||||
return LM_STATUS_SUCCESS;
|
return LM_STATUS_SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user