This partially removes the changes made in r7099:

Apparently, the net_server does not use read()/write() but the kernel
syscalls directly. Even worse, it obviously ignores error values like
B_WOULD_BLOCK - the return length has to be set even in case of error.
The driver did not work at all under R5 net_server since then...
Some other minor changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12474 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-04-26 17:14:24 +00:00
parent 81012f638c
commit 24e4add56f
@@ -313,14 +313,14 @@ device_close(void *data)
// cancel timer
cancel_timer(&info->timer);
// disable the transmitter's and receiver's state machine
write32(info->registers + SiS900_MAC_COMMAND,
SiS900_MAC_CMD_Rx_DISABLE | SiS900_MAC_CMD_Tx_DISABLE);
// remove & disable interrupt
sis900_disableInterrupts(info);
remove_io_interrupt_handler(info->pciInfo->u.h0.interrupt_line, sis900_interrupt, info);
// disable the transmitter's and receiver's state machine
write32(info->registers + SiS900_MAC_COMMAND,
SiS900_MAC_CMD_Rx_DISABLE | SiS900_MAC_CMD_Tx_DISABLE);
delete_sem(info->rxSem);
delete_sem(info->txSem);
@@ -379,8 +379,8 @@ device_ioctl(void *data, uint32 msg, void *buffer, size_t bufferLength)
return B_OK;
case ETHER_NONBLOCK:
TRACE(("ioctl: non blocking ? %s\n", info->blockFlag ? "yes" : "no"));
info->blockFlag = *(int32 *)buffer ? B_TIMEOUT : 0;
TRACE(("ioctl: non blocking ? %s\n", info->blockFlag ? "yes" : "no"));
return B_NO_ERROR;
case ETHER_ADDMULTI:
@@ -414,20 +414,24 @@ device_read(void *data, off_t pos, void *buffer, size_t *_length)
uint32 check;
int16 current;
#ifndef __HAIKU__
*_length = 0;
// net_server work-around; it obviously doesn't care about error conditions
// For Haiku, this can be removed
#endif
if (checkDeviceInfo(info = data) != B_OK)
return B_BAD_VALUE;
//dprintf("read: rx: isr = %d, free = %d, current = %d\n",
// info->rxInterruptIndex, info->rxFree, info->rxCurrent);
blockFlag = info->blockFlag;
TRACE(("read: rx: isr = %d, free = %d, current = %d, blockFlag = %lx\n",
info->rxInterruptIndex, info->rxFree, info->rxCurrent, blockFlag));
// read is not reentrant
if (atomic_or(&info->rxLock, 1))
return B_ERROR;
//TRACE(("current rx descr: %08x (last = %ld)\n", rxp = read32(info->registers + SiS900_MAC_Rx_DESCR), (info->rxLast+1) % NUM_Rx_DESCR));
// block until data is available (if blocking is allowed)
if ((status = acquire_sem_etc(info->rxSem, 1, B_CAN_INTERRUPT | blockFlag, 0)) != B_NO_ERROR) {
TRACE(("cannot acquire read sem: %lx, %s\n", status, strerror(status)));