diff --git a/src/add-ons/kernel/drivers/network/bcm440x/b44mm.h b/src/add-ons/kernel/drivers/network/bcm440x/b44mm.h index dd4f43d919..f1fb739a98 100644 --- a/src/add-ons/kernel/drivers/network/bcm440x/b44mm.h +++ b/src/add-ons/kernel/drivers/network/bcm440x/b44mm.h @@ -82,6 +82,10 @@ struct be_b44_dev { int block; spinlock lock; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + sem_id linkChangeSem; +#endif }; struct B_UM_PACKET { diff --git a/src/add-ons/kernel/drivers/network/bcm440x/b44um.c b/src/add-ons/kernel/drivers/network/bcm440x/b44um.c index 49b4357cae..ac4ab88a52 100644 --- a/src/add-ons/kernel/drivers/network/bcm440x/b44um.c +++ b/src/add-ons/kernel/drivers/network/bcm440x/b44um.c @@ -109,6 +109,9 @@ init_driver(void) be_b44_dev_cards[sCardsFound].opened = 0; be_b44_dev_cards[sCardsFound].block = 1; be_b44_dev_cards[sCardsFound].lock = 0; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + be_b44_dev_cards[sCardsFound].linkChangeSem = -1; +#endif if (b44_LM_GetAdapterInfo(&be_b44_dev_cards[sCardsFound].lm_dev) != LM_STATUS_SUCCESS) return ENODEV; @@ -216,7 +219,7 @@ b44_free(void *cookie) status_t -b44_ioctl(void *cookie,uint32 op,void *data,size_t len) +b44_ioctl(void *cookie,uint32 op, void *data, size_t len) { struct be_b44_dev *pUmDevice = (struct be_b44_dev *)cookie; @@ -278,6 +281,16 @@ b44_ioctl(void *cookie,uint32 op,void *data,size_t len) return user_memcpy(data, &state, sizeof(ether_link_state_t)); } + + case ETHER_SET_LINK_STATE_SEM: + { + if (user_memcpy(&pUmDevice->linkChangeSem, data, sizeof(sem_id)) < B_OK) { + pUmDevice->linkChangeSem = -1; + return B_BAD_ADDRESS; + } + return B_OK; + } + #endif } return B_ERROR; @@ -600,6 +613,14 @@ b44_MM_GetConfig(PLM_DEVICE_BLOCK pDevice) LM_STATUS b44_MM_IndicateStatus(PLM_DEVICE_BLOCK pDevice, LM_STATUS Status) { +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + struct be_b44_dev *pUmDevice = (struct be_b44_dev *)pDevice; + + if (pUmDevice->linkChangeSem != -1) + release_sem_etc(pUmDevice->linkChangeSem, 1, + B_DO_NOT_RESCHEDULE); +#endif + return LM_STATUS_SUCCESS; } diff --git a/src/add-ons/kernel/drivers/network/bcm570x/b57um.c b/src/add-ons/kernel/drivers/network/bcm570x/b57um.c index a57eba1569..94d9e200c7 100644 --- a/src/add-ons/kernel/drivers/network/bcm570x/b57um.c +++ b/src/add-ons/kernel/drivers/network/bcm570x/b57um.c @@ -327,6 +327,9 @@ init_driver(void) be_b57_dev_cards[cards_found].opened = 0; be_b57_dev_cards[cards_found].block = 1; be_b57_dev_cards[cards_found].lock = 0; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + be_b57_dev_cards[cards_found].linkChangeSem = -1; +#endif if (LM_GetAdapterInfo(&be_b57_dev_cards[cards_found].lm_dev) != LM_STATUS_SUCCESS) { put_module(B_PCI_MODULE_NAME); @@ -519,6 +522,15 @@ b57_ioctl(void *cookie,uint32 op,void *data,size_t len) return user_memcpy(data, &state, sizeof(ether_link_state_t)); } + case ETHER_SET_LINK_STATE_SEM: + { + if (user_memcpy(&pUmDevice->linkChangeSem, data, sizeof(sem_id)) < B_OK) { + pUmDevice->linkChangeSem = -1; + return B_BAD_ADDRESS; + } + return B_OK; + } + #endif } return B_ERROR; @@ -909,7 +921,16 @@ MM_GetConfig(PLM_DEVICE_BLOCK pDevice) LM_STATUS -MM_IndicateStatus(PLM_DEVICE_BLOCK pDevice, LM_STATUS Status) { +MM_IndicateStatus(PLM_DEVICE_BLOCK pDevice, LM_STATUS Status) +{ +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + struct be_b57_dev *pUmDevice = (struct be_b57_dev *)pDevice; + + if (pUmDevice->linkChangeSem != -1) + release_sem_etc(pUmDevice->linkChangeSem, 1, + B_DO_NOT_RESCHEDULE); +#endif + return LM_STATUS_SUCCESS; } diff --git a/src/add-ons/kernel/drivers/network/bcm570x/mm.h b/src/add-ons/kernel/drivers/network/bcm570x/mm.h index 8067f23e08..1193df6ec5 100644 --- a/src/add-ons/kernel/drivers/network/bcm570x/mm.h +++ b/src/add-ons/kernel/drivers/network/bcm570x/mm.h @@ -84,6 +84,10 @@ struct be_b57_dev { int block; spinlock lock; cpu_status cpu; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + sem_id linkChangeSem; +#endif }; struct B_UM_PACKET {