Commit 8ad47a57 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Added non-functional code for driver unload.

parent 722a5f16
......@@ -392,7 +392,6 @@ static void hijackedInt(DRV_CTRL *pDrvCtrl)
tag = &pDrvCtrl->rbdTags[hijack[unit].irqRbdIndex]) {
unsigned char *data;
int length, newlength, ether_type;
// struct hijacknet_hook *hook;
data = (unsigned char*)tag->pMblk->mBlkHdr.mData;
length = status & 0x3fff;
......@@ -577,54 +576,67 @@ static int fei_hijacknet_send(HIJACKNET_DRIVER *driver,
}
static int fei_hijacknet_close(HIJACKNET_DRIVER *driver)
{
printf("IMPLEMENT %s\n", __FUNCTION__);
#if 0
int hijacknet_uninstall(int unit)
{
int result = 0;
END_OBJ *interface;
int old_level;
struct hijack *hijack;
DRV_CTRL *drv;
VOIDFUNCPTR *vector;
int old_level;
printf("NOT USING new %s (driver still stuck in memory)\n", __FUNCTION__);
goto out;
if (unit < 0 || unit >= NUM_INTERFACES) {
printf("Index out of bounds %d\n", unit);
hijack = driver_to_hijack(driver);
if (hijack == NULL) {
result = 1;
goto out;
}
interface = endFindByName("fei", unit);
if (interface == NULL) {
printf("Failed to find fei%d\n", unit);
drv = hijack->drv;
vector = INUM_TO_IVEC (drv->board.vector);
old_level = intLock();
hijack->active--;
if (hijack->active > 0) {
/* Somebody else has driver open */
result = 2;
goto out;
goto out_unlock;
}
drv = (DRV_CTRL*)interface;
vector = INUM_TO_IVEC (drv->board.vector);
if (pciIntDisconnect2(vector, hijack_irq_handler, (int)drv) != 0) {
printf("Failed to disconnect hijack_irq_handler from fei%d\n", unit);
if (pciIntDisconnect2(vector, hijackedInt, (int)drv) != 0) {
result = 3;
goto out;
goto out_unlock;
}
old_level = intLock();
hijack[unit].active = 0;
hijack[unit].receive_hook = NULL;
hijack[unit].send_hook = NULL;
intUnlock(old_level);
drv->endObj.pFuncTable = hijack->origNetFuncs;
pciIntConnect(vector, fei82557Int, (int)drv);
printf("fei%d connected to fei82557Int\n", unit);
result = 4;
out_unlock:
intUnlock(old_level);
out:
switch (result) {
case 1: {
printf("No corresponding hijack for driver %p\n", driver);
} break;
case 2: {
printf("More processes using hijack driver\n");
} break;
case 3: {
printf("Failed to disconnect hijack_irq_handler from fei\n");
} break;
case 4: {
printf("fei reconnected to fei82557Int\n");
} break;
default: {
printf("Unknown result %d\n", result);
} break;
}
out:
return result;
}
#endif
return 0;
}
HIJACKNET_DRIVER *fei_hijacknet_open(int unit)
{
HIJACKNET_DRIVER *result = NULL;
int error = 0;
int error = 0, info = 0;
END_OBJ *interface;
DRV_CTRL *drv;
VOIDFUNCPTR *vector;
......@@ -639,6 +651,11 @@ HIJACKNET_DRIVER *fei_hijacknet_open(int unit)
goto out;
}
result = &hijack[unit].driver;
if (hijack[unit].active >= 1) {
snprintf(msg, sizeof(msg), "Locking hijack driver fei%d in memory\n", unit);
info = 1;
goto out;
}
hijack[unit].active++;
if (hijack[unit].active > 1) {
/* device has already been successfully opened */
......@@ -691,7 +708,9 @@ error_out:
hijack[unit].active--;
out:
intUnlock(old_level);
if (error) {
if (info) {
printf("%s", msg);
} else if (error) {
printf("%s", msg);
result = NULL;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment