diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/ntos/ndis/lt200 | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/ntos/ndis/lt200')
28 files changed, 6119 insertions, 0 deletions
diff --git a/private/ntos/ndis/lt200/lt200.rc b/private/ntos/ndis/lt200/lt200.rc new file mode 100644 index 000000000..666e93c84 --- /dev/null +++ b/private/ntos/ndis/lt200/lt200.rc @@ -0,0 +1,38 @@ +#include <windows.h> +#include <ntverp.h> + +/*-----------------------------------------------*/ +/* the following lines are specific to this file */ +/*-----------------------------------------------*/ + +/* VER_FILETYPE, VER_FILESUBTYPE, VER_FILEDESCRIPTION_STR + * and VER_INTERNALNAME_STR must be defined before including COMMON.VER + * The strings don't need a '\0', since common.ver has them. + */ +#define VER_FILETYPE VFT_DRV +/* possible values: VFT_UNKNOWN + VFT_APP + VFT_DLL + VFT_DRV + VFT_FONT + VFT_VXD + VFT_STATIC_LIB +*/ +#define VER_FILESUBTYPE VFT2_DRV_NETWORK +/* possible values VFT2_UNKNOWN + VFT2_DRV_PRINTER + VFT2_DRV_KEYBOARD + VFT2_DRV_LANGUAGE + VFT2_DRV_DISPLAY + VFT2_DRV_MOUSE + VFT2_DRV_NETWORK + VFT2_DRV_SYSTEM + VFT2_DRV_INSTALLABLE + VFT2_DRV_SOUND + VFT2_DRV_COMM +*/ +#define VER_FILEDESCRIPTION_STR "DayStar Digital LT200 LocalTalk Card Driver" +#define VER_INTERNALNAME_STR "LT200.SYS" + +#include "common.ver" + diff --git a/private/ntos/ndis/lt200/ltdebug.h b/private/ntos/ndis/lt200/ltdebug.h new file mode 100644 index 000000000..5bf42fafd --- /dev/null +++ b/private/ntos/ndis/lt200/ltdebug.h @@ -0,0 +1,103 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltdebug.h + +Abstract: + + This module contains the debug code. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTDEBUG_ +#define _LTDEBUG_ + +// Debug Levels used with DBGPRINT +#define DBG_LEVEL_LOW 0 +#define DBG_LEVEL_ENTRY 0x1000 +#define DBG_LEVEL_INFO 0x5000 +#define DBG_LEVEL_WARN 0x6000 +#define DBG_LEVEL_ERR 0x7000 +#define DBG_LEVEL_FATAL 0x8000 + +// Component Types +#define DBG_COMP_INIT 0x00000001 +#define DBG_COMP_DEINIT 0x00000002 +#define DBG_COMP_SEND 0x00000004 +#define DBG_COMP_RECV 0x00000008 +#define DBG_COMP_LOOP 0x00000010 +#define DBG_COMP_REQ 0x00000020 +#define DBG_COMP_REGISTRY 0x00000040 +#define DBG_COMP_NDIS 0x00000080 +#define DBG_COMP_REF 0x00000100 +#define DBG_COMP_TIMER 0x00000200 +#define DBG_COMP_UTILS 0x00000400 +#define DBG_COMP_ALL 0xffffffff + +// File Ids used for errorlogging +#define LTRECV 0x00010000 +#define LTSEND 0x00020000 +#define LTREG 0x00040000 +#define LTRESET 0x00080000 +#define LTTIMER 0x00100000 +#define LTFIRM 0x00200000 +#define LTREQ 0x00400000 +#define LTUTILS 0x00800000 +#define LTLOOP 0x01000000 +#define LTINIT 0x02000000 + + +// Macro we use to do our errorlogging. +#define LOGERROR(Adapter, ErrorCode) \ + { \ + NdisWriteErrorLogEntry( \ + Adapter, \ + ErrorCode, \ + 1, \ + FILENUM | __LINE__); \ + } + +#if DBG + +#define TMPLOGERR() (DbgPrint("LT200: TMP LOG ERROR %s %lx\n", __FILE__, __LINE__)) + +#define DBGPRINT(Component, Level, Fmt) \ + { \ + if ((LtDebugSystems & Component) && (Level >= LtDebugLevel)) \ + { \ + DbgPrint(" *** LT200 - "); \ + DbgPrint Fmt; \ + } \ + } + +#define DBGBREAK(Level) \ + { \ + if (Level >= LtDebugLevel) { \ + DbgBreakPoint(); \ + } \ + } + +#else +#define TMPLOGERR() +#define DBGPRINT(Component, Level, Fmt) +#define DBGBREAK(Level) +#endif + + +#ifdef LTDEBUG_LOCALS + +#endif // LTDEBUG_LOCALS + +#endif // _LTDEBUG_ diff --git a/private/ntos/ndis/lt200/ltfirm.c b/private/ntos/ndis/lt200/ltfirm.c new file mode 100644 index 000000000..b5c4c2ddd --- /dev/null +++ b/private/ntos/ndis/lt200/ltfirm.c @@ -0,0 +1,755 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltfirm.c + +Abstract: + + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define LTFIRM_H_LOCALS +#include "ltmain.h" +#include "ltfirm.h" + +// Define file id for errorlogging +#define FILENUM LTFIRM + +UCHAR LtMicroCode[] = +{ +#ifndef OLD_FIRMWARE + 0x3A, 0x03, 0x00, 0x32, 0x93, 0x0A, 0x21, 0x8E, 0x0F, 0x3E, + 0x55, 0x77, 0xBE, 0x20, 0x09, 0x3E, 0xAA, 0x77, 0xBE, 0x20, + 0x03, 0x23, 0x18, 0xF1, 0x22, 0x91, 0x0A, 0xF9, 0x11, 0x95, + 0x0A, 0x21, 0x8E, 0x0F, 0xB7, 0xED, 0x52, 0x4D, 0x44, 0x0B, + 0x6B, 0x62, 0x13, 0x36, 0x00, 0xED, 0xB0, 0x3E, 0x10, 0xED, + 0x39, 0x33, 0x3E, 0x00, 0xED, 0x39, 0x32, 0xED, 0x39, 0x36, + 0x3E, 0x0C, 0xED, 0x39, 0x31, 0x3E, 0xC3, 0x21, 0x26, 0x02, + 0x32, 0x38, 0x00, 0x22, 0x39, 0x00, 0xED, 0x56, 0xCD, 0x1D, + 0x02, 0xFB, 0xCD, 0x3B, 0x0A, 0x18, 0xA9, 0x43, 0x6F, 0x70, + 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, + 0x20, 0x31, 0x39, 0x38, 0x38, 0x20, 0x2D, 0x20, 0x31, 0x39, + 0x39, 0x31, 0x2C, 0x20, 0x50, 0x72, 0x69, 0x6E, 0x74, 0x69, + 0x6E, 0x67, 0x20, 0x43, 0x6F, 0x6D, 0x6D, 0x75, 0x6E, 0x69, + 0x63, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x73, 0x20, 0x41, 0x73, + 0x73, 0x6F, 0x63, 0x69, 0x61, 0x74, 0x65, 0x73, 0x2E, 0x20, + 0x20, 0x41, 0x6C, 0x6C, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, + 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x2E, 0x20, 0x20, 0x04, 0x04, 0x16, 0x28, 0xFF, 0x3C, 0x04, + 0x60, 0x0A, 0xE0, 0x06, 0x00, 0x07, 0x7E, 0x02, 0x40, 0x0B, + 0xF6, 0x0C, 0x06, 0x0D, 0x00, 0x0E, 0xC1, 0x0F, 0x00, 0x05, + 0x60, 0x03, 0xC0, 0x01, 0x00, 0x09, 0x08, 0x3E, 0x03, 0xD3, + 0x52, 0x3E, 0xC0, 0xD3, 0x52, 0xC9, 0x3E, 0x03, 0xD3, 0x52, + 0x3E, 0xD5, 0xD3, 0x52, 0xC9, 0x3E, 0x05, 0xD3, 0x52, 0x3E, + 0xE0, 0xD3, 0x52, 0xC9, 0x3E, 0x05, 0xD3, 0x52, 0x3E, 0xE0, + 0xD3, 0x52, 0xC9, 0x3E, 0x05, 0xD3, 0x52, 0x3E, 0x60, 0xD3, + 0x52, 0xC9, 0x06, 0x1C, 0x21, 0xB3, 0x01, 0x0E, 0x52, 0xED, + 0xA3, 0xC2, 0x03, 0x02, 0x21, 0x26, 0x02, 0x22, 0x40, 0x00, + 0x3A, 0x03, 0x00, 0xE6, 0x01, 0xC0, 0x3E, 0x0B, 0xED, 0x79, + 0x3E, 0x76, 0xED, 0x79, 0xC9, 0x21, 0xB5, 0x0A, 0x36, 0x84, + 0xCD, 0xFC, 0x01, 0xC9, 0xF5, 0xC5, 0xD5, 0xE5, 0x2A, 0x95, + 0x0A, 0x0E, 0x53, 0x11, 0x62, 0x02, 0x43, 0x14, 0xED, 0xA2, + 0x3A, 0xB2, 0x01, 0x5F, 0xDB, 0x52, 0xE6, 0x01, 0x20, 0x06, + 0x1D, 0x20, 0xF7, 0xC3, 0x10, 0x03, 0x3E, 0x01, 0xD3, 0x52, + 0xDB, 0x52, 0x5F, 0xE6, 0xA0, 0x20, 0x0A, 0xED, 0xA2, 0x20, + 0xE1, 0x15, 0x20, 0xDE, 0xC3, 0x0E, 0x03, 0xED, 0xA2, 0x7B, + 0xE6, 0x60, 0xC2, 0x14, 0x03, 0x3E, 0x30, 0xD3, 0x52, 0x3E, + 0x01, 0xD3, 0x52, 0xAF, 0xD3, 0x52, 0xED, 0x5B, 0x95, 0x0A, + 0x2B, 0x37, 0xED, 0x52, 0xDA, 0x12, 0x03, 0x22, 0x97, 0x0A, + 0x62, 0x6B, 0x3A, 0x99, 0x0A, 0xBE, 0x20, 0x51, 0x3E, 0x01, + 0x32, 0x9D, 0x0A, 0x23, 0x23, 0x3E, 0x84, 0xBE, 0x20, 0x2C, + 0x36, 0x85, 0x2B, 0x46, 0x3A, 0x99, 0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x0A, 0x77, 0x23, + 0x77, 0x23, 0x36, 0x81, 0xAF, 0x32, 0x9D, 0x0A, 0xDD, 0x2B, + 0xDD, 0xE5, 0xE1, 0x7C, 0xB5, 0x28, 0x2A, 0x21, 0xBD, 0x0A, + 0x11, 0x03, 0x00, 0xCD, 0xCD, 0x04, 0x11, 0xE8, 0x03, 0x1B, + 0x7B, 0xB2, 0x20, 0xFB, 0x3A, 0x9D, 0x0A, 0xB7, 0x28, 0xE0, + 0x3A, 0x99, 0x0A, 0x47, 0x3E, 0x07, 0x80, 0xE6, 0x7F, 0x47, + 0x3A, 0xBC, 0x0A, 0xB0, 0x32, 0x99, 0x0A, 0x18, 0xA6, 0xDD, + 0xE1, 0xC9, 0xB7, 0xDD, 0x34, 0x00, 0xC0, 0xDD, 0x34, 0x01, + 0xC0, 0xDD, 0x34, 0x02, 0xC0, 0xDD, 0x34, 0x03, 0xC0, 0x37, + 0xC9, 0x06, 0x08, 0x0E, 0x00, 0x1F, 0x30, 0x01, 0x0C, 0x10, + 0xFA, 0x79, 0xC9, 0x21, 0x02, 0x00, 0x39, 0x5E, 0x23, 0x56, + 0x23, 0x4E, 0x23, 0x46, 0x23, 0x7E, 0x23, 0x66, 0x69, 0x4F, + 0x78, 0x44, 0x67, 0xED, 0xB0, 0xC9, 0x21, 0x02, 0x00, 0x39, + 0x7E, 0x23, 0x66, 0x6F, 0x3E, 0x11, 0xED, 0x39, 0x30, 0x7D, + 0xED, 0x39, 0x28, 0x7C, 0xED, 0x39, 0x29, 0x3E, 0x00, 0xED, + 0x39, 0x2A, 0x3E, 0x40, 0xED, 0x39, 0x2B, 0x3E, 0x00, 0xED, + 0x39, 0x2C, 0x21, 0x80, 0x02, 0x7D, 0xED, 0x39, 0x2E, 0x7C, + 0xED, 0x39, 0x2F, 0x3E, 0x91, 0xED, 0x39, 0x30, 0xD3, 0x44, + 0x3A, 0x94, 0x0A, 0xD3, 0x42, 0xC9, 0x21, 0x02, 0x00, 0x39, + 0x7E, 0x23, 0x66, 0x6F, 0x3E, 0x21, 0xED, 0x39, 0x30, 0x3E, + 0x40, 0xED, 0x39, 0x20, 0x3E, 0x00, 0xED, 0x39, 0x21, 0xED, + 0x39, 0x22, 0x7D, 0xED, 0x39, 0x23, 0x7C, 0xED, 0x39, 0x24, + 0x3E, 0x00, 0xED, 0x39, 0x25, 0x21, 0x80, 0x02, 0x7D, 0xED, + 0x39, 0x26, 0x7C, 0xED, 0x39, 0x27, 0x3E, 0x61, 0xED, 0x39, + 0x30, 0xD3, 0x43, 0x3A, 0x94, 0x0A, 0xD3, 0x42, 0xC9, 0xED, + 0x38, 0x2E, 0x5F, 0xED, 0x38, 0x2F, 0x57, 0xED, 0x38, 0x2E, + 0x6F, 0xED, 0x38, 0x2F, 0x67, 0xB7, 0xED, 0x52, 0x20, 0xEB, + 0x21, 0x80, 0x02, 0xB7, 0xED, 0x52, 0xC9, 0xED, 0x38, 0x26, + 0x5F, 0xED, 0x38, 0x27, 0x57, 0xED, 0x38, 0x26, 0x6F, 0xED, + 0x38, 0x27, 0x67, 0xB7, 0xED, 0x52, 0x20, 0xEB, 0x21, 0x80, + 0x02, 0xB7, 0xED, 0x52, 0xC9, 0xCD, 0x69, 0x0A, 0xDD, 0x6E, + 0x06, 0xDD, 0x66, 0x07, 0x7E, 0x23, 0x6E, 0x67, 0xC3, 0x75, + 0x0A, 0xCD, 0x69, 0x0A, 0x21, 0x00, 0x00, 0x22, 0xCC, 0x0A, + 0x22, 0xC5, 0x0A, 0x22, 0xC7, 0x0A, 0x21, 0x8E, 0x0F, 0x22, + 0xCE, 0x0A, 0xED, 0x5B, 0xCE, 0x0A, 0x2A, 0x91, 0x0A, 0xB7, + 0xED, 0x52, 0x11, 0x00, 0xFF, 0x19, 0x22, 0xCA, 0x0A, 0xCB, + 0x7C, 0x28, 0x06, 0x21, 0x00, 0x7D, 0x22, 0xCA, 0x0A, 0x2A, + 0xCE, 0x0A, 0xE5, 0xCD, 0x24, 0x03, 0xC3, 0x75, 0x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0x0A, 0xED, + 0x52, 0xC9, 0x7C, 0xE6, 0x80, 0xED, 0x52, 0x3C, 0xC9, 0xE1, + 0xFD, 0xE5, 0xDD, 0xE5, 0xDD, 0x21, 0x00, 0x00, 0xDD, 0x39, + 0xE9, 0xDD, 0xF9, 0xDD, 0xE1, 0xFD, 0xE1, 0xC9, 0xE9, 0xE1, + 0xFD, 0xE5, 0xDD, 0xE5, 0xDD, 0x21, 0x00, 0x00, 0xDD, 0x39, + 0x5E, 0x23, 0x56, 0x23, 0xEB, 0x39, 0xF9, 0xEB, 0xE9, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +#else + 0x3A, 0x03, 0x00, 0x32, 0xDE, 0x09, 0x21, 0xD8, 0x0E, 0x3E, + 0x55, 0x77, 0xBE, 0x20, 0x09, 0x3E, 0xAA, 0x77, 0xBE, 0x20, + 0x03, 0x23, 0x18, 0xF1, 0x22, 0xDC, 0x09, 0xF9, 0x11, 0xE0, + 0x09, 0x21, 0xD8, 0x0E, 0xB7, 0xED, 0x52, 0x4D, 0x44, 0x0B, + 0x6B, 0x62, 0x13, 0x36, 0x00, 0xED, 0xB0, 0x3E, 0x10, 0xED, + 0x39, 0x33, 0x3E, 0x00, 0xED, 0x39, 0x32, 0xED, 0x39, 0x36, + 0x3E, 0x0C, 0xED, 0x39, 0x31, 0x3E, 0xC3, 0x21, 0xE5, 0x01, + 0x32, 0x38, 0x00, 0x22, 0x39, 0x00, 0xED, 0x56, 0xCD, 0xDC, + 0x01, 0xFB, 0xCD, 0x00, 0x09, 0x18, 0xA9, 0x43, 0x6F, 0x70, + 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x43, 0x29, + 0x20, 0x31, 0x39, 0x38, 0x37, 0x20, 0x2D, 0x20, 0x54, 0x61, + 0x6E, 0x67, 0x65, 0x6E, 0x74, 0x20, 0x54, 0x65, 0x63, 0x68, + 0x6E, 0x6F, 0x6C, 0x6F, 0x67, 0x69, 0x65, 0x73, 0x20, 0x20, + 0x20, 0x41, 0x6C, 0x6C, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, + 0x73, 0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, + 0x2E, 0x20, 0x20, 0x04, 0x04, 0x16, 0x28, 0xFF, 0x3C, 0x04, + 0x60, 0x0A, 0xE0, 0x06, 0x00, 0x07, 0x7E, 0x02, 0x40, 0x0B, + 0xF6, 0x0C, 0x06, 0x0D, 0x00, 0x0E, 0xC1, 0x0F, 0x00, 0x05, + 0x60, 0x03, 0xC0, 0x01, 0x00, 0x09, 0x08, 0x06, 0x1C, 0x21, + 0x9F, 0x01, 0x0E, 0x52, 0xED, 0xA3, 0xC2, 0xC2, 0x01, 0x21, + 0xE5, 0x01, 0x22, 0x40, 0x00, 0x3A, 0x03, 0x00, 0xE6, 0x01, + 0xC0, 0x3E, 0x0B, 0xED, 0x79, 0x3E, 0x76, 0xED, 0x79, 0xC9, + 0x21, 0x00, 0x0A, 0x36, 0x84, 0xCD, 0xBB, 0x01, 0xC9, 0xF5, + 0xC5, 0xD5, 0xE5, 0x2A, 0xE0, 0x09, 0x0E, 0x53, 0x11, 0x62, + 0x02, 0x43, 0x14, 0xED, 0xA2, 0x3A, 0x9E, 0x01, 0x5F, 0xDB, + 0x52, 0xE6, 0x01, 0x20, 0x06, 0x1D, 0x20, 0xF7, 0xC3, 0xD4, + 0x02, 0x3E, 0x01, 0xD3, 0x52, 0xDB, 0x52, 0x5F, 0xE6, 0xA0, + 0x20, 0x0A, 0xED, 0xA2, 0x20, 0xE1, 0x15, 0x20, 0xDE, 0xC3, + 0xD2, 0x02, 0xED, 0xA2, 0x7B, 0xE6, 0x60, 0xC2, 0xD8, 0x02, + 0x3E, 0x30, 0xD3, 0x52, 0x3E, 0x01, 0xD3, 0x52, 0xAF, 0xD3, + 0x52, 0xED, 0x5B, 0xE0, 0x09, 0x2B, 0x37, 0xED, 0x52, 0xDA, + 0xD6, 0x02, 0x22, 0xE2, 0x09, 0x62, 0x6B, 0x3A, 0xE4, 0x09, + 0xBE, 0x20, 0x56, 0x3E, 0x01, 0x32, 0xE8, 0x09, 0x23, 0x23, + 0x3E, 0x84, 0xBE, 0x20, 0x31, 0x36, 0x85, 0x2B, 0x46, 0x3A, + 0xE4, 0x09, 0x77, 0x2B, 0x70, 0x11, 0x03, 0x00, 0xCD, 0x56, + 0x03, 0x3E, 0x10, 0xD3, 0x52, 0x3E, 0x38, 0xD3, 0x52, 0x3E, + 0x03, 0xD3, 0x52, 0x3E, 0xD5, 0xD3, 0x52, 0x2A, 0xE0, 0x09, + 0x0E, 0x53, 0x11, 0x62, 0x02, 0x43, 0x14, 0x3A, 0x9D, 0x01, + 0x5F, 0xC3, 0xF9, 0x01, 0x3E, 0x81, 0xBE, 0xC2, 0xA6, 0x02, + 0x36, 0x82, 0x2B, 0x46, 0x3A, 0xE4, 0x09, 0x77, 0x2B, 0x70, + 0x11, 0x03, 0x00, 0xCD, 0x56, 0x03, 0xC3, 0xC1, 0x02, 0x23, + 0x23, 0x7E, 0xFE, 0x84, 0xC2, 0xA6, 0x02, 0xCD, 0x05, 0x03, + 0x18, 0x14, 0x3E, 0x80, 0xA6, 0xC2, 0xA1, 0x02, 0xDD, 0xE5, + 0xDD, 0x21, 0xF9, 0x09, 0xCD, 0x13, 0x06, 0xCD, 0x40, 0x07, + 0xDD, 0xE1, 0xE1, 0xD1, 0xC1, 0xF1, 0xFB, 0xED, 0x4D, 0xDD, + 0xE5, 0xDD, 0x21, 0xE9, 0x09, 0xCD, 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, 0xC3, + 0x88, 0x04, 0xDB, 0x53, 0x47, 0x3A, 0xE4, 0x09, 0xB8, 0xC2, + 0x88, 0x04, 0xDB, 0x52, 0xE6, 0x01, 0x28, 0xFA, 0xDB, 0x53, + 0xDB, 0x52, 0xE6, 0x01, 0x28, 0xFA, 0xDB, 0x53, 0xFE, 0x85, + 0xC2, 0x88, 0x04, 0x3A, 0x9E, 0x01, 0x18, 0x04, 0x3A, 0x9E, + 0x01, 0x87, 0x3D, 0x20, 0xFD, 0xD1, 0xE1, 0xCD, 0x56, 0x03, + 0xCD, 0x05, 0x03, 0xB7, 0xFB, 0xC9, 0xD1, 0xE1, 0xF3, 0x3E, + 0x0A, 0xD3, 0x52, 0xDB, 0x52, 0xE6, 0xC0, 0xCA, 0x7F, 0x04, + 0x3E, 0x01, 0x37, 0xFB, 0xC9, 0xCD, 0x62, 0x03, 0xCD, 0x05, + 0x03, 0xB7, 0xFB, 0xC9, 0xD1, 0xE1, 0x3E, 0x02, 0x37, 0xFB, + 0xC9, 0x06, 0x08, 0x0E, 0x00, 0x1F, 0x30, 0x01, 0x0C, 0x10, + 0xFA, 0x79, 0xC9, 0x21, 0x04, 0x00, 0x39, 0x5E, 0x23, 0x56, + 0x21, 0x02, 0x00, 0x39, 0x7E, 0x23, 0x66, 0x6F, 0xDD, 0xE5, + 0x22, 0x0B, 0x0A, 0xED, 0x53, 0x0D, 0x0A, 0xDD, 0x21, 0xF5, + 0x09, 0xCD, 0x13, 0x06, 0x3A, 0x03, 0x0A, 0x32, 0x04, 0x0A, + 0x3A, 0x02, 0x0A, 0x87, 0x32, 0x02, 0x0A, 0xCD, 0x8F, 0x04, + 0xFE, 0x03, 0x38, 0x10, 0x3A, 0x03, 0x0A, 0x87, 0x3C, 0xE6, + 0x0F, 0x32, 0x03, 0x0A, 0xAF, 0x32, 0x02, 0x0A, 0x18, 0x17, + 0x3A, 0x01, 0x0A, 0xCD, 0x8F, 0x04, 0xFE, 0x03, 0x30, 0x0D, + 0x3A, 0x03, 0x0A, 0xCB, 0x3F, 0x32, 0x03, 0x0A, 0x3E, 0xFF, + 0x32, 0x01, 0x0A, 0x3A, 0x03, 0x0A, 0x32, 0x04, 0x0A, 0x3A, + 0x01, 0x0A, 0x87, 0x32, 0x01, 0x0A, 0x3E, 0x20, 0x32, 0x05, + 0x0A, 0x32, 0x06, 0x0A, 0x06, 0x28, 0xDB, 0x52, 0xE6, 0x10, + 0x28, 0xF8, 0x05, 0x20, 0xF7, 0xF3, 0x3E, 0x0E, 0xD3, 0x52, + 0x3E, 0x41, 0xD3, 0x52, 0xFB, 0xED, 0x5F, 0x47, 0x3A, 0x04, + 0x0A, 0xA0, 0xE6, 0x0F, 0x28, 0x0F, 0x47, 0x0E, 0x0A, 0xDB, + 0x52, 0xE6, 0x10, 0xCA, 0x52, 0x05, 0x0D, 0x20, 0xF6, 0x10, + 0xF2, 0x2A, 0x0B, 0x0A, 0xED, 0x5B, 0x0D, 0x0A, 0xCD, 0xE6, + 0x03, 0x30, 0x07, 0x3D, 0xCA, 0x52, 0x05, 0xC3, 0x7B, 0x05, + 0xDD, 0xE1, 0x21, 0x00, 0x00, 0xC9, 0xDD, 0x21, 0xED, 0x09, + 0xCD, 0x13, 0x06, 0x3A, 0x06, 0x0A, 0x3D, 0x32, 0x06, 0x0A, + 0x28, 0x13, 0x3A, 0x04, 0x0A, 0xF6, 0x01, 0x32, 0x04, 0x0A, + 0x3A, 0x01, 0x0A, 0xF6, 0x01, 0x32, 0x01, 0x0A, 0xC3, 0x0A, + 0x05, 0xDD, 0xE1, 0x21, 0x01, 0x00, 0xC9, 0xDD, 0x21, 0xF1, + 0x09, 0xCD, 0x13, 0x06, 0x3A, 0x02, 0x0A, 0xF6, 0x01, 0x32, + 0x02, 0x0A, 0x3A, 0x04, 0x0A, 0x87, 0xF6, 0x01, 0x32, 0x04, + 0x0A, 0x3A, 0x05, 0x0A, 0x3D, 0x32, 0x05, 0x0A, 0xC2, 0x0A, + 0x05, 0xDD, 0xE1, 0x21, 0x02, 0x00, 0xC9, 0xDD, 0xE5, 0x21, + 0x00, 0x00, 0x39, 0x11, 0x04, 0x00, 0x19, 0x7E, 0x32, 0xE4, + 0x09, 0xE6, 0x80, 0x32, 0x07, 0x0A, 0x3A, 0x07, 0x0A, 0xB7, + 0x28, 0x06, 0xDD, 0x21, 0x58, 0x02, 0x18, 0x04, 0xDD, 0x21, + 0x96, 0x00, 0x3A, 0xE4, 0x09, 0xB7, 0x28, 0x31, 0x3C, 0x28, + 0x2E, 0x3D, 0x21, 0x08, 0x0A, 0x77, 0x23, 0x77, 0x23, 0x36, + 0x81, 0xAF, 0x32, 0xE8, 0x09, 0xDD, 0x2B, 0xDD, 0xE5, 0xE1, + 0x7C, 0xB5, 0x28, 0x2A, 0x21, 0x08, 0x0A, 0x11, 0x03, 0x00, + 0xCD, 0xAA, 0x04, 0x11, 0xE8, 0x03, 0x1B, 0x7B, 0xB2, 0x20, + 0xFB, 0x3A, 0xE8, 0x09, 0xB7, 0x28, 0xE0, 0x3A, 0xE4, 0x09, + 0x47, 0x3E, 0x07, 0x80, 0xE6, 0x7F, 0x47, 0x3A, 0x07, 0x0A, + 0xB0, 0x32, 0xE4, 0x09, 0x18, 0xA6, 0xDD, 0xE1, 0xC9, 0xB7, + 0xDD, 0x34, 0x00, 0xC0, 0xDD, 0x34, 0x01, 0xC0, 0xDD, 0x34, + 0x02, 0xC0, 0xDD, 0x34, 0x03, 0xC0, 0x37, 0xC9, 0x21, 0x02, + 0x00, 0x39, 0x5E, 0x23, 0x56, 0x23, 0x4E, 0x23, 0x46, 0x23, + 0x7E, 0x23, 0x66, 0x69, 0x4F, 0x78, 0x44, 0x67, 0xED, 0xB0, + 0xC9, 0x21, 0x02, 0x00, 0x39, 0x7E, 0x23, 0x66, 0x6F, 0x3E, + 0x11, 0xED, 0x39, 0x30, 0x7D, 0xED, 0x39, 0x28, 0x7C, 0xED, + 0x39, 0x29, 0x3E, 0x00, 0xED, 0x39, 0x2A, 0x3E, 0x40, 0xED, + 0x39, 0x2B, 0x3E, 0x00, 0xED, 0x39, 0x2C, 0x21, 0x80, 0x02, + 0x7D, 0xED, 0x39, 0x2E, 0x7C, 0xED, 0x39, 0x2F, 0x3E, 0x91, + 0xED, 0x39, 0x30, 0xD3, 0x44, 0x3A, 0xDF, 0x09, 0xB7, 0x28, + 0x02, 0xD3, 0x42, 0xC9, 0x21, 0x02, 0x00, 0x39, 0x7E, 0x23, + 0x66, 0x6F, 0x3E, 0x21, 0xED, 0x39, 0x30, 0x3E, 0x40, 0xED, + 0x39, 0x20, 0x3E, 0x00, 0xED, 0x39, 0x21, 0xED, 0x39, 0x22, + 0x7D, 0xED, 0x39, 0x23, 0x7C, 0xED, 0x39, 0x24, 0x3E, 0x00, + 0xED, 0x39, 0x25, 0x21, 0x80, 0x02, 0x7D, 0xED, 0x39, 0x26, + 0x7C, 0xED, 0x39, 0x27, 0x3E, 0x61, 0xED, 0x39, 0x30, 0xD3, + 0x43, 0x3A, 0xDF, 0x09, 0xB7, 0x28, 0x02, 0xD3, 0x42, 0xC9, + 0xED, 0x38, 0x2E, 0x5F, 0xED, 0x38, 0x2F, 0x57, 0xED, 0x38, + 0x2E, 0x6F, 0xED, 0x38, 0x2F, 0x67, 0xB7, 0xED, 0x52, 0x20, + 0xEB, 0x21, 0x80, 0x02, 0xB7, 0xED, 0x52, 0xC9, 0xED, 0x38, + 0x26, 0x5F, 0xED, 0x38, 0x27, 0x57, 0xED, 0x38, 0x26, 0x6F, + 0xED, 0x38, 0x27, 0x67, 0xB7, 0xED, 0x52, 0x20, 0xEB, 0x21, + 0x80, 0x02, 0xB7, 0xED, 0x52, 0xC9, 0xCD, 0xB4, 0x09, 0xDD, + 0x6E, 0x06, 0xDD, 0x66, 0x07, 0x7E, 0x23, 0x6E, 0x67, 0xC3, + 0xC0, 0x09, 0xCD, 0xB4, 0x09, 0x21, 0x00, 0x00, 0x22, 0x17, + 0x0A, 0x22, 0x10, 0x0A, 0x22, 0x12, 0x0A, 0x21, 0xD8, 0x0E, + 0x22, 0x19, 0x0A, 0xED, 0x5B, 0x19, 0x0A, 0x2A, 0xDC, 0x09, + 0xB7, 0xED, 0x52, 0x11, 0x00, 0xFF, 0x19, 0x22, 0x15, 0x0A, + 0xCB, 0x7C, 0x28, 0x06, 0x21, 0x00, 0x7D, 0x22, 0x15, 0x0A, + 0x2A, 0x19, 0x0A, 0xE5, 0xCD, 0xED, 0x02, 0xC3, 0xC0, 0x09, + 0xCD, 0xB4, 0x09, 0xE5, 0x2A, 0xE0, 0x09, 0x23, 0x23, 0x23, + 0xE5, 0xCD, 0xF6, 0x06, 0xC1, 0x7C, 0xE6, 0x03, 0x67, 0xDD, + 0x75, 0xFE, 0xDD, 0x74, 0xFF, 0xED, 0x5B, 0xE2, 0x09, 0x23, + 0x23, 0x23, 0xB7, 0xED, 0x52, 0x20, 0x0C, 0x11, 0x05, 0x00, + 0x2A, 0xE2, 0x09, 0xCD, 0xA5, 0x09, 0xF2, 0x7B, 0x07, 0x2A, + 0xE0, 0x09, 0xE5, 0xCD, 0xED, 0x02, 0xC3, 0xC0, 0x09, 0xED, + 0x5B, 0xE2, 0x09, 0x2A, 0x12, 0x0A, 0x19, 0x22, 0x12, 0x0A, + 0x2A, 0x17, 0x0A, 0x19, 0x22, 0x17, 0x0A, 0xED, 0x5B, 0x15, + 0x0A, 0x21, 0x9E, 0xFD, 0x19, 0xED, 0x5B, 0x17, 0x0A, 0xCD, + 0xA5, 0x09, 0xF2, 0xA5, 0x07, 0x21, 0x00, 0x00, 0x22, 0x17, + 0x0A, 0x3E, 0x01, 0x32, 0x0F, 0x0A, 0xCD, 0xB5, 0x07, 0x21, + 0x00, 0x00, 0x39, 0xF9, 0xC3, 0xC0, 0x09, 0xCD, 0xB4, 0x09, + 0x3A, 0x0F, 0x0A, 0xB7, 0xCA, 0xC0, 0x09, 0xED, 0x5B, 0x10, + 0x0A, 0x2A, 0x17, 0x0A, 0xCD, 0xA5, 0x09, 0xF2, 0xDE, 0x07, + 0xED, 0x5B, 0x17, 0x0A, 0x21, 0x62, 0x02, 0x19, 0xED, 0x5B, + 0x10, 0x0A, 0xCD, 0xA5, 0x09, 0xFA, 0xFE, 0x07, 0xED, 0x5B, + 0x10, 0x0A, 0x2A, 0x17, 0x0A, 0xB7, 0xED, 0x52, 0x20, 0x07, + 0x2A, 0x12, 0x0A, 0x7D, 0xB4, 0x28, 0x0D, 0xED, 0x5B, 0x17, + 0x0A, 0x2A, 0x10, 0x0A, 0xCD, 0xA5, 0x09, 0xF2, 0x11, 0x08, + 0xED, 0x5B, 0x19, 0x0A, 0x2A, 0x17, 0x0A, 0x19, 0xE5, 0xCD, + 0xED, 0x02, 0xAF, 0x32, 0x0F, 0x0A, 0xC3, 0xC0, 0x09, 0xCD, + 0xE0, 0x02, 0x21, 0x00, 0x00, 0x39, 0xF9, 0xC3, 0xC0, 0x09, + 0xCD, 0xB4, 0x09, 0x3A, 0x14, 0x0A, 0xB7, 0x28, 0x16, 0xCD, + 0xBE, 0x06, 0xED, 0x5B, 0x1B, 0x0A, 0x13, 0x13, 0x13, 0xCD, + 0xA5, 0x09, 0xF2, 0x3B, 0x08, 0x21, 0x01, 0x00, 0xC3, 0xC0, + 0x09, 0x21, 0x00, 0x00, 0xC3, 0xC0, 0x09, 0xCD, 0xC8, 0x09, + 0xFC, 0xFF, 0xCD, 0x1C, 0x08, 0x7D, 0xB4, 0xC2, 0xC0, 0x09, + 0xED, 0x5B, 0x12, 0x0A, 0x21, 0x00, 0x00, 0xCD, 0xA5, 0x09, + 0xF2, 0xC0, 0x09, 0xED, 0x5B, 0x19, 0x0A, 0x2A, 0x10, 0x0A, + 0x19, 0xDD, 0x75, 0xFE, 0xDD, 0x74, 0xFF, 0x23, 0x23, 0x23, + 0xE5, 0xCD, 0xF6, 0x06, 0xC1, 0x7C, 0xE6, 0x03, 0x67, 0x23, + 0x23, 0x23, 0xDD, 0x75, 0xFC, 0xDD, 0x74, 0xFD, 0xE5, 0xDD, + 0x6E, 0xF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 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +#endif +}; + + +BOOLEAN +LtFirmInitialize( + IN PLT_ADAPTER Adapter, + IN UCHAR SuggestedNodeId + ) +/*++ + +Routine Description: + + This routine initializes the card, downloads the firmware to it. + +Arguments: + + Adapter : Pointer to the adapter structure. + +Return Value: + + TRUE : If successful, false otherwise + +--*/ +{ + PUCHAR Firmware; + UINT FirmwareLen; + UINT RetryCount; + UCHAR Data; + BOOLEAN Result = FALSE; + + // Clear the request Latch + NdisRawReadPortUchar(XFER_PORT, &Data); + + // Clear the TX_READY FLOP + NdisRawWritePortUchar(XFER_PORT, (UCHAR)0); + + // Reset the card. + NdisRawWritePortUchar(RESET_PORT, (UCHAR)0); + + NdisStallExecution(LT_FIRM_INIT_STALL_TIME*5); + + for (RetryCount = 0; RetryCount < MAX_READ_RETRY_COUNT; RetryCount++) + { + // Get Card Status. + NdisRawReadPortUchar(SC_PORT, &Data); + + if (Data & TX_READY) + { + break; + } + else DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_WARN, + ("LtFirmInitialize: Waiting for card ready SC_PORT %x\n", Data)); + + NdisStallExecution(LT_FIRM_INIT_STALL_TIME); + } + + // BUGBUG: + // !!!!!! + // For DAYNA, it will not be ready at this point. DCH is going to + // send information to fix this. + + do + { + if (RetryCount == MAX_READ_RETRY_COUNT) + { + LOGERROR( + Adapter->NdisAdapterHandle, + NDIS_ERROR_CODE_HARDWARE_FAILURE); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_FATAL, + ("LtFirmInitialize: Card Not Ready after Reset\n")); + break; + } + + // Copy the firmware to the card. + Firmware = LtMicroCode; + FirmwareLen = sizeof(LtMicroCode); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("LtFirmInitialize: DownLoad %d bytes of firmware\n", FirmwareLen)); + + // Well... the card is alive and well and in a reset state. + // Next we need to output the first byte of the firmware and + // check for TX_READY. + NdisRawWritePortUchar(XFER_PORT, *Firmware); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("LtFirmInitialize: First byte of Firmware on card\n")); + + NdisRawReadPortUchar(SC_PORT, &Data); + + if (Data & TX_READY) + { + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_FATAL, + ("LtFirmInitialize: Card Not Ready During Download\n")); + + LOGERROR( + Adapter->NdisAdapterHandle, + NDIS_ERROR_CODE_HARDWARE_FAILURE); + break; + } + + // Skip over the first byte because it already out there. + Firmware ++; + FirmwareLen --; + + NdisRawWritePortBufferUchar(XFER_PORT, + Firmware, + FirmwareLen); + + // Tell the card to start + NdisRawReadPortUchar(XFER_PORT, &Data); + + // Wait for the card to start + for (RetryCount = 0; RetryCount < MAX_START_RETRY_COUNT; RetryCount++) + { + NdisStallExecution(LT_FIRM_INIT_STALL_TIME); + + // Get Status + NdisRawReadPortUchar(SC_PORT, &Data); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_WARN, + ("LtFirmInitialize: Waiting for start - SC_PORT Data %x\n", + (UCHAR)Data)); + + if (Data & RX_READY) + { + break; + } + } + + // !!! This seems to be the only way the MCA card works according to + // !!! Dave Hornbaker. It seems that the MCA card doesnt get ready at + // !!! this point, but works later on. + if (RetryCount == MAX_START_RETRY_COUNT) + { + ASSERT(Adapter->BusType != NdisInterfaceMca); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_FATAL, + ("LtFirmInitialize: Card Not Ready, could not get status\n")); + + LOGERROR( + Adapter->NdisAdapterHandle, + NDIS_ERROR_CODE_INVALID_VALUE_FROM_ADAPTER); + break; + } + + // Clear the initial ready signal. + NdisRawReadPortUchar(XFER_PORT, &Data); + + // Now loop here for a finite time till the card acquires a node id. + // If it fails to do so in the specified time, fail the load. + if (!LtInitGetAddressSetPoll(Adapter, SuggestedNodeId)) + { + break; + } + + // We need to catch the card fast after it acquire the node id and before it + // receives any packets. If it does receive any packets, then ask it acquire + // the node id again. The stall happens ONLY IF A PACKET IS RECVD. + for (RetryCount = 0; RetryCount < MAX_START_RETRY_COUNT*200; RetryCount++) + { + USHORT ResponseLength; + UCHAR ResponseType; + LT_INIT_RESPONSE InitPacket; + + // Check for receive data + NdisRawReadPortUchar(SC_PORT, &Data); + + if (Data & RX_READY) + { + // Get the length of the response on the card + NdisRawReadPortUchar(XFER_PORT, &Data); + + ResponseLength = (USHORT)(Data & 0xFF); + + NdisRawReadPortUchar(XFER_PORT, &Data); + + ResponseLength |= (Data << 8); + + // Now get the IO code. + NdisRawReadPortUchar(XFER_PORT, &ResponseType); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("LtFirmInitialize: RespType = %x, RespLength = %d\n", + ResponseType, ResponseLength)); + + if ((ResponseType == LT_RSP_LAP_INIT) && + (ResponseLength == sizeof(LT_INIT_RESPONSE))) + { + NdisRawReadPortBufferUchar(XFER_PORT, + (PUCHAR)&InitPacket, + ResponseLength); + + Adapter->NodeId = InitPacket.NodeId; + Adapter->Flags |= ADAPTER_NODE_ID_VALID; + + // This should start off a worker thread to write the + // node id into the pram. + // BUGBUG: Implement using worker threads. + // LtRegWritePramNodeId(Adapter); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("LtFirmInitailize: Node id acquired %x\n", InitPacket.NodeId)); + break; + } + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_WARN, + ("LtFirmInitailize: Node id not valid yet !!\n")); + + // Suck in the packet and throw it away + while (ResponseLength-- > 0) + { + NdisRawReadPortUchar(XFER_PORT, &Data); + } + + // The response was probably over-written by incoming packet. + // Try again. + NdisStallExecution(LT_FIRM_INIT_STALL_TIME); + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_WARN, + ("LtFirmInitailize: Re-acquire node after packet recv\n")); + if (!LtInitGetAddressSetPoll(Adapter, SuggestedNodeId)) + { + break; + } + } + else + { + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_WARN, + ("LtFirmInitialize: Waiting for node - SC_PORT Data %x\n", + (UCHAR)Data)); + } + NdisStallExecution(500); // 500us + } + Result = ((Adapter->Flags & ADAPTER_NODE_ID_VALID) != 0); + } while (FALSE); + + return(Result); +} + diff --git a/private/ntos/ndis/lt200/ltfirm.h b/private/ntos/ndis/lt200/ltfirm.h new file mode 100644 index 000000000..5ddae948d --- /dev/null +++ b/private/ntos/ndis/lt200/ltfirm.h @@ -0,0 +1,42 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltfirm.h + +Abstract: + + This module contains the firmware init definitions. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTFIRM_H_ +#define _LTFIRM_H_ + +BOOLEAN +LtFirmInitialize( + IN PLT_ADAPTER Adapter, + IN UCHAR SuggestedNodeId); + +#ifdef LTFIRM_H_LOCALS +#define MAX_READ_RETRY_COUNT 500 +#define MAX_START_RETRY_COUNT 500 + +#define LT_FIRM_INIT_STALL_TIME 10000 // 10ms + +#endif // LTFIRM_H_LOCALS + + +#endif // _LTFIRM_H_ + diff --git a/private/ntos/ndis/lt200/ltglobal.h b/private/ntos/ndis/lt200/ltglobal.h new file mode 100644 index 000000000..c8e523e54 --- /dev/null +++ b/private/ntos/ndis/lt200/ltglobal.h @@ -0,0 +1,48 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltglobal.h + +Abstract: + + This module contains the globals the driver uses. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTGLOBAL_ +#define _LTGLOBAL_ + +#ifdef _GLOBALS_ + #define GLOBAL + #define EQU = +#else + #define GLOBAL extern + #define EQU ; / ## / +#endif + +// This variable is used to control debug output. +#if DBG +GLOBAL ULONG LtDebugLevel EQU DBG_LEVEL_ERR; +GLOBAL ULONG LtDebugSystems EQU DBG_COMP_ALL; +#endif + +GLOBAL NDIS_HANDLE LtMacHandle EQU (NDIS_HANDLE)NULL; +GLOBAL NDIS_HANDLE LtNdisWrapperHandle EQU (NDIS_HANDLE)NULL; + +// To indicate there is no restriction on the highest physical address for +// NdisAllocateMemory calls. +GLOBAL NDIS_PHYSICAL_ADDRESS LtNdisPhyAddr EQU NDIS_PHYSICAL_ADDRESS_CONST(-1,-1); + +#endif // _LTGLOBAL_ diff --git a/private/ntos/ndis/lt200/lthrd.h b/private/ntos/ndis/lt200/lthrd.h new file mode 100644 index 000000000..dc5378f89 --- /dev/null +++ b/private/ntos/ndis/lt200/lthrd.h @@ -0,0 +1,85 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + lthrd.h + +Abstract: + + This module contains the hardware specific defines. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTHRD_ +#define _LTHRD_ + + +#define LT_DEFAULT_SLOT_NUMBER 1 +#define LT_DEFAULT_BUS_NUMBER 0 +#define LT_DEFAULT_RECEIVE_BUFFERS 3 +#define LT_DEFAULT_IO_BASE_ADDRESS 0x340 +#define LT_MAX_ADAPTERS 8 +#define LT_NUMBER_OF_PORTS 4 +#define LT_MAXIMUM_PACKET_SIZE 603 + +#define LT_MINIMUM_PACKET_SIZE 3 +#define LT_LENGTH_OF_ADDRESS 1 + +#define LT_ADAPTER_POLLED_MODE 0xFF // Adapter in polling mode + +// LT command/response codes. + +#define LT_CMD_LAP_INIT 1 // initialize command. +#define LT_RSP_LAP_INIT 2 // Initialize response. +#define LT_CMD_LAP_WRITE 3 // Transmit a lap frame. +#define LT_RSP_LAP_FRAME 4 // Received lap frameresponse. +#define LT_CMD_GET_STATUS 5 // Get LAP hardware status command. +#define LT_RSP_STATUS 6 // LAP Hardware status response. + +typedef struct _LT_STATUS_RESPONSE { + + UCHAR NodeId; // Adapters LocalTalk Address. + UCHAR RomVer; // Version of LT ROM. + UCHAR SwVer; // Version of downloaded Firmware + +} LT_STATUS_RESPONSE, *PLT_STATUS_RESPONSE; + +typedef struct _LT_INIT_RESPONSE { + UCHAR NodeId; + UCHAR RomVer; +} LT_INIT_RESPONSE, *PLT_INIT_RESPONSE; + +// Definition for the LT Transfer Control Status Register. +#define TX_READY 1 +#define RX_READY 2 + +// I/O Port Address Mapping Definitions +#define XFER_PORT Adapter->MappedIoBaseAddr+0 // (Adapter->LtPortAddress) +#define SC_PORT Adapter->MappedIoBaseAddr+1 // (Adapter->LtPortAddress+1) +#define RESET_PORT Adapter->MappedIoBaseAddr+3 // (Adapter->LtPortAddress+3) + +typedef struct _LT_CARD_IO { + USHORT IoLen; // Length of io_data + UCHAR IoCode; // Command response + UCHAR IoData[1]; // Command response Data. +} LtCardIo, *PLtCardIo; + +#ifdef LTHRD_LOCALS + +#endif // LTHRD_LOCALS + + +#endif // _LTHRD_ + + diff --git a/private/ntos/ndis/lt200/ltinit.c b/private/ntos/ndis/lt200/ltinit.c new file mode 100644 index 000000000..69cdc1ba4 --- /dev/null +++ b/private/ntos/ndis/lt200/ltinit.c @@ -0,0 +1,738 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltinit.c + +Abstract: + + This module contains the main processing routines. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define _GLOBALS_ +#include "ltmain.h" +#include "ltreg.h" +#include "ltreq.h" +#include "ltfirm.h" +#include "lttimer.h" +#include "ltreset.h" + +// Define file id for errorlogging +#define FILENUM LTINIT + + +NTSTATUS +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ) +/*++ + +Routine Description: + + This is the entry routine for the localtalk driver. + +Arguments: + + DriverObject: The IO driver object for this driver object. + RegistryPath: The path to the registry config for this driver. + +Return Value: + + STATUS_SUCCESS: If load was successful + Error : Otherwise + +--*/ +{ + NDIS_STATUS Status; + NDIS_MAC_CHARACTERISTICS LtChar; + static const NDIS_STRING MacName = NDIS_STRING_CONST("LT200"); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("Debugging breakpoint, Hit G <cr> to continue\n")); + + DBGBREAK(DBG_LEVEL_INFO); + + // Initialize the NDIS Wrapper. + NdisInitializeWrapper( + &LtNdisWrapperHandle, + DriverObject, + RegistryPath, + NULL); + + // Setup the MAC Characteristics + LtChar.MajorNdisVersion = NDIS_MAJOR_VERSION; + LtChar.MinorNdisVersion = NDIS_MINOR_VERSION; + LtChar.OpenAdapterHandler = LtInitOpenAdapter; + LtChar.CloseAdapterHandler = LtInitCloseAdapter; + LtChar.SendHandler = LtSend; + LtChar.RequestHandler = LtRequest; + LtChar.TransferDataHandler = LtRecvTransferData; + LtChar.ResetHandler = LtReset; + LtChar.QueryGlobalStatisticsHandler = LtReqQueryGlobalStatistics; + LtChar.UnloadMacHandler = LtInitUnload; + LtChar.AddAdapterHandler = LtInitAddAdapter; + LtChar.RemoveAdapterHandler = LtInitRemoveAdapter; + LtChar.Name = MacName; + + NdisRegisterMac( + &Status, + &LtMacHandle, + LtNdisWrapperHandle, + NULL, // Context for AddAdapter/Unload + &LtChar, + sizeof(LtChar)); + + if (Status != NDIS_STATUS_SUCCESS) + { + // Can only get here if something went wrong registering the MAC or + // all of the adapters + NdisTerminateWrapper(LtNdisWrapperHandle, DriverObject); + } + + return Status; +} + + + + +NDIS_STATUS +LtInitAddAdapter( + IN NDIS_HANDLE MacMacContext, + IN NDIS_HANDLE ConfigurationHandle, + IN PNDIS_STRING AdapterName + ) +/*++ + +Routine Description: + + This is called by NDIS when we do a register adapter. + +Arguments: + + MacMacContext : Context passed to Add/Unload. NULL in our case. + ConfigurationHandle : Handle to configuration info. + AdapterName : Name to use to register the adapter. + +Return Value: + + NDIS_STATUS_SUCCESS : If successful, error otherwise + +--*/ +{ + NDIS_HANDLE ConfigHandle; + UCHAR SuggestedNodeId; + UINT BusNumber, IoBaseAddress; + NDIS_INTERFACE_TYPE BusType; + BOOLEAN configHandleOpen = FALSE; + NDIS_STATUS Status = NDIS_STATUS_ADAPTER_NOT_FOUND; + + if (ConfigurationHandle == NULL) + { + return(Status); + } + + + do + { + NdisOpenConfiguration( + &Status, + &ConfigHandle, + ConfigurationHandle); + + if (Status != NDIS_STATUS_SUCCESS) + { + break; + } + + configHandleOpen = TRUE; + + // The following functions return the parameter as specified in the + // Configuration database or the default. If the database has an + // incorrect value, then the default is returned and an Error Event + // is logged. + + BusNumber = LtRegGetBusNumber(ConfigHandle); + + Status = LtRegGetBusType(ConfigHandle, &BusType); + if (Status != NDIS_STATUS_SUCCESS) + { + break; + } + + // Get the io base address + Status = LtRegGetIoBaseAddr( + &IoBaseAddress, + ConfigurationHandle, + ConfigHandle, + BusType); + + if (Status != NDIS_STATUS_SUCCESS) + { + break; + } + + // Get default id or pram node id to try. + SuggestedNodeId = LtRegGetNodeId(ConfigHandle); + + } while (FALSE); + + // We have to register the adapter to log an error if that happened. + Status = LtInitRegisterAdapter( + LtMacHandle, + ConfigurationHandle, + AdapterName, + BusType, + SuggestedNodeId, + IoBaseAddress, + LT_MAX_ADAPTERS, + Status); + + if (configHandleOpen) + { + NdisCloseConfiguration(ConfigHandle); + } + + return Status; +} + + + + +VOID +LtInitRemoveAdapter( + IN NDIS_HANDLE MacAdapterContext + ) +/*++ + +Routine Description: + + Called to remove an adapter. This is only called after all bindings + are closed. + +Arguments: + + MacAdapterContext : Context value passed to NdisRegister. Adapter + +Return Value: + + None. + +--*/ +{ + BOOLEAN Cancelled, TimerQueued, Closing; + PLT_ADAPTER Adapter = (PLT_ADAPTER)MacAdapterContext; + + NdisAcquireSpinLock(&Adapter->Lock); + Closing = ((Adapter->Flags & ADAPTER_CLOSING) != 0); + + Adapter->Flags |= ADAPTER_CLOSING; + TimerQueued = ((Adapter->Flags & ADAPTER_TIMER_QUEUED) != 0); + Adapter->Flags &= ~ADAPTER_TIMER_QUEUED; + NdisReleaseSpinLock(&Adapter->Lock); + + if (Closing) + { + ASSERTMSG("LtInitRemoveAdapter: Removing twice!\n", 0); + return; + } + + // Acording to Adam, this routine will NEVER be called with + // outstanding opens. + ASSERTMSG("LtRemoveAdapter: OpenCount is not zero!\n", + (Adapter->OpenCount == 0)); + + // There are no opens left so remove ourselves. + if (TimerQueued) + { + NdisCancelTimer(&Adapter->PollingTimer, &Cancelled); + if (Cancelled) + { + // Remove the timer reference + LtDeReferenceAdapter(Adapter); + } + } + + ASSERTMSG("LtRemoveAdapter: RefCount not correct!\n", (Adapter->RefCount == 1)); + + // Remove the creation reference + LtDeReferenceAdapter(Adapter); + return; +} + + + + +NDIS_STATUS +LtInitOpenAdapter( + OUT PNDIS_STATUS OperErrorStatus, + OUT NDIS_HANDLE *MacBindingHandle, + OUT PUINT SelectedMediumIndex, + IN PNDIS_MEDIUM MediumArray, + IN UINT MediumArraySize, + IN NDIS_HANDLE NdisBindingContext, + IN NDIS_HANDLE MacAdapterContext, + IN UINT OpenOptions, + IN PSTRING AddressingInformation + ) +/*++ + +Routine Description: + + Called by ndis when a protocol attempts to bind to us. + +Arguments: + + As described in the NDIS 3.0 Spec. + +Return Value: + + NDIS_STATUS_SUCCESSFUL : If ok, error otherwise + +--*/ +{ + + UINT i; + PLT_OPEN NewOpen; + + PLT_ADAPTER Adapter = (PLT_ADAPTER)MacAdapterContext; + NDIS_STATUS StatusToReturn = NDIS_STATUS_SUCCESS; + + // if the adapter is being closed, then do not allow the open + LtReferenceAdapter(Adapter, &StatusToReturn); + if (StatusToReturn != NDIS_STATUS_SUCCESS) + { + ASSERTMSG("LtInitOpenAdapter: Adapter is closing down!\n", 0); + return(StatusToReturn); + } + + do + { + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("LtInitOpenAdapter Entered:\n")); + + // Search thru the supplied MediumArray for NdisMediumLocalTalk + for (i = 0; i < MediumArraySize; i++) + { + if (MediumArray[i] == NdisMediumLocalTalk) + { + break; + } + } + + if (i == MediumArraySize) + { + StatusToReturn = NDIS_STATUS_UNSUPPORTED_MEDIA; + break; + } + + *SelectedMediumIndex = i; + + // Allocate some space for the open binding. + NdisAllocateMemory( + (PVOID)&NewOpen, + (UINT)sizeof(LT_OPEN), + (UINT)0, + LtNdisPhyAddr); + + if (NewOpen == NULL) + { + StatusToReturn = NDIS_STATUS_RESOURCES; + + // NdisWriteErrorLogEntry(); + TMPLOGERR(); + break; + } + + NdisZeroMemory( + NewOpen, + sizeof(LT_OPEN)); + + *MacBindingHandle = (NDIS_HANDLE)NewOpen; + NewOpen->NdisBindingContext = NdisBindingContext; + NewOpen->Flags |= BINDING_OPEN; + NewOpen->LtAdapter = Adapter; + + // Set the creation reference + NewOpen->RefCount = 1; + InitializeListHead(&NewOpen->Linkage); + + // Insert into adapter list and increment adapter open count. + NdisAcquireSpinLock(&Adapter->Lock); + InsertTailList(&Adapter->OpenBindings, &NewOpen->Linkage); + Adapter->OpenCount++; + NdisReleaseSpinLock(&Adapter->Lock); + + } while (FALSE); + + if (StatusToReturn != NDIS_STATUS_SUCCESS) + { + LtDeReferenceAdapter(Adapter); + } + + return StatusToReturn; +} + + + + +NDIS_STATUS +LtInitCloseAdapter( + IN NDIS_HANDLE MacBindingHandle + ) +/*++ + +Routine Description: + + Called by NDIS to close a binding. + +Arguments: + + MacBindingHandle : Context passed back in OpenAdapter. + +Return Value: + + NDIS_STATUS_SUCCESS : If successful, error otherwise. + NDIS_STATUS_PENDING : If pending. + +--*/ +{ + + PLT_ADAPTER Adapter; + PLT_OPEN Open; + + NDIS_STATUS StatusToReturn = NDIS_STATUS_PENDING; + BOOLEAN Closing = FALSE; + + Open = (PLT_OPEN)MacBindingHandle; + Adapter = Open->LtAdapter; + + + NdisAcquireSpinLock(&Adapter->Lock); + + // Do not do any thing if already closing. + if (Open->Flags & BINDING_CLOSING) + { + StatusToReturn = NDIS_STATUS_CLOSING; + } + else + { + // This flag prevents further requests on this binding. + Open->Flags |= BINDING_CLOSING; + Closing = TRUE; + } + + NdisReleaseSpinLock(&Adapter->Lock); + + + if (Closing) + { + // Remove the creation reference + LtDeReferenceBinding(Open); + } + + return StatusToReturn; +} + + + + +VOID +LtInitUnload( + IN NDIS_HANDLE MacMacContext + ) +/*++ + +Routine Description: + + Called when the driver is to be unloaded. + +Arguments: + + MacMacContext : Context passed to RegisterMac. + +Return Value: + + None. + +--*/ +{ + NDIS_STATUS Status; + UNREFERENCED_PARAMETER(MacMacContext); + + ASSERT(MacMacContext == (NDIS_HANDLE)NULL); + + NdisDeregisterMac( + &Status, + LtMacHandle); + + NdisTerminateWrapper( + LtNdisWrapperHandle, + NULL); + + return; +} + + + + +NDIS_STATUS +LtInitRegisterAdapter( + IN NDIS_HANDLE LtMacHandle, + IN NDIS_HANDLE WrapperConfigurationContext, + IN PNDIS_STRING AdapterName, + IN NDIS_INTERFACE_TYPE BusType, + IN UCHAR SuggestedNodeId, + IN UINT IoBaseAddress, + IN UINT MaxAdapters, + IN NDIS_STATUS ConfigError + ) +/*++ + +Routine Description: + + This routine (and its interface) are not portable. They are + defined by the OS, the architecture, and the particular Lt + implementation. + + This routine is responsible for the allocation of the datastructures + for the driver as well as any hardware specific details necessary + to talk with the device. + +Arguments: + + LtMacHandle : The handle given back to the mac from ndis when + the mac registered itself. + + WrapperConfigurationContext + : configuration context passed in by NDIS in the AddAdapter + call. + + AdapterName : The string containing the name to give to the device adapter. + BusType : The type of bus in use. (MCA, ISA, EISA ...) + IoBaseAddress : The base IO address of the card. + MaxAdapters : The maximum number of opens at any one time. + ConfigError : Error with the Config parameters if any. + +Return Value: + + NDIS_STATUS_SUCCESS : If successful, error otherwise. + +--*/ +{ + // Pointer for the adapter root. + PLT_ADAPTER Adapter; + NDIS_STATUS Status, RefStatus; + NDIS_ERROR_CODE LogErrorCode; + + // Holds information needed when registering the adapter. + NDIS_ADAPTER_INFORMATION AdapterInformation; + + // Allocate the Adapter block. + NdisAllocateMemory( + (PVOID)&Adapter, + sizeof(LT_ADAPTER), + 0, + LtNdisPhyAddr); + + if (Adapter == NULL) + { + return(NDIS_STATUS_RESOURCES); + } + + NdisZeroMemory( + Adapter, + sizeof(LT_ADAPTER)); + + Adapter->NdisMacHandle = LtMacHandle; + + // Set up the AdapterInformation structure. + NdisZeroMemory (&AdapterInformation, sizeof(NDIS_ADAPTER_INFORMATION)); + + AdapterInformation.DmaChannel = 0; + AdapterInformation.Master = FALSE ; + AdapterInformation.Dma32BitAddresses = FALSE ; + AdapterInformation.AdapterType = BusType ; + AdapterInformation.PhysicalMapRegistersNeeded = 0; + AdapterInformation.MaximumPhysicalMapping = 0; + AdapterInformation.NumberOfPortDescriptors = 1 ; + AdapterInformation.PortDescriptors[0].InitialPort = IoBaseAddress; + AdapterInformation.PortDescriptors[0].NumberOfPorts = 4; + AdapterInformation.PortDescriptors[0].PortOffset = (PVOID *)(&(Adapter->MappedIoBaseAddr)); + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR, + ("LtInitRegisterAdapter: IoBaseAddr %lx\n", IoBaseAddress)); + + // Register the adapter with NDIS. + if ((Status = NdisRegisterAdapter( + &Adapter->NdisAdapterHandle, + Adapter->NdisMacHandle, + Adapter, + WrapperConfigurationContext, + AdapterName, + &AdapterInformation)) != NDIS_STATUS_SUCCESS) + { + // Could not register the adapter, so we cannot log any errors + // either. + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_FATAL, + ("LtInitRegisterAdapter: Failed %lx\n", Status)); + + // Free up the memory allocated. + NdisFreeMemory( + Adapter, + sizeof(LT_ADAPTER), + 0); + + return(Status); + } + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_ERR, + ("LtInitRegisterAdapter: MappedIoBaseAddr %lx\n", Adapter->MappedIoBaseAddr)); + + do + { + // Ok. We are all set. + Adapter->BusType = BusType; + + InitializeListHead(&Adapter->Request); + InitializeListHead(&Adapter->OpenBindings); + + InitializeListHead(&Adapter->LoopBack); + InitializeListHead(&Adapter->Transmit); + InitializeListHead(&Adapter->Receive); + + NdisAllocateSpinLock(&Adapter->Lock); + + Adapter->OpenCount = 0; + + // Set refcount to 1 - creation + Adapter->RefCount = 1; + + NdisInitializeTimer( + &Adapter->PollingTimer, + LtTimerPoll, + (PVOID)Adapter); + + // If there were no configuration errors, then go ahead with the + // initialize. + + if (ConfigError == NDIS_STATUS_SUCCESS) + { + // Start the card up. This writes an error + // log entry if it fails. + if (LtFirmInitialize(Adapter, SuggestedNodeId)) + { + // Ok, the firmware code has been downloaded to the card. + // Start the poll timer. We should do this before we call + // GetAddress. Add a reference for the timer. + NdisAcquireSpinLock(&Adapter->Lock); + LtReferenceAdapterNonInterlock(Adapter, &RefStatus); + + ASSERTMSG("LtInitRegisterAdapter: RefAdater Failed!\n", + (RefStatus == NDIS_STATUS_SUCCESS)); + + Adapter->Flags |= ADAPTER_TIMER_QUEUED; + NdisSetTimer(&Adapter->PollingTimer, LT_POLLING_TIME); + NdisReleaseSpinLock(&Adapter->Lock); + break; + } + + LogErrorCode = NDIS_ERROR_CODE_HARDWARE_FAILURE; + + } + else + { + LogErrorCode = NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER; + } + + + // We either could not initialize the hardware or get the node + // address. OR there was a config error. Log it and deregister + // the adapter. + LOGERROR(Adapter->NdisAdapterHandle, LogErrorCode); + + // Deregister the adapter. This calls LtInitRemoveAdapter which + // will do all necessary cleanup. + NdisDeregisterAdapter(Adapter->NdisAdapterHandle); + + Status = NDIS_STATUS_FAILURE; + break; + + } while (FALSE); + + return(Status); +} + + + + +BOOLEAN +LtInitGetAddressSetPoll( + IN PLT_ADAPTER Adapter, + IN UCHAR SuggestedNodeId + ) +/*++ + +Routine Description: + + This gets the node id from the card (starts it off actually) and + sets the card to be in polling mode. + +Arguments: + + Adapter : Pointer to the adapter structure + SuggestedNodeId : Pram node id or 0 + +Return Value: + + TRUE : if success, FALSE otherwise + +--*/ +{ + ULONG Seed, Random; + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("LtGetAddress: Getting a node address for lt adapter...\n")); + + if (SuggestedNodeId == 0) + { + Seed = (ULONG)Adapter; + Random = RtlRandom(&Seed); + SuggestedNodeId = + (UCHAR)((Random % LT_MAX_CLIENT_NODE_ID) + LT_MIN_SERVER_NODE_ID); + } + + DBGPRINT(DBG_COMP_INIT, DBG_LEVEL_INFO, + ("LtGetAddress: Suggested Node Id = %lx\n", SuggestedNodeId)); + + // Command Length LSB + NdisRawWritePortUchar(XFER_PORT, 2); + + // Command Length MSB + NdisRawWritePortUchar(XFER_PORT, 0); + + NdisRawWritePortUchar(XFER_PORT, (UCHAR)LT_CMD_LAP_INIT); + + NdisRawWritePortUchar(XFER_PORT, SuggestedNodeId); + + // Use 0xFF for the interrupt if this card is to be polled. + // We *ONLY* support polling. + NdisRawWritePortUchar(XFER_PORT, LT_ADAPTER_POLLED_MODE); + + return TRUE; +} + + + diff --git a/private/ntos/ndis/lt200/ltinit.h b/private/ntos/ndis/lt200/ltinit.h new file mode 100644 index 000000000..c067c63b5 --- /dev/null +++ b/private/ntos/ndis/lt200/ltinit.h @@ -0,0 +1,96 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltinit.h + +Abstract: + + This module contains definitions specific to init code. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTINIT_H_ +#define _LTINIT_H_ + +// Exports/Prototypes +extern +NDIS_STATUS +LtInitAddAdapter( + IN NDIS_HANDLE MacAdapterContext, + IN NDIS_HANDLE ConfigurationHandle, + IN PNDIS_STRING AdapterName); + +extern +VOID +LtInitRemoveAdapter( + IN NDIS_HANDLE MacAdapterContext); + +extern +NDIS_STATUS +LtInitOpenAdapter( + OUT PNDIS_STATUS OperErrorStatus, + OUT NDIS_HANDLE *MacBindingHandle, + OUT PUINT SelectedMediumIndex, + IN PNDIS_MEDIUM MediumArray, + IN UINT MediumArraySize, + IN NDIS_HANDLE NdisBindingContext, + IN NDIS_HANDLE MacAdapterContext, + IN UINT OpenOptions, + IN PSTRING AddressingInformation); + +extern +NDIS_STATUS +LtInitCloseAdapter( + IN NDIS_HANDLE MacBindingHandle); + +extern +VOID +LtInitUnload( + IN NDIS_HANDLE MacMacContext); + +extern +NDIS_STATUS +LtInitRegisterAdapter( + IN NDIS_HANDLE LtMacHandle, + IN NDIS_HANDLE WrapperConfigurationContext, + IN PNDIS_STRING AdapterName, + IN NDIS_INTERFACE_TYPE BusType, + IN UCHAR SuggestedNodeId, + IN UINT IoBaseAddress, + IN UINT MaxAdapters, + IN NDIS_STATUS Status); + +extern +BOOLEAN +LtInitGetAddressSetPoll( + IN PLT_ADAPTER Adapter, + IN UCHAR SuggestedNodeId); + +#ifdef LTINIT_H_LOCALS + +NTSTATUS +DriverEntry ( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath); + + + + + +#endif // LTINIT_H_LOCALS + + +#endif // _LTINIT_H_ + diff --git a/private/ntos/ndis/lt200/ltloop.c b/private/ntos/ndis/lt200/ltloop.c new file mode 100644 index 000000000..9baad5bd5 --- /dev/null +++ b/private/ntos/ndis/lt200/ltloop.c @@ -0,0 +1,185 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltloop.c + +Abstract: + + This module contains the loopback queue processing routines. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#include "ltmain.h" + +// Define file id for errorlogging +#define FILENUM LTLOOP + + +VOID +LtLoopProcessQueue( + IN PLT_ADAPTER Adapter + ) +/*++ + +Routine Description: + + This routine is responsible for indicating *one* packet on + the loopback queue either completing it or moving on to the + finish send queue. + +Arguments: + + Adapter - The adapter whose loopback queue we are processing. + +Return Value: + + None. + +--*/ +{ + // Packet at the head of the loopback list. + PNDIS_PACKET Packet; + + // The reserved portion of the above packet. + PLT_PACKET_RESERVED Reserved; + + // Buffer for loopback. + CHAR Loopback[LT_MAX_INDICATE_SIZE]; + + // The first buffer in the ndis packet to be loopedback. + PNDIS_BUFFER FirstBuffer; + + // The total amount of user data in the packet to be + // loopedback. + UINT PacketLength; + + // Eventually the address of the data to be indicated + // to the transport. + PCHAR BufferAddress, LinkAddress; + + // Eventually the length of the data to be indicated + // to the transport. + UINT BufferLength; + PLIST_ENTRY p; + PLT_OPEN Binding; + + + NdisAcquireSpinLock(&Adapter->Lock); + while((!IsListEmpty(&Adapter->LoopBack)) && + ((Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) == 0)) + { + p = RemoveHeadList(&Adapter->LoopBack); + Packet = CONTAINING_RECORD( + p, + NDIS_PACKET, + MacReserved); + + Reserved = (PLT_PACKET_RESERVED)Packet->MacReserved; + + // Remember this in CurrentLoopbackPacket in Adapter. + // Used by Transfer data. + Adapter->CurrentLoopbackPacket = Packet; + NdisReleaseSpinLock(&Adapter->Lock); + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO, + ("LtLoopProcessLoopback: Dequeued %lx \n", Packet)); + + // See if we need to copy the data from the packet + // into the loopback buffer. + // + // We need to copy to the local loopback buffer if + // the first buffer of the packet is less than the + // minimum loopback size AND the first buffer isn't + // the total packet. + NdisQueryPacket( + Packet, + NULL, + NULL, + &FirstBuffer, + &PacketLength); + + NdisQueryBuffer( + FirstBuffer, + &BufferAddress, + &BufferLength); + + LinkAddress = BufferAddress; + if (BufferLength != PacketLength) + { + // !!!BUGBUG: What do the sizes mean? + LtUtilsCopyFromPacketToBuffer( + Packet, + LT_DGRAM_OFFSET, + LT_MAX_INDICATE_SIZE, + Loopback, + &BufferLength); + + BufferAddress = Loopback; + + } + else + { + // Adjust the buffer to account for the link header + // which is not part of the lookahead. + BufferAddress += LT_DGRAM_OFFSET; + BufferLength -= LT_LINK_HEADER_LENGTH; + } + + // Indicate the packet to every open binding + // that could want it. Since loopback indications + // are seralized, we use a NULL handle to indicate that it + // is for a loopback packet. TransferData always gets the + // first packet off the loopback queue. + + // Since we do not have an complicated filtering to do. + // Just walk the list of Open bindings and Indicate the packet + + NdisAcquireSpinLock(&Adapter->Lock); + LtRecvIndicatePacket( + Adapter, + LinkAddress, + BufferAddress, + BufferLength, + PacketLength - LT_LINK_HEADER_LENGTH, + (NDIS_HANDLE)NULL); + NdisReleaseSpinLock(&Adapter->Lock); + + + // We have indicated the packet to all the binding. Now we just + // need to call send completion. + + DBGPRINT(DBG_COMP_LOOP, DBG_LEVEL_WARN, + ("LtLoopProcessLoopback: NdisSendComplete Packet = %p\n", Packet )); + + + Binding = (PLT_OPEN)(Reserved->MacBindingHandle); + NdisCompleteSend( + Binding->NdisBindingContext, + Packet, + NDIS_STATUS_SUCCESS); + + // Dereference the adapter and the binding for this completed + // send. + LtDeReferenceBinding(Binding); + LtDeReferenceAdapter(Adapter); + + NdisAcquireSpinLock(&Adapter->Lock); + } + NdisReleaseSpinLock(&Adapter->Lock); + + return; +} + + diff --git a/private/ntos/ndis/lt200/ltloop.h b/private/ntos/ndis/lt200/ltloop.h new file mode 100644 index 000000000..359b5d470 --- /dev/null +++ b/private/ntos/ndis/lt200/ltloop.h @@ -0,0 +1,37 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltloop.h + +Abstract: + + This module contains definitions from ltloop.c + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTLOOP_H_ +#define _LTLOOP_H_ + +VOID +LtLoopProcessQueue( + IN PLT_ADAPTER Adapter); + +#ifdef LTLOOP_H_LOCALS + +#endif // LTLOOP_H_LOCALS + + +#endif // _LTLOOP_H_ + diff --git a/private/ntos/ndis/lt200/ltmain.h b/private/ntos/ndis/lt200/ltmain.h new file mode 100644 index 000000000..3b7d7e63c --- /dev/null +++ b/private/ntos/ndis/lt200/ltmain.h @@ -0,0 +1,53 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltmain.h + +Abstract: + + This module is the main common include file. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTMAIN_H_ +#define _LTMAIN_H_ + +#include <ndis.h> +#include <stdlib.h> + +// !!!ntddk.h doesnt include the prototype for this function!!! +ULONG +RtlRandom ( + PULONG Seed); + +#include "ltdebug.h" +#include "lthrd.h" +#include "ltsft.h" +#include "ltinit.h" +#include "ltsend.h" +#include "ltrecv.h" +#include "ltloop.h" +#include "ltutils.h" + +// Define all the globals +#include "ltglobal.h" + +#ifdef LTMAIN_H_LOCALS + +#endif // LTMAIN_H_LOCALS + + +#endif // _LTMAIN_H_ + diff --git a/private/ntos/ndis/lt200/ltrecv.c b/private/ntos/ndis/lt200/ltrecv.c new file mode 100644 index 000000000..bf468c617 --- /dev/null +++ b/private/ntos/ndis/lt200/ltrecv.c @@ -0,0 +1,523 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltrecv.c + +Abstract: + + This module contains the receive processing routines. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define LTRECV_H_LOCALS +#include "ltmain.h" + +// Define file id for errorlogging +#define FILENUM LTRECV + + +VOID +LtRecvProcessQueue( + IN PLT_ADAPTER Adapter + ) +/*++ + +Routine Description: + + This routine is called by the timer poll routine to process the receive + queue. Note that the actual receives from the card happen in the timer + poll routine itself. + +Arguments: + + Adapter : Pointer to the Adapter on which receive completion + needs to happen. + +Return Value: + + None. + +--*/ +{ + + UINT PacketLength, DgramLength; + PUCHAR Packet, Dgram; + PLIST_ENTRY p; + PRECV_DESC RecvDesc; + + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_ENTRY, + ("LtRecvProcessQueue: Entering...\n")); + + NdisAcquireSpinLock(&Adapter->Lock); + while((!IsListEmpty(&Adapter->Receive)) && + ((Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) == 0)) + { + p = RemoveHeadList(&Adapter->Receive); + RecvDesc = CONTAINING_RECORD( + p, + RECV_DESC, + Linkage); + + // We will always have the link header at minimum + PacketLength = RecvDesc->BufferLength; + DgramLength = PacketLength - LT_LINK_HEADER_LENGTH; + ASSERTMSG("LtRecvProcessQueue: Packet length 0!\n", PacketLength != 0); + + Packet = (PUCHAR)((PUCHAR)RecvDesc+sizeof(RECV_DESC)); + Dgram = Packet + LT_LINK_HEADER_LENGTH; + + if (IsListEmpty(&Adapter->OpenBindings)) + { + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_WARN, + ("LtRecvProcessQueue: No Binding! Discarding packet!\n")); + + // No body to receive this, free up the buffer; + NdisFreeMemory( + RecvDesc, + sizeof(RecvDesc)+PacketLength, + 0); + + continue; + } + + // Indicate the packet to all the open bindings on this adapter. + // After return from this routine, we should be able to free up + // the packet. + LtRecvIndicatePacket( + Adapter, + Packet, + Dgram, + DgramLength, + DgramLength, + (NDIS_HANDLE)Packet); + + NdisFreeMemory( + RecvDesc, + sizeof(RecvDesc)+PacketLength, + 0); + } + + + // Check if we need to do any receive completes. + LtRecvQueueCompletion(Adapter); + + NdisReleaseSpinLock(&Adapter->Lock); + + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_ENTRY, + ("LTProcessReceiveQueue: Leaving...\n")); + + return; +} + + + + +NDIS_STATUS +LtRecvTransferData( + IN NDIS_HANDLE MacBindingHandle, + IN NDIS_HANDLE MacReceiveContext, + IN UINT ByteOffset, + IN UINT BytesToTransfer, + OUT PNDIS_PACKET Packet, + OUT PUINT BytesTransferred + ) +/*++ + +Routine Description: + + This is called by ndis to transfer previously indicated data. A + MacReceiveContext of NULL is used to transfer data from the current + loopback packet. + +Arguments: + + As described in NDIS 3.0. + MacReceiveContext : NULL - Use current loopback packet + Otherwise it is a pointer to a RECV_DESC. + +Return Value: + + NDIS_STATUS_SUCCESS : If successful, error otherwise. + +--*/ +{ + BOOLEAN DerefAdapter = FALSE; + BOOLEAN DerefBinding = FALSE; + PLT_OPEN Binding = (PLT_OPEN)MacBindingHandle; + PLT_ADAPTER Adapter = Binding->LtAdapter; + NDIS_STATUS Status = NDIS_STATUS_SUCCESS; + + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_ENTRY, + ("LtRecvTransferData: Entered\n")); + + NdisAcquireSpinLock(&Adapter->Lock); + do + { + LtReferenceAdapterNonInterlock(Adapter, &Status); + if (Status != NDIS_STATUS_SUCCESS) + { + Status = NDIS_STATUS_REQUEST_ABORTED; + break; + } + else + { + DerefAdapter = TRUE; + LtReferenceBindingNonInterlock(Binding, &Status); + if (Status != NDIS_STATUS_SUCCESS) + { + Status = NDIS_STATUS_REQUEST_ABORTED; + break; + } + DerefBinding = TRUE; + } + + if (Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) + { + Status = NDIS_STATUS_RESET_IN_PROGRESS; + break; + } + + } while (FALSE); + NdisReleaseSpinLock(&Adapter->Lock); + + if (Status == NDIS_STATUS_SUCCESS) + { + if (MacReceiveContext == NULL) + { + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_INFO, + ("LtRecvTransferData: CurrentLookXfer\n")); + + NdisCopyFromPacketToPacket( + Packet, + 0, + BytesToTransfer, + Adapter->CurrentLoopbackPacket, + ByteOffset + LT_LINK_HEADER_LENGTH, + BytesTransferred); + + } + else + { + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_INFO, + ("LtRecvTransferData: NormalXfer\n")); + + LtUtilsCopyFromBufferToPacket( + (PUCHAR)MacReceiveContext, + ByteOffset + LT_LINK_HEADER_LENGTH, + BytesToTransfer, + Packet, + BytesTransferred); + } + } + + if (DerefAdapter) + LtDeReferenceAdapter(Adapter); + + if (DerefBinding) + LtDeReferenceBinding(Binding); + + return Status; +} + + + + +VOID +LtRecvIndicatePacket( + IN PLT_ADAPTER Adapter, + IN PUCHAR LinkHdr, + IN PUCHAR LookAheadBuffer, + IN UINT LookAheadSize, + IN UINT DgramLength, + IN NDIS_HANDLE IndicateCtx + ) +/*++ + +Routine Description: + + This routine is called to indicate a specific packet to all bindings + on an adapter. + +Arguments: + + Adapter : Pointer to the adapter + LinkHdr : Link header, guaranteed to be 3 bytes + LookAheadBuffer : Lookahead buffer to indicate + LookAheadSize : Size of lookahead buffer (excludes link header) + DgramLength : Size of the complete packet (excludes link header) + IndicateCtx : Ctx to pass as indicate context to NDIS + +Return Value: + + None. + +--*/ +{ + NDIS_STATUS RefStatus, Status; + PLT_OPEN NextBinding, Binding; + UINT CurLookAheadSize; + + NextBinding = NULL; + LtReferenceBindingNextNcNonInterlock( + Adapter->OpenBindings.Flink, + &Adapter->OpenBindings, + &Binding, + &RefStatus); + + while (RefStatus == NDIS_STATUS_SUCCESS) + { + // Reference the next non-closing binding + LtReferenceBindingNextNcNonInterlock( + Binding->Linkage.Flink, + &Adapter->OpenBindings, + &NextBinding, + &RefStatus); + + // Never more than one binding usually, remove when not true. + ASSERT(RefStatus != NDIS_STATUS_SUCCESS); + + // Go ahead and do the indicate. + CurLookAheadSize = Binding->CurrentLookAheadSize; + + if (((LtUtilsUcharPacketType(LinkHdr[0], LinkHdr[1]) == LT_BROADCAST) && + (Binding->CurrentPacketFilter & NDIS_PACKET_TYPE_BROADCAST)) + + || + + ((LtUtilsUcharPacketType(LinkHdr[0], LinkHdr[1]) != LT_BROADCAST) && + (Binding->CurrentPacketFilter & NDIS_PACKET_TYPE_DIRECTED))) + { + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_INFO, + ("LtRecvIndicatePacket: Indicating packet on bind %lx\n", + Binding)); + + NdisReleaseSpinLock(&Adapter->Lock); + + NdisIndicateReceive( + &Status, + Binding->NdisBindingContext, + IndicateCtx, + LinkHdr, + LT_LINK_HEADER_LENGTH, + LookAheadBuffer, + ((LookAheadSize > CurLookAheadSize) ? \ + CurLookAheadSize : LookAheadSize), + DgramLength); + + NdisAcquireSpinLock(&Adapter->Lock); + + if (Status != NDIS_STATUS_SUCCESS) + { + Adapter->MediaOptional[MO_NO_HANDLERS] ++; + } + + // Since this routine is called within a loop in LtRecvProcessQueue, + // and since we need only one reference per binding for receive + // completion, we do the following to avoid over-referencing the + // binding structure. + + if (Binding->Flags & BINDING_DO_RECV_COMPLETION) + { + NdisReleaseSpinLock(&Adapter->Lock); + LtDeReferenceBinding(Binding); + NdisAcquireSpinLock(&Adapter->Lock); + + } + else + { + // Remember this binding needs a receive completion + Binding->Flags |= BINDING_DO_RECV_COMPLETION; + } + + // Also, make a note in the adapter so that the receive + // completion handler is enqueued. + Adapter->Flags |= ADAPTER_QUEUE_RECV_COMPLETION; + + } + else + { + // Remove the reference on this binding. + NdisReleaseSpinLock(&Adapter->Lock); + LtDeReferenceBinding(Binding); + NdisAcquireSpinLock(&Adapter->Lock); + } + + // Never more than one binding usually, remove when not true. + ASSERT(RefStatus != NDIS_STATUS_SUCCESS); + + Binding = NextBinding; + } + + return; +} + + + + +VOID +LtRecvQueueCompletion( + IN PLT_ADAPTER Adapter + ) +/*++ + +Routine Description: + + This routine is used to queue up a completion handler on the adapter. + This handler will then indicate receive completion to all necessary + bindings on the adapter. + + ASSUMES: Adapter->Lock is HELD. + +Arguments: + + Adapter : Pointer to the adapter + +Return Value: + + None. + +--*/ +{ + NDIS_STATUS Status; + BOOLEAN Queue = FALSE; + + // !!! ASSUMES Adapter->Lock is held!!! + if (Adapter->Flags & ADAPTER_QUEUE_RECV_COMPLETION) + { + if ((Adapter->Flags & ADAPTER_QUEUED_RECV_COMPLETION) == 0) + { + Adapter->Flags |= ADAPTER_QUEUED_RECV_COMPLETION; + Queue = TRUE; + } + + Adapter->Flags &= ~ADAPTER_QUEUE_RECV_COMPLETION; + } + + if (Queue) + { + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_INFO, + ("LtRecvQueueCompletion: queing receive complete\n")); + + // !!! NOTE !!! + // This should never fail!! If Queue is set, then a binding + // was referenced for receive completion. So it couldnt have + // gone away. And so the adapter cannot be in a CLOSING state. + // As all binding need to have gone away, before the RemovAdapter + // is called by NDIS. + + LtReferenceAdapterNonInterlock(Adapter, &Status); + ASSERTMSG("LtRecvQueueCompletion: Adapter is closing!\n", + (Status == NDIS_STATUS_SUCCESS)); + + if (Status != NDIS_STATUS_SUCCESS) + { + // !!! KEBUGCHECK() !!! + KeBugCheck((ULONG)__LINE__); + } + + NdisReleaseSpinLock(&Adapter->Lock); + LtRecvCompletion(Adapter); + LtDeReferenceAdapter(Adapter); + NdisAcquireSpinLock(&Adapter->Lock); + } + + return; +} + + + +NTSTATUS +LtRecvCompletion( + IN PLT_ADAPTER Adapter + ) +/*++ + +Routine Description: + + Called to indicate receive completion on all binding on this adapter. + This will loop until all receive completions are done. This might + tend to starve bindings towards the end of the list, but we wont + worry about that. + +Arguments: + + Adapter : Pointer to the Adapter on which receive completion + needs to happen. + +Return Value: + + STATUS_SUCCESS + +--*/ +{ + PLIST_ENTRY p; + PLT_OPEN Binding; + + // For each binding, if recv completion is to be called, do it. + NdisAcquireSpinLock(&Adapter->Lock); + + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_INFO, + ("LtRecvCompletion: Indicating receive completion\n")); + + for (p = Adapter->OpenBindings.Flink; (p != &Adapter->OpenBindings);) + { + Binding = CONTAINING_RECORD( + p, + LT_OPEN, + Linkage); + + if (Binding->Flags & BINDING_DO_RECV_COMPLETION) + { + Binding->Flags &= ~BINDING_DO_RECV_COMPLETION; + } + else + { + // !!! Note the continue in here !!! + + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_WARN, + ("LtRecvCompletion: No recv comp flag on binding\n")); + + p = p->Flink; + + // Never more than one binding usually, remove when not true. + ASSERT(p == &Adapter->OpenBindings); + continue; + } + + NdisReleaseSpinLock(&Adapter->Lock); + + // Call NdisReceiveCompletion for this binding. + NdisIndicateReceiveComplete(Binding->NdisBindingContext); + + // Dereference the binding, this was added in the process queue + // routine. + LtDeReferenceBinding(Binding); + + NdisAcquireSpinLock(&Adapter->Lock); + + // Restart the search + p = Adapter->OpenBindings.Flink; + } + + DBGPRINT(DBG_COMP_RECV, DBG_LEVEL_INFO, + ("LtRecvCompletion: Enabling receive queing\n")); + + // Enable any new queue requests to take effect. + Adapter->Flags &= ~ADAPTER_QUEUED_RECV_COMPLETION; + NdisReleaseSpinLock(&Adapter->Lock); + + return STATUS_SUCCESS; +} + diff --git a/private/ntos/ndis/lt200/ltrecv.h b/private/ntos/ndis/lt200/ltrecv.h new file mode 100644 index 000000000..7dcd8eff3 --- /dev/null +++ b/private/ntos/ndis/lt200/ltrecv.h @@ -0,0 +1,78 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltrecv.h + +Abstract: + + This module contains definitions for the receive packet processing. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTRECV_H_ +#define _LTRECV_H_ + +extern +VOID +LtRecvProcessQueue( + IN PLT_ADAPTER Adapter); + +extern +NDIS_STATUS +LtRecvTransferData( + IN NDIS_HANDLE MacBindingHandle, + IN NDIS_HANDLE MacReceiveContext, + IN UINT ByteOffset, + IN UINT BytesToTransfer, + OUT PNDIS_PACKET Packet, + OUT PUINT BytesTransferred); + +VOID +LtRecvQueueCompletion( + IN PLT_ADAPTER Adapter); + +VOID +LtRecvIndicatePacket( + IN PLT_ADAPTER Adapter, + IN PUCHAR LinkHdr, + IN PUCHAR LookaheadBuffer, + IN UINT LookaheadSize, + IN UINT DgramLength, + IN NDIS_HANDLE IndicateCtx); + +NTSTATUS +LtRecvCompletion( + IN PLT_ADAPTER Adapter); + +// Define the Receive descriptor. This will contain info about the packet +// and the packet itself will follow this structure. +typedef struct _LT_RECV_DESC { + LIST_ENTRY Linkage; + BOOLEAN Broadcast; + UINT BufferLength; + + // + // This is followed by BufferLength bytes of data + // UCHAR Buffer[BufferLength]; + +} RECV_DESC, *PRECV_DESC; + +#ifdef LTRECV_H_LOCALS + +#endif // LTRECV_H_LOCALS + + +#endif // _LTRECV_H_ + diff --git a/private/ntos/ndis/lt200/ltreg.c b/private/ntos/ndis/lt200/ltreg.c new file mode 100644 index 000000000..36a89a019 --- /dev/null +++ b/private/ntos/ndis/lt200/ltreg.c @@ -0,0 +1,262 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltreg.c + +Abstract: + + This module contains helper routines for reading configuration + information from the registry. + +Author: + + Nikhil Kamkolkar (nikhilk@microsoft.com) + Stephen Hou (stephh@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define LTREG_H_LOCALS +#include "ltmain.h" +#include "ltreg.h" + +// Define file id for errorlogging +#define FILENUM LTREG + + +UINT +LtRegGetBusNumber( + IN NDIS_HANDLE ConfigHandle + ) +/*++ + +Routine Description: + + This routine determines the bus number the card is installed on + +Arguments: + + ConfigHandle : The handle to the configuration database + +Return Value: + + Returns the bus number the card is on. If we do not find the + relevant information in the database, then 0 is returned. + +--*/ +{ + NDIS_STATUS Status; + PNDIS_CONFIGURATION_PARAMETER Parameter; + + UINT BusNumber = 0; + + NDIS_STRING Keyword = LT_REG_KEY_BUS_NUMBER_STRING; + + NdisReadConfiguration( + &Status, + &Parameter, + ConfigHandle, + &Keyword, + NdisParameterInteger); + + if (Status == NDIS_STATUS_SUCCESS) + { + BusNumber = (UINT)Parameter->ParameterData.IntegerData; + } + + return(BusNumber); +} + + +NDIS_STATUS +LtRegGetBusType( + IN NDIS_HANDLE ConfigHandle, + OUT PNDIS_INTERFACE_TYPE BusType + ) +/*++ + +Routine Description: + + This routine determines the type of bus the card is installed on + +Arguments: + + ConfigHandle : The handle to the configuration database + BusType : On return, the bus type is stored here + +Return Value: + + NDIS_STATUS_SUCCESS : if successfully read from the config database + NDIS_STATUS_FAILURE : if unable to find the information in the config + database + +--*/ +{ + NDIS_STATUS Status; + PNDIS_CONFIGURATION_PARAMETER Parameter; + + NDIS_STRING Keyword = LT_REG_KEY_BUS_TYPE_STRING; + + NdisReadConfiguration( + &Status, + &Parameter, + ConfigHandle, + &Keyword, + NdisParameterInteger); + + if (Status == NDIS_STATUS_SUCCESS) + { + *BusType = (UINT)Parameter->ParameterData.IntegerData; + } + + return(Status); +} + + +UCHAR +LtRegGetNodeId( + IN NDIS_HANDLE ConfigHandle + ) +/*++ + +Routine Description: + + This routine determines the last NodeId used by the card. + +Arguments: + + ConfigHandle : The handle to the configuration database + +Return Value: + + Returns the last valid NodeId used by the card. If we find that + the value stored in the configuration info is not valid, then the + suggested NodeId is returned. + +--*/ +{ + NDIS_STATUS Status; + PNDIS_CONFIGURATION_PARAMETER Parameter; + + NDIS_STRING Keyword = LT_REG_KEY_NODE_ID_STRING; + UCHAR NodeId = 0; + + NdisReadConfiguration( + &Status, + &Parameter, + ConfigHandle, + &Keyword, + NdisParameterInteger); + + if (Status == NDIS_STATUS_SUCCESS) + { + NodeId = (UCHAR)Parameter->ParameterData.IntegerData; + if ((NodeId < LT_NODE_ID_MIN) || (NodeId > LT_NODE_ID_MAX)) + { + + NodeId = 0; + } + } + + return(NodeId); +} + + +NDIS_STATUS +LtRegGetIoBaseAddr( + OUT PUINT IoBaseAddress, + IN NDIS_HANDLE NdisConfigHandle, + IN NDIS_HANDLE ConfigHandle, + IN NDIS_INTERFACE_TYPE BusType + ) +/*++ + +Routine Description: + + This routine determines the port addresses used to communicate + with the card. + +Arguments: + + IoBaseAddress : On return, the I/O port address is stored here + ConfigHandle : The handle to the configuration database + SlotNumber : For MCA machines, the indicates the slot the card is in + BusType : The type of bus the card is located on + +Return Value: + + NDIS_STATUS_SUCCESS : if successful + NDIS_STATUS_ADAPTER_NOT_FOUND : if running on a MCA machine and + the adapter cannot be located + NDIS_STATUS_BAD_CHARACTERISTICS : if the I/O base is not within + the legal range + +--*/ +{ + NDIS_MCA_POS_DATA McaData; + NDIS_STATUS Status; + PNDIS_CONFIGURATION_PARAMETER Parameter; + + NDIS_STRING Keyword = LT_REG_KEY_IO_BASE_ADDRESS_STRING; + UINT SlotNumber = 0; + + // If BusType is NdisInterfaceMca, then we read the MCA POS info to + // get our parameters. Otherwise, we just read the registry. + + if (BusType == NdisInterfaceMca) + { + NdisReadMcaPosInformation( + &Status, + NdisConfigHandle, + &SlotNumber, + &McaData); + +// *IoBaseAddress = (UINT)(McaData.PosData2 | (McaData.PosData3 << 8)); + *IoBaseAddress = LT_DECODE_ADDR_FROM_POSDATA(McaData); + + DBGPRINT(DBG_COMP_REGISTRY, DBG_LEVEL_FATAL, + ("LtRegGetIoBaseAddr: Base %lx. %lx.%lx.%lx.%lx, Id - %lx\n", + *IoBaseAddress, McaData.PosData1, McaData.PosData2, + McaData.PosData3, McaData.PosData4, McaData.AdapterId)); + + if ((Status != NDIS_STATUS_SUCCESS) || (McaData.AdapterId != LT_MCA_POS_ID)) + { + Status = NDIS_STATUS_ADAPTER_NOT_FOUND; + } + + } + else + { + NdisReadConfiguration( + &Status, + &Parameter, + ConfigHandle, + &Keyword, + NdisParameterHexInteger); + + if (Status == NDIS_STATUS_SUCCESS) + { + *IoBaseAddress = (UINT)Parameter->ParameterData.IntegerData; + } + } + + if ((Status == NDIS_STATUS_SUCCESS) && + ((*IoBaseAddress < LT_IO_BASE_ADDRESS_MIN) || + (*IoBaseAddress > LT_IO_BASE_ADDRESS_MAX))) + { + DBGPRINT(DBG_COMP_REGISTRY, DBG_LEVEL_FATAL, + ("LtRegGetIoBaseAddr: invalid value found for %s\n", LT_REG_KEY_IO_BASE_ADDRESS)); + + Status = NDIS_STATUS_BAD_CHARACTERISTICS; + } + + return(Status); +} + + diff --git a/private/ntos/ndis/lt200/ltreg.h b/private/ntos/ndis/lt200/ltreg.h new file mode 100644 index 000000000..ba3895ce1 --- /dev/null +++ b/private/ntos/ndis/lt200/ltreg.h @@ -0,0 +1,80 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltreg.h + +Abstract: + + This module contains + +Author: + + Nikhil Kamkolkar (nikhilk@microsoft.com) + Stephen Hou (stephh@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTREG_H_ +#define _LTREG_H_ + + +UINT +LtRegGetBusNumber( + IN NDIS_HANDLE ConfigHandle + ); + +NDIS_STATUS +LtRegGetBusType( + IN NDIS_HANDLE ConfigHandle, + OUT PNDIS_INTERFACE_TYPE BusType + ); + +UCHAR +LtRegGetNodeId( + IN NDIS_HANDLE ConfigHandle + ); + +NDIS_STATUS +LtRegGetIoBaseAddr( + OUT PUINT IoBaseAddress, + IN NDIS_HANDLE NdisConfigHandle, + IN NDIS_HANDLE ConfigHandle, + IN NDIS_INTERFACE_TYPE BusType + ); + + + +#ifdef LTREG_H_LOCALS + + +#define LT_NODE_ID_MIN 128 +#define LT_NODE_ID_MAX 254 + +#define LT_IO_BASE_ADDRESS_MIN 0x200 +#define LT_IO_BASE_ADDRESS_MAX 0x3F0 + +#define LT_MCA_POS_ID 0x6674 + +#define LT_REG_KEY_BUS_NUMBER "BusNumber" +#define LT_REG_KEY_IO_BASE_ADDRESS "IoBaseAddress" +#define LT_REG_KEY_NODE_ID "NodeID" + +#define LT_REG_KEY_BUS_NUMBER_STRING NDIS_STRING_CONST("BusNumber") +#define LT_REG_KEY_BUS_TYPE_STRING NDIS_STRING_CONST("BusType") +#define LT_REG_KEY_IO_BASE_ADDRESS_STRING NDIS_STRING_CONST("IoBaseAddress") +#define LT_REG_KEY_NODE_ID_STRING NDIS_STRING_CONST("NodeID") + +// MACROS +#define LT_DECODE_ADDR_FROM_POSDATA(McaData) \ + ((((UINT)McaData.PosData3 << 8) | (UINT)McaData.PosData2) & 0x0FF0) + +#endif // LTREG_H_LOCALS + +#endif // _LTREG_H_ diff --git a/private/ntos/ndis/lt200/ltreq.c b/private/ntos/ndis/lt200/ltreq.c new file mode 100644 index 000000000..6b54c9915 --- /dev/null +++ b/private/ntos/ndis/lt200/ltreq.c @@ -0,0 +1,651 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltreq.c + +Abstract: + + This module contains + +Author: + + Nikhil Kamkolkar (nikhilk@microsoft.com) + Stephen Hou (stephh@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define LTREQ_H_LOCALS +#include "ltmain.h" +#include "ltreq.h" + +// Define file id for errorlogging +#define FILENUM LTREQ + + +NDIS_STATUS +LtRequest( + IN NDIS_HANDLE MacBindingHandle, + IN PNDIS_REQUEST NdisRequest + ) +/*++ + +Routine Description: + + called by NDIS to query or set card/driver information on a binding + +Arguments: + + MacBindingHandle : the binding submitting the request + NdisRequest : the request we've been asked to satisfy + +Return Values: + + NDIS_STATUS_SUCCESS : if completed successfully + NDIS_STATUS_RESET_IN_PROGRESS : if the adapter's in the middle of a reset + NDIS_STATUS_ADAPTER_REMOVED : if the adapter's been closed + NDIS_STATUS_CLOSING : if the binding is closing down + NDIS_STATUS_NOT_SUPPORTED : if we do not support the requested action + +--*/ +{ + NDIS_STATUS Status; + PLT_ADAPTER Adapter = ((PLT_OPEN)MacBindingHandle)->LtAdapter; + PLT_OPEN Open = (PLT_OPEN)MacBindingHandle; + + if (Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) + { + return(NDIS_STATUS_RESET_IN_PROGRESS); + } + + switch (NdisRequest->RequestType) + { + case NdisRequestSetInformation: + case NdisRequestQueryInformation: + + // increment count since we'll be in the binding with the request + LtReferenceBinding(Open,&Status); + if (Status == NDIS_STATUS_SUCCESS) + { + if (NdisRequest->RequestType == NdisRequestSetInformation) + { + Status = LtReqSetInformation( + Adapter, + Open, + NdisRequest->DATA.SET_INFORMATION.Oid, + NdisRequest->DATA.SET_INFORMATION.InformationBuffer, + NdisRequest->DATA.SET_INFORMATION.InformationBufferLength, + &(NdisRequest->DATA.SET_INFORMATION.BytesRead), + &(NdisRequest->DATA.SET_INFORMATION.BytesNeeded)); + } + else + { + Status = LtReqQueryInformation( + Adapter, + Open, + NdisRequest->DATA.QUERY_INFORMATION.Oid, + NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer, + NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength, + &(NdisRequest->DATA.QUERY_INFORMATION.BytesWritten), + &(NdisRequest->DATA.QUERY_INFORMATION.BytesNeeded), + FALSE); + } + + // completed the request for the binding; outa there + LtDeReferenceBinding(Open); + } + + break; + + default: + // Unkown request + + Status = NDIS_STATUS_NOT_SUPPORTED; + break; + + } + + return(Status); +} + + +NDIS_STATUS +LtReqQueryGlobalStatistics( + IN NDIS_HANDLE MacAdapterContext, + IN PNDIS_REQUEST NdisRequest + ) +/*++ + +Routine Description: + + called by NDIS to query or set global card/driver information + +Arguments: + + MacAdapterContext : the adapter the request is submitted on + NdisRequest : the request we've been asked to satisfy + +Return Values: + + NDIS_STATUS_SUCCESS : if completed successfully + NDIS_STATUS_RESET_IN_PROGRESS : if the adapter's in the middle of a reset + NDIS_STATUS_ADAPTER_REMOVED : if the adapter's been closed + NDIS_STATUS_CLOSING : if the binding is closing down + NDIS_STATUS_NOT_SUPPORTED : if we do not support the requested action + +--*/ +{ + NDIS_STATUS Status; + PLT_ADAPTER Adapter = MacAdapterContext; + + if (Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) + { + return(NDIS_STATUS_RESET_IN_PROGRESS); + } + + switch (NdisRequest->RequestType) + { + case NdisRequestQueryStatistics: + + LtReferenceAdapter(Adapter,&Status); + if (Status != NDIS_STATUS_SUCCESS) + break; + + Status = LtReqQueryInformation( + Adapter, + NULL, + NdisRequest->DATA.QUERY_INFORMATION.Oid, + NdisRequest->DATA.QUERY_INFORMATION.InformationBuffer, + NdisRequest->DATA.QUERY_INFORMATION.InformationBufferLength, + &(NdisRequest->DATA.QUERY_INFORMATION.BytesWritten), + &(NdisRequest->DATA.QUERY_INFORMATION.BytesNeeded), + TRUE); + + LtDeReferenceAdapter(Adapter); + break; + + default: + + Status = NDIS_STATUS_NOT_SUPPORTED; + break; + } + + return(Status); +} + + +STATIC +NDIS_STATUS +LtReqSetInformation( + IN PLT_ADAPTER Adapter, + IN PLT_OPEN Open, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN INT InformationBufferLength, + IN PUINT BytesRead, + IN PUINT BytesNeeded + ) +/*++ + +Routine Description: + + performs a set operation for a single OID. + +Arguments: + + Adapter : The adapter that the set is for + Open : The binding that the set is for + Oid : The OID to set + InformationBuffer : Holds the data to be set + InformationBufferLength : The length of InformationBuffer + BytesRead : If the call is successful, returns the number + of bytes read from InformationBuffer + BytesNeeded : If there is not enough data in InformationBuffer + to satisfy the request, returns the amount of + storage needed. + +Return Value: + + NDIS_STATUS_SUCCESS : if successful + NDIS_STATUS_INVALID_OID : if the oid is not supported + NDIS_STATUS_INVALID_DATA : if InformationBuffer contains bad data + NDIS_STATUS_INVALID_LENGTH : if the InformationBufferLength is incorrect + +--*/ +{ + + ULONG PacketFilter, NewLookAhead; + NDIS_STATUS StatusToReturn = NDIS_STATUS_SUCCESS; + + // + // Now check for the most common OIDs + // + + DBGPRINT(DBG_COMP_REQ,DBG_LEVEL_INFO, + ("LtReqSetInformation: setting OID - 0x%.8lx\n", Oid)); + + switch (Oid) + { + case OID_GEN_CURRENT_PACKET_FILTER: + + // Localtalk only supports Directed and broadcast packets. + // And the Lt firmware does not support PROMISCUSOUS mode. + // so return NDIS_STATUS_NOT_SUPPORTED for these packet filters. + + if (InformationBufferLength != 4) + { + StatusToReturn = NDIS_STATUS_INVALID_LENGTH; + break; + + } + + NdisMoveMemory( + (PVOID)&PacketFilter, + InformationBuffer, + sizeof(ULONG)); + + DBGPRINT(DBG_COMP_REQ,DBG_LEVEL_INFO, + ("LtReqSetInformation: Requested packet filter is %x\n", PacketFilter)); + + if (PacketFilter == NDIS_PACKET_TYPE_BROADCAST || + PacketFilter == NDIS_PACKET_TYPE_DIRECTED || + PacketFilter == (NDIS_PACKET_TYPE_BROADCAST | NDIS_PACKET_TYPE_DIRECTED)) + { + NdisAcquireSpinLock(&Adapter->Lock); + Adapter->GlobalPacketFilter |= PacketFilter; + Open->CurrentPacketFilter = PacketFilter; + NdisReleaseSpinLock(&Adapter->Lock); + *BytesRead = InformationBufferLength; + + } + else + { + StatusToReturn = NDIS_STATUS_INVALID_DATA; + } + + break; + + case OID_GEN_CURRENT_LOOKAHEAD: + + if (InformationBufferLength != 4) + { + StatusToReturn = NDIS_STATUS_INVALID_LENGTH; + break; + + } + + NdisMoveMemory( + (PVOID)&NewLookAhead, + InformationBuffer, + sizeof(ULONG)); + + DBGPRINT(DBG_COMP_REQ,DBG_LEVEL_INFO, + ("LtReqSetInformation: Requested Lookahead size is %d\n", NewLookAhead)); + + if ((NewLookAhead > LT_MAX_INDICATE_SIZE) || + (NewLookAhead < LT_MIN_INDICATE_SIZE)) + { + StatusToReturn = NDIS_STATUS_INVALID_DATA; + break; + + } + + NdisAcquireSpinLock(&Adapter->Lock); + // valid lookahead size, so set it + Open->CurrentLookAheadSize = NewLookAhead; + + // adjust the global lookaheadsize + if (Adapter->GlobalLookAheadSize < NewLookAhead) + { + Adapter->GlobalLookAheadSize = NewLookAhead; + } + else + { + LtReqAdjustLookAhead( + &Adapter->GlobalLookAheadSize, + &Adapter->OpenBindings); + } + NdisReleaseSpinLock(&Adapter->Lock); + *BytesRead = 4; + break; + + default: + + StatusToReturn = NDIS_STATUS_INVALID_OID; + break; + } + + return(StatusToReturn); +} + + +LtReqQueryInformation( + IN PLT_ADAPTER Adapter, + IN PLT_OPEN Open, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN INT InformationBufferLength, + IN PUINT BytesWritten, + IN PUINT BytesNeeded, + IN BOOLEAN Global + ) +/*++ + +Routine Description: + + performs a query operation for a single OID. + +Arguments: + + Adapter : The adapter that the query is for + Open : The binding that the query is for + Oid : The OID to query + InformationBuffer : Holds the result of the query. + InformationBufferLength : The length of InformationBuffer. + BytesWritten : If the call is successful, returns the + number of bytes written to InformationBuffer + BytesNeeded : If there is not enough room in InformationBuffer + to satisfy the request, returns the amount of + storage needed + Global : TRUE if the request originated from the adapter. + FALSE if the request came from a binding + +Return Value: + + NDIS_STATUS_SUCCESS : if successful + NDIS_STATUS_INVALID_OID : if the query is on an OID we do not support + NDIS_STATUS_BUFFER_TOO_SHORT: if InformationBufferLength is too small to + hold the information returned + +--*/ +{ + + UINT OidIndex; + ULONG GenericUlong; + USHORT GenericUshort; + PVOID SourceBuffer = &GenericUlong; + UINT SourceBufferLength = sizeof(ULONG); + PNDIS_OID SupportedOidArray = LtProtocolSupportedOids; + UINT SupportedOids = (sizeof(LtProtocolSupportedOids)/sizeof(ULONG)); + static UCHAR VendorDescription[] = LT_VENDOR_DESCR; + static UCHAR VendorId[3] = LT_VENDOR_ID; + + if (Global) + { + SupportedOidArray = LtGlobalSupportedOids; + SupportedOids = sizeof(LtGlobalSupportedOids)/sizeof(ULONG); + } + + // + // Check that the OID is valid. + // + for (OidIndex=0; OidIndex < SupportedOids; OidIndex++) + { + if (Oid == SupportedOidArray[OidIndex]) + { + break; + } + } + + if (OidIndex == SupportedOids) + { + *BytesWritten = 0; + return(NDIS_STATUS_INVALID_OID); + } + + switch (Oid) + { + case OID_GEN_SUPPORTED_LIST: + + SourceBuffer = SupportedOidArray; + SourceBufferLength = SupportedOids * sizeof(ULONG); + break; + + case OID_GEN_HARDWARE_STATUS: + + GenericUlong = NdisHardwareStatusReady; + if (Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) + { + GenericUlong = NdisHardwareStatusReset; + } + break; + + case OID_GEN_MEDIA_SUPPORTED: + + GenericUlong = NdisMediumLocalTalk; + break; + + case OID_GEN_MEDIA_IN_USE: + + GenericUlong = NdisMediumLocalTalk; + // if no binding exists then media is not in use + if (Global && Adapter->OpenCount == 0) + { + SourceBufferLength = 0; + } + break; + + case OID_GEN_MAXIMUM_LOOKAHEAD: + + GenericUlong = LT_MAX_INDICATE_SIZE; + break; + + case OID_GEN_MAXIMUM_FRAME_SIZE: + + GenericUlong = LT_MAXIMUM_PACKET_SIZE; + break; + + case OID_GEN_LINK_SPEED: + + GenericUlong = LT_LINK_SPEED; + break; + + case OID_GEN_TRANSMIT_BUFFER_SPACE: + + GenericUlong = LT_MAXIMUM_PACKET_SIZE; + break; + + case OID_GEN_RECEIVE_BUFFER_SPACE: + + // BUGBUG: need to determine number of recv buffers or in this case the + // amount of space for receives + GenericUlong = LT_MAXIMUM_PACKET_SIZE * 5; + break; + + case OID_GEN_TRANSMIT_BLOCK_SIZE: + + GenericUlong = 1; + break; + + case OID_GEN_RECEIVE_BLOCK_SIZE: + + // BUGBUG: need to determine number of recv buffers + GenericUlong = 5; + break; + + case OID_GEN_VENDOR_ID: + + SourceBuffer = VendorId; + SourceBufferLength = sizeof(VendorId); + break; + + case OID_GEN_VENDOR_DESCRIPTION: + + SourceBuffer = VendorDescription; + SourceBufferLength = sizeof(VendorDescription); + break; + + case OID_GEN_CURRENT_PACKET_FILTER: + + GenericUlong = Open->CurrentPacketFilter; + if (Global) + { + GenericUlong = Adapter->GlobalPacketFilter; + } + break; + + case OID_GEN_CURRENT_LOOKAHEAD: + + GenericUlong = Open->CurrentLookAheadSize; + if (Global) + { + GenericUlong = Adapter->GlobalLookAheadSize; + } + break; + + case OID_GEN_DRIVER_VERSION: + + GenericUshort = (LT_MAJOR_VERSION << 8) + LT_MINOR_VERSION; + SourceBuffer = &GenericUshort; + SourceBufferLength = sizeof(USHORT); + break; + + case OID_GEN_MAXIMUM_TOTAL_SIZE: + + GenericUlong = LT_MAXIMUM_PACKET_SIZE; + break; + + case OID_GEN_XMIT_OK: + case OID_GEN_RCV_OK: + case OID_GEN_XMIT_ERROR: + case OID_GEN_RCV_ERROR: + case OID_GEN_RCV_NO_BUFFER: + + OidIndex = (Oid & LT_OID_INDEX_MASK) - 1; + ASSERT(OidIndex < GM_ARRAY_SIZE); + GenericUlong = Adapter->GeneralMandatory[OidIndex]; + break; + + case OID_GEN_DIRECTED_BYTES_XMIT: + case OID_GEN_BROADCAST_BYTES_XMIT: + case OID_GEN_DIRECTED_BYTES_RCV: + case OID_GEN_BROADCAST_BYTES_RCV: + + OidIndex = (Oid & LT_OID_INDEX_MASK) - 1; + ASSERT(OidIndex < GM_ARRAY_SIZE); + SourceBuffer = &Adapter->GeneralOptionalByteCount[OidIndex / 2]; + SourceBufferLength = sizeof(LARGE_INTEGER); + break; + + case OID_GEN_DIRECTED_FRAMES_XMIT: + case OID_GEN_BROADCAST_FRAMES_XMIT: + case OID_GEN_DIRECTED_FRAMES_RCV: + case OID_GEN_BROADCAST_FRAMES_RCV: + + OidIndex = (Oid & LT_OID_INDEX_MASK) - 1; + ASSERT(OidIndex < GO_COUNT_ARRAY_SIZE); + GenericUlong = Adapter->GeneralOptionalFrameCount[OidIndex / 2]; + break; + + case OID_GEN_RCV_CRC_ERROR: + case OID_GEN_TRANSMIT_QUEUE_LENGTH: + + OidIndex = (Oid & LT_OID_INDEX_MASK) - 1; + ASSERT(OidIndex < GO_ARRAY_SIZE); + GenericUlong = Adapter->GeneralOptional[OidIndex - GO_ARRAY_START]; + break; + + case OID_GEN_MAC_OPTIONS: + + GenericUlong = NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA; + break; + + case OID_LTALK_CURRENT_NODE_ID: + + SourceBuffer = &GenericUshort; + GenericUshort = Adapter->NodeId; + SourceBufferLength = 2; + break; + + case OID_LTALK_IN_BROADCASTS: + case OID_LTALK_IN_LENGTH_ERRORS: + + OidIndex = (Oid & LT_OID_INDEX_MASK) - 1; + ASSERT (OidIndex < MM_ARRAY_SIZE); + GenericUlong = Adapter->MediaMandatory[OidIndex]; + break; + + case OID_LTALK_OUT_NO_HANDLERS: + case OID_LTALK_DEFERS: + + OidIndex = (Oid & LT_OID_INDEX_MASK) - 1; + ASSERT (OidIndex < MO_ARRAY_SIZE); + GenericUlong = Adapter->MediaOptional[OidIndex]; + break; + + default: + + // should never get here + ASSERT(FALSE); + break; + } + + if ((INT)SourceBufferLength > InformationBufferLength) + { + *BytesNeeded = SourceBufferLength; + return(NDIS_STATUS_BUFFER_TOO_SHORT); + } + + NdisMoveMemory( + InformationBuffer, + SourceBuffer, + SourceBufferLength); + + *BytesWritten = SourceBufferLength; + + return(NDIS_STATUS_SUCCESS); +} + + +STATIC +VOID +LtReqAdjustLookAhead( + OUT PUINT GlobalLookAheadSize, + IN PLIST_ENTRY OpenBindings + ) +/*++ + +Routine Description: + + called by LtReqSetInformation to adjust the global lookahead size when + the previously largest lookahead size (on a binding) is adjusted + + THIS ROUTINE IS CALLED WITH THE SPINLOCK HELD + +Arguments: + + GlobalLookAheadSize : the global lookahead param we're adjusting + OpenBindings : the list of bindings we need to traverse + +Return Value: + + none + +--*/ +{ + PLT_OPEN Binding; + PLIST_ENTRY p = OpenBindings->Flink; + UINT MaxLookAheadSize = 0; + + while(p != OpenBindings) + { + Binding = CONTAINING_RECORD( + p, + LT_OPEN, + Linkage); + + if (Binding->CurrentLookAheadSize > MaxLookAheadSize) + { + MaxLookAheadSize = Binding->CurrentLookAheadSize; + } + p = p->Flink; + } + *GlobalLookAheadSize = MaxLookAheadSize; +} + diff --git a/private/ntos/ndis/lt200/ltreq.h b/private/ntos/ndis/lt200/ltreq.h new file mode 100644 index 000000000..fb2c94aa7 --- /dev/null +++ b/private/ntos/ndis/lt200/ltreq.h @@ -0,0 +1,159 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltreq.h + +Abstract: + + This module contains + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTREQ_H_ +#define _LTREQ_H_ + + +NDIS_STATUS +LtRequest( + IN NDIS_HANDLE MacBindingHandle, + IN PNDIS_REQUEST NdisRequest + ); + +NDIS_STATUS +LtReqQueryGlobalStatistics( + IN NDIS_HANDLE MacAdapterContext, + IN PNDIS_REQUEST NdisRequest + ); + + +#ifdef LTREQ_H_LOCALS + +#define LT_VENDOR_DESCR "Daystar Digital LT200" +#define LT_VENDOR_ID {0xFF,0xFF,0xFF} +#define LT_LINK_SPEED 2300 // 230K bps in 100bps units +#define LT_OID_INDEX_MASK 0x000000FF + +STATIC +NDIS_OID LtGlobalSupportedOids[] = { + OID_GEN_SUPPORTED_LIST, + OID_GEN_HARDWARE_STATUS, + OID_GEN_MEDIA_SUPPORTED, + OID_GEN_MEDIA_IN_USE, + OID_GEN_MAXIMUM_LOOKAHEAD, + OID_GEN_MAXIMUM_FRAME_SIZE, + OID_GEN_LINK_SPEED, + OID_GEN_TRANSMIT_BUFFER_SPACE, + OID_GEN_RECEIVE_BUFFER_SPACE, + OID_GEN_TRANSMIT_BLOCK_SIZE, + OID_GEN_RECEIVE_BLOCK_SIZE, + OID_GEN_VENDOR_ID, + OID_GEN_VENDOR_DESCRIPTION, + OID_GEN_CURRENT_PACKET_FILTER, + OID_GEN_CURRENT_LOOKAHEAD, + OID_GEN_DRIVER_VERSION, + OID_GEN_MAXIMUM_TOTAL_SIZE, + OID_GEN_XMIT_OK, + OID_GEN_RCV_OK, + OID_GEN_XMIT_ERROR, + OID_GEN_RCV_ERROR, + OID_GEN_RCV_NO_BUFFER, + + OID_GEN_DIRECTED_BYTES_XMIT, + OID_GEN_DIRECTED_FRAMES_XMIT, + OID_GEN_BROADCAST_BYTES_XMIT, + OID_GEN_BROADCAST_FRAMES_XMIT, + OID_GEN_DIRECTED_BYTES_RCV, + OID_GEN_DIRECTED_FRAMES_RCV, + OID_GEN_BROADCAST_BYTES_RCV, + OID_GEN_BROADCAST_FRAMES_RCV, + + OID_GEN_RCV_CRC_ERROR, + OID_GEN_TRANSMIT_QUEUE_LENGTH, + + OID_LTALK_CURRENT_NODE_ID, + + OID_LTALK_IN_BROADCASTS, + OID_LTALK_IN_LENGTH_ERRORS, + + OID_LTALK_OUT_NO_HANDLERS, + OID_LTALK_DEFERS + + }; + +// Note we do not support OID's which we cannot get the statistics +// for from the FIRMWARE, or that we cannot collect ourselves! + +STATIC +NDIS_OID LtProtocolSupportedOids[] = { + OID_GEN_SUPPORTED_LIST, + OID_GEN_HARDWARE_STATUS, + OID_GEN_MEDIA_SUPPORTED, + OID_GEN_MEDIA_IN_USE, + OID_GEN_MAXIMUM_LOOKAHEAD, + OID_GEN_MAXIMUM_FRAME_SIZE, + OID_GEN_LINK_SPEED, + OID_GEN_TRANSMIT_BUFFER_SPACE, + OID_GEN_RECEIVE_BUFFER_SPACE, + OID_GEN_TRANSMIT_BLOCK_SIZE, + OID_GEN_RECEIVE_BLOCK_SIZE, + OID_GEN_VENDOR_ID, + OID_GEN_VENDOR_DESCRIPTION, + OID_GEN_CURRENT_PACKET_FILTER, + OID_GEN_CURRENT_LOOKAHEAD, + OID_GEN_DRIVER_VERSION, + OID_GEN_MAXIMUM_TOTAL_SIZE, + OID_GEN_MAC_OPTIONS, + + OID_LTALK_CURRENT_NODE_ID + + }; + + +STATIC +NDIS_STATUS +LtReqQueryInformation( + IN PLT_ADAPTER Adapter, + IN PLT_OPEN Open, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN INT InformationBufferLength, + IN PUINT BytesWritten, + IN PUINT BytesNeeded, + IN BOOLEAN Global + ); + +STATIC +NDIS_STATUS +LtReqSetInformation( + IN PLT_ADAPTER Adapter, + IN PLT_OPEN Open, + IN NDIS_OID Oid, + IN PVOID InformationBuffer, + IN INT InformationBufferLength, + IN PUINT BytesRead, + IN PUINT BytesNeeded + ); + +STATIC +VOID +LtReqAdjustLookAhead( + OUT PUINT GlobalLookaheadSize, + IN PLIST_ENTRY BindingList + ); + + +#endif // LTREQ_H_LOCALS + +#endif // _LTREQ_H_ diff --git a/private/ntos/ndis/lt200/ltreset.c b/private/ntos/ndis/lt200/ltreset.c new file mode 100644 index 000000000..c64c9e305 --- /dev/null +++ b/private/ntos/ndis/lt200/ltreset.c @@ -0,0 +1,344 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltreset.c + +Abstract: + + This module contains + +Author: + + Nikhil Kamkolkar (nikhilk@microsoft.com) + Stephen Hou (stephh@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define LTRESET_H_LOCALS +#include "ltmain.h" +#include "ltreset.h" +#include "ltfirm.h" +#include "lttimer.h" + +// Define file id for errorlogging +#define FILENUM LTRESET + + +NDIS_STATUS +LtReset( + IN NDIS_HANDLE MacBindingHandle + ) +/*++ + +Routine Description: + + called by NDIS to reset the adapter + +Arguments: + + MacBindingHandle : context passed back in OpenAdapter + +Return Value: + + NDIS_STATUS_PENDING : if the reset successfully pended + and waiting to be completed + NDIS_STATUS_RESET_IN_PROGRESS : if the adapter is current being reset + NDIS_STATUS_ADAPTER_REMOVED : if the adapter has been closed + NDIS_STATUS_CLOSING : if the binding request the reset is closing + +--*/ +{ + NDIS_STATUS Status; + + BOOLEAN TimerCancelled = FALSE; + PLT_ADAPTER Adapter = ((PLT_OPEN)MacBindingHandle)->LtAdapter; + PLT_OPEN Open = (PLT_OPEN)MacBindingHandle; + + + LtReferenceBinding(Open,&Status); + if (Status == NDIS_STATUS_SUCCESS) + { + if (Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) + { + Status = NDIS_STATUS_RESET_IN_PROGRESS; + } + + if (Adapter->Flags & ADAPTER_CLOSING) + { + Status = NDIS_STATUS_ADAPTER_REMOVED; + } + + if (Open->Flags & BINDING_CLOSING) + { + Status = NDIS_STATUS_CLOSING; + } + } + if (Status != NDIS_STATUS_SUCCESS) + { + LtDeReferenceBinding(Open); + return(Status); + } + + // kill the timer so we don't get any conflicts when trying to reset the card + NdisCancelTimer(&Adapter->PollingTimer, &TimerCancelled); + if (TimerCancelled) + { + LtDeReferenceAdapter(Adapter); + } + + // indicate the start of the reset to all bindings + LtResetSignalBindings( + Adapter, + NDIS_STATUS_RESET_START); + + NdisAcquireSpinLock(&Adapter->Lock); + + // set the reset in progress flag + Adapter->Flags ^= ADAPTER_RESET_IN_PROGRESS; + Adapter->ResetOwner = Open; + + NdisReleaseSpinLock(&Adapter->Lock); + + LtResetSetupForReset(Adapter); + + // intstantiate the reference for the timer + // too late to do anything other than return + // success since the reset's done. no problem + // as long as the adapter can't close while the + // reset is in progress. + LtReferenceAdapter(Adapter,&Status); + + // card's essentially reset, restart the timer + NdisSetTimer(&Adapter->PollingTimer, LT_POLLING_TIME); + + return(NDIS_STATUS_PENDING); +} + + +VOID +LtResetComplete( + PLT_ADAPTER Adapter + ) +/*++ + +Routine Description: + + completes the pending reset + +Arguments: + + Adapter : pointer to the logical adapter + +Return Value: + + none + +--*/ +{ + NdisAcquireSpinLock(&Adapter->Lock); + // flip the reset in progress flags + Adapter->Flags ^= ADAPTER_RESET_IN_PROGRESS; + NdisReleaseSpinLock(&Adapter->Lock); + + LtResetSignalBindings( + Adapter, + NDIS_STATUS_RESET_END); + + NdisCompleteReset( + (Adapter->ResetOwner)->NdisBindingContext, + NDIS_STATUS_SUCCESS); + + LtDeReferenceBinding(Adapter->ResetOwner); +} + + +STATIC +VOID +LtResetSetupForReset( + IN PLT_ADAPTER Adapter + ) +/*++ + +Routine Description: + + Kills off anything in the transmit, receive and loopback queues and + returns the appropriate status. It then resets the card and acquires + a new NodeId + +Arguments: + + Adapter : pointer to the logical adapter + +Return Value: + + none + +--*/ +{ + PLIST_ENTRY CurrentPacketLink; + PLT_PACKET_RESERVED PacketReserved; + PRECV_DESC RecvDesc; + UINT PacketLength; + PNDIS_PACKET Packet; + PLT_OPEN Open; + + NdisAcquireSpinLock(&Adapter->Lock); + + // remove everything from the receive list and return it to the free list + while(!IsListEmpty(&Adapter->Receive)){ + + CurrentPacketLink = RemoveHeadList(&Adapter->Receive); + RecvDesc = CONTAINING_RECORD( + CurrentPacketLink, + RECV_DESC, + Linkage); + + PacketLength = RecvDesc->BufferLength; + + NdisFreeMemory( + RecvDesc, + sizeof(RecvDesc)+PacketLength, + 0); + + } + + // complete any pending transmits + while(!IsListEmpty(&Adapter->Transmit)) + { + CurrentPacketLink = RemoveHeadList(&Adapter->Transmit); + + PacketReserved = CONTAINING_RECORD( + CurrentPacketLink, + LT_PACKET_RESERVED, + Linkage); + + Packet = CONTAINING_RECORD( + PacketReserved, + NDIS_PACKET, + MacReserved); + + Open = PacketReserved->MacBindingHandle; + + NdisReleaseSpinLock(&Adapter->Lock); + + NdisCompleteSend( + Open->NdisBindingContext, + Packet, + NDIS_STATUS_REQUEST_ABORTED); + + // decrement the count instantiated by the send + LtDeReferenceBinding(Open); + LtDeReferenceAdapter(Adapter); + + NdisAcquireSpinLock(&Adapter->Lock); + + } + + // complete anything on the loopback queue + while(!IsListEmpty(&Adapter->LoopBack)) + { + CurrentPacketLink = RemoveHeadList(&Adapter->LoopBack); + + PacketReserved = CONTAINING_RECORD( + CurrentPacketLink, + LT_PACKET_RESERVED, + Linkage); + + Packet = CONTAINING_RECORD( + PacketReserved, + NDIS_PACKET, + MacReserved); + + Open = PacketReserved->MacBindingHandle; + + NdisReleaseSpinLock(&Adapter->Lock); + + NdisCompleteSend( + Open->NdisBindingContext, + Packet, + NDIS_STATUS_REQUEST_ABORTED); + + // decrement the count instantiated by the send + LtDeReferenceBinding(Open); + LtDeReferenceAdapter(Adapter); + + NdisAcquireSpinLock(&Adapter->Lock); + + } + + NdisReleaseSpinLock(&Adapter->Lock); + LtFirmInitialize(Adapter, Adapter->NodeId); +} + + +STATIC +VOID +LtResetSignalBindings( + PLT_ADAPTER Adapter, + NDIS_STATUS StatusToSignal + ) +/*++ + +Routine Description: + + Loops through all bindings and indicates the status passed + +Arguments: + + Adapter : pointer to the logical adapter + StatusToSignal : status to indicate to all bindings associated with the adapter + +Return Value: + + none + +--*/ +{ + PLT_OPEN Open; + PLIST_ENTRY CurrentLink; + NDIS_STATUS Status; + + CurrentLink = Adapter->OpenBindings.Flink; + while (CurrentLink != &Adapter->OpenBindings) + { + Open = CONTAINING_RECORD( + CurrentLink, + LT_OPEN, + Linkage + ); + + // skip the binding if it's closing + if (Open->Flags & BINDING_CLOSING) + { + CurrentLink = CurrentLink->Flink; + continue; + } + + // increment the reference count while in the binding + // only return we can get back is that the binding is + // closing down, but this isn't a problem since we won't + // reach this statement if that's true because of the prior + // statements + LtReferenceBinding(Open,&Status); + + NdisIndicateStatus( + Open->NdisBindingContext, + StatusToSignal, + 0, + 0); + + // decrement refcount now that we've finished with that binding + LtDeReferenceBinding(Open); + CurrentLink = CurrentLink->Flink; + } +} + + + diff --git a/private/ntos/ndis/lt200/ltreset.h b/private/ntos/ndis/lt200/ltreset.h new file mode 100644 index 000000000..cc998daf4 --- /dev/null +++ b/private/ntos/ndis/lt200/ltreset.h @@ -0,0 +1,58 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltreset.h + +Abstract: + + This module contains + +Author: + + Nikhil Kamkolkar (nikhilk@microsoft.com) + Stephen Hou (stephh@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTRESET_H_ +#define _LTRESET_H_ + + +NDIS_STATUS +LtReset( + IN NDIS_HANDLE MacBindingHandle + ); + +VOID +LtResetComplete( + PLT_ADAPTER Adapter + ); + + +#ifdef LTRESET_H_LOCALS + + +STATIC +VOID +LtResetSetupForReset( + IN PLT_ADAPTER Adapter + ); + +STATIC +VOID +LtResetSignalBindings( + PLT_ADAPTER Adapter, + NDIS_STATUS StatusToSignal + ); + + +#endif // LTRESET_H_LOCALS + +#endif // _LTRESET_H_ diff --git a/private/ntos/ndis/lt200/ltsend.c b/private/ntos/ndis/lt200/ltsend.c new file mode 100644 index 000000000..f3246ba3b --- /dev/null +++ b/private/ntos/ndis/lt200/ltsend.c @@ -0,0 +1,342 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltsend.c + +Abstract: + + This module contains the send queue processing routines. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define LTSEND_H_LOCALS +#include "ltmain.h" + +// Define file id for errorlogging +#define FILENUM LTSEND + + +NDIS_STATUS +LtSend( + IN NDIS_HANDLE MacBindingHandle, + IN PNDIS_PACKET Packet + ) +/*++ + +Routine Description: + + This routine is called by NDIS to send a packet. + +Arguments: + + MacBindingHandle : Passed as context to NDIS in OpenAdapter. + Packet : Ndis Packet to send. + +Return Value: + + NDIS_STATUS_SUCCESS : If successful, else error. + +--*/ +{ + NDIS_STATUS Status; + UINT PacketSize; + + BOOLEAN DerefAdapter = FALSE; + PLT_OPEN Binding = (PLT_OPEN)MacBindingHandle; + PLT_ADAPTER Adapter = Binding->LtAdapter; + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_ENTRY, + ("LtSend: Entering...\n")); + + NdisAcquireSpinLock(&Adapter->Lock); + + // This will go away, when the entry is taken off the adapter transmit queue + LtReferenceAdapterNonInterlock(Adapter, &Status); + if (Status == NDIS_STATUS_SUCCESS) + { + DerefAdapter = TRUE; + do + { + // Check to see if there is a reset in progress + if (Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) + { + Status = NDIS_STATUS_RESET_IN_PROGRESS; + break; + } + + // If binding is closing down, we get out. + if (Binding->Flags & BINDING_CLOSING) + { + Status = NDIS_STATUS_CLOSING; + break; + } + + // Try to reference the binding. This will go away after + // the send completes. + LtReferenceBindingNonInterlock(Binding, &Status); + + } while (FALSE); + } + NdisReleaseSpinLock(&Adapter->Lock); + + if (Status != NDIS_STATUS_SUCCESS) + { + if (DerefAdapter) + LtDeReferenceAdapter(Adapter); + + return(Status); + } + + + do + { + Status = NDIS_STATUS_PENDING; + + NdisQueryPacket( + Packet, + NULL, + NULL, + NULL, + &PacketSize); + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO, + ("LtSend: Packet %lx Length %lx\n", Packet, PacketSize)); + + if ((PacketSize < LT_MIN_PACKET_SIZE ) || + (PacketSize > LT_MAX_PACKET_SIZE)) { + + Status = NDIS_STATUS_RESOURCES; + + NdisAcquireSpinLock(&Adapter->Lock); + ++Adapter->GeneralMandatory[GM_TRANSMIT_BAD]; + NdisReleaseSpinLock(&Adapter->Lock); + + break; + + } + else + { + PLT_PACKET_RESERVED Reserved = (PLT_PACKET_RESERVED)Packet->MacReserved; + + // Initialize the reserved portion + Reserved->MacBindingHandle = MacBindingHandle; + InitializeListHead(&Reserved->Linkage); + + if (LtUtilsPacketType(Packet) != LT_LOOPBACK) + { + // The packet needs to go onto the wire. + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO, + ("LtSend: Queuing %lx on transmit q\n", Packet)); + + NdisAcquireSpinLock(&Adapter->Lock); + InsertTailList(&Adapter->Transmit, &Reserved->Linkage); + NdisReleaseSpinLock(&Adapter->Lock); + + } + else + { + // Put on the loopback queue + NdisAcquireSpinLock(&Adapter->Lock); + InsertTailList(&Adapter->LoopBack, &Reserved->Linkage); + + // Since we are doing a Loopback send, lets add up the stats now. + ++Adapter->GeneralMandatory[GM_TRANSMIT_GOOD]; + ++Adapter->GeneralOptionalFrameCount[GO_DIRECTED_TRANSMITS]; + + Adapter ->GeneralOptionalByteCount[GO_DIRECTED_TRANSMITS] = + LtAddLongToLargeInteger( + Adapter ->GeneralOptionalByteCount[GO_DIRECTED_TRANSMITS], + PacketSize); + + NdisReleaseSpinLock(&Adapter->Lock); + } + } + + } while (FALSE); + + // Process send queue. We also process the send queue in the timer + // in case, some sends have pended and ndis does no further sends. + // !!! Send's get very high priority. In total, the queue is processed + // !!! three times, twice in the timer and once in LtSend + LtSendProcessQueue(Adapter); + + if (Status != NDIS_STATUS_PENDING) + { + // Send unsuccessful. Remove the binding reference and adapter reference + LtDeReferenceBinding(Binding); + LtDeReferenceAdapter(Adapter); + } + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_ENTRY, + ("LtSend: Leaving...\n")); + + return Status; +} + + + +VOID +LtSendProcessQueue( + IN PLT_ADAPTER Adapter + ) +/*++ + +Routine Description: + + SendProcessQueue processes, yeah, you guessed it. The SendQueue. + +Arguments: + + Adapter : Pointer to the adapter structure. + +Return Value: + + None. + +--*/ +{ + PNDIS_PACKET Packet; + PLT_PACKET_RESERVED Reserved; + PLT_OPEN Binding; + UINT BufferCount, TotalLength, BufLength; + PNDIS_BUFFER Buffer; + UCHAR Data; + PUCHAR Address; + PLIST_ENTRY p; + + // Use this to avoid multiple threads from calling this routine. + static BOOLEAN QueueActive = FALSE; + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_ENTRY, + ("LtSendProcessTransmit: Entering...\n")); + + NdisAcquireSpinLock(&Adapter->Lock); + if (QueueActive) + { + NdisReleaseSpinLock(&Adapter->Lock); + return; + } + QueueActive = TRUE; + + while((!IsListEmpty(&Adapter->Transmit)) && + ((Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) == 0)) + { + // Ok, Can we trasnmit a packet now? + NdisRawReadPortUchar(SC_PORT, &Data); + + if ((Data & TX_READY) == 0) + { + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_WARN, + ("LtSendProcessTransmit: Media not ready...\n")); + + Adapter->MediaOptional[MO_TRANSMIT_DEFERS]++; + break; + } + + p = RemoveHeadList(&Adapter->Transmit); + NdisReleaseSpinLock(&Adapter->Lock); + + Packet = CONTAINING_RECORD( + p, + NDIS_PACKET, + MacReserved); + + Reserved = (PLT_PACKET_RESERVED)Packet->MacReserved; + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO, + ("LtSendProcessTransmit: Dequeued %lx-%lx\n", Packet, Reserved)); + + NdisQueryPacket( + Packet, + NULL, + &BufferCount, + &Buffer, + &TotalLength); + + // Ok, Output the packet length. + NdisRawWritePortUchar(XFER_PORT, (UCHAR)(TotalLength & 0xFF)); + + NdisRawWritePortUchar(XFER_PORT, (UCHAR)((TotalLength >> 8) & 0xFF)); + + NdisRawWritePortUchar(XFER_PORT, (UCHAR)LT_CMD_LAP_WRITE); + + while (BufferCount-- > 0) + { + NdisQueryBuffer( + Buffer, + &Address, + &BufLength); + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO, + ("LtSendProcessTransmit: Buffer #%d\n", BufferCount)); + + NdisRawWritePortBufferUchar(XFER_PORT, + Address, + BufLength); + + NdisGetNextBuffer(Buffer, &Buffer); + } + + if (LtUtilsPacketType(Packet) == LT_DIRECTED) + { + Binding = (PLT_OPEN)Reserved->MacBindingHandle; + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_INFO, + ("LtSendProcessTransmit: Process xmit: Packet %p\n", Packet)); + + NdisCompleteSend( + Binding->NdisBindingContext, + Packet, + NDIS_STATUS_SUCCESS); + + NdisAcquireSpinLock(&Adapter->Lock); + ++Adapter->GeneralMandatory[GM_TRANSMIT_GOOD]; + ++Adapter->GeneralOptionalFrameCount[GO_DIRECTED_TRANSMITS]; + Adapter ->GeneralOptionalByteCount[GO_DIRECTED_TRANSMITS] = + LtAddLongToLargeInteger( + Adapter ->GeneralOptionalByteCount[GO_DIRECTED_TRANSMITS], + TotalLength); + NdisReleaseSpinLock(&Adapter->Lock); + + // Dereference the adapter and the binding for this completed + // send. + LtDeReferenceBinding(Binding); + LtDeReferenceAdapter(Adapter); + + NdisAcquireSpinLock(&Adapter->Lock); + + } + else + { + // This was a broadcast, loop it back. + NdisAcquireSpinLock(&Adapter->Lock); + ++Adapter->GeneralOptionalFrameCount[GO_BROADCAST_TRANSMITS]; + ++Adapter->GeneralMandatory[GM_TRANSMIT_GOOD]; + Adapter ->GeneralOptionalByteCount[GO_BROADCAST_TRANSMITS] = + LtAddLongToLargeInteger( + Adapter ->GeneralOptionalByteCount[GO_BROADCAST_TRANSMITS], + TotalLength); + InsertTailList(&Adapter->LoopBack, &Reserved->Linkage); + } + } + + QueueActive = FALSE; + NdisReleaseSpinLock(&Adapter->Lock); + + DBGPRINT(DBG_COMP_SEND, DBG_LEVEL_ENTRY, + ("LtSendProcessTransmit: Leaving...\n")); + + return; +} diff --git a/private/ntos/ndis/lt200/ltsend.h b/private/ntos/ndis/lt200/ltsend.h new file mode 100644 index 000000000..451722f5c --- /dev/null +++ b/private/ntos/ndis/lt200/ltsend.h @@ -0,0 +1,43 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltsend.h + +Abstract: + + This module contains the send related definitions. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTSEND_H_ +#define _LTSEND_H_ + +NDIS_STATUS +LtSend( + IN NDIS_HANDLE MacBindingHandle, + IN PNDIS_PACKET Packet); + +VOID +LtSendProcessQueue( + IN PLT_ADAPTER Adapter); + + +#ifdef LTSEND_H_LOCALS + +#endif // LTSEND_H_LOCALS + + +#endif // _LTSEND_H_ + diff --git a/private/ntos/ndis/lt200/ltsft.h b/private/ntos/ndis/lt200/ltsft.h new file mode 100644 index 000000000..9d2b0081b --- /dev/null +++ b/private/ntos/ndis/lt200/ltsft.h @@ -0,0 +1,223 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltsft.h + +Abstract: + + This module contains the main adapter/binding definitions and all + other main definitions. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTSFT_ +#define _LTSFT_ + + +// We use STATIC to define procedures that will be static in the +// final build but which we now make extern to allow them to be +// debugged. +#if DBG +#define STATIC +#else +#define STATIC static +#endif + + +#define NDIS_MAJOR_VERSION 3 +#define NDIS_MINOR_VERSION 0 + +#define LT_MAJOR_VERSION 2 +#define LT_MINOR_VERSION 0 + +#define LT_MAX_INDICATE_SIZE 603 +#define LT_MAX_PACKET_SIZE 603 +#define LT_MIN_PACKET_SIZE 3 +#define LT_MIN_INDICATE_SIZE 13 + +// Offset into packet from where the datagram begins. +#define LT_LINK_HEADER_LENGTH 3 +#define LT_DGRAM_OFFSET (LT_LINK_HEADER_LENGTH) + +// Localtalk separates node id's into two classes, server/client. We attempt +// to get ours in the Server Class. +#define LT_MAX_CLIENT_NODE_ID 127 +#define LT_MIN_SERVER_NODE_ID 128 +#define LT_BROADCAST_NODE_ID 0xFF + +// Indexes in the GeneralMandatory array. +#define GM_TRANSMIT_GOOD 0x00 +#define GM_RECEIVE_GOOD 0x01 +#define GM_TRANSMIT_BAD 0x02 +#define GM_RECEIVE_BAD 0x03 +#define GM_RECEIVE_NO_BUFFER 0x04 +#define GM_ARRAY_SIZE 0x05 + +// Indexes in the GeneralOptional array. There are +// two sections, the ones up to COUNT_ARRAY_SIZE +// have entries for number (4 bytes) and number of +// bytes (8 bytes), the rest are a normal array. +#define GO_DIRECTED_TRANSMITS 0x00 +#define GO_MULTICAST_TRANSMITS 0x01 +#define GO_BROADCAST_TRANSMITS 0x02 +#define GO_DIRECTED_RECEIVES 0x03 +#define GO_MULTICAST_RECEIVES 0x04 +#define GO_BROADCAST_RECEIVES 0x05 +#define GO_COUNT_ARRAY_SIZE 0x06 + +#define GO_ARRAY_START 0x0C +#define GO_RECEIVE_CRC 0x0C +#define GO_TRANSMIT_QUEUE_LENGTH 0x0D +#define GO_ARRAY_SIZE 0x0E + +// Indexes in the MediaMandatory array. +#define MM_IN_BROADCASTS 0x00 +#define MM_IN_LENGTH_ERRORS 0x01 +#define MM_ARRAY_SIZE 0x02 + +// Indexes in the MediaOptional array. +#define MO_NO_HANDLERS 0x00 +#define MO_TRANSMIT_MAX_COLLISIONS 0x01 +#define MO_TRANSMIT_DEFERS 0x02 +#define MO_NO_DATA_ERRORS 0x03 +#define MO_RANDOM_CTS_ERRORS 0x04 +#define MO_FCS_ERRORS 0x05 +#define MO_ARRAY_SIZE 0x06 + +// Adapter States/Conditions. +#define ADAPTER_OPEN 0x00000001 +#define ADAPTER_CLOSING 0x00000002 +#define ADAPTER_NODE_ID_VALID 0x00000004 +#define ADAPTER_XMIT_IN_PROGRESS 0x00000008 +#define ADAPTER_REQ_IN_PROGRESS 0x00000010 +#define ADAPTER_RESET_IN_PROGRESS 0x00000020 +#define ADAPTER_QUEUE_RECV_COMPLETION 0x00000040 +#define ADAPTER_QUEUED_RECV_COMPLETION 0x00000080 +#define ADAPTER_TIMER_QUEUED 0x00000100 + + +typedef struct _LT_ADAPTER { + +#if DBG + ULONG Signature; +#endif + + ULONG Flags; + ULONG RefCount; + NDIS_SPIN_LOCK Lock; + + // Node ID. Localtalk acquires a node id dynamically. + UCHAR NodeId; + UCHAR PramNodeId; + + // List of Bindings + UINT OpenCount; + LIST_ENTRY OpenBindings; + + // We have a Polling timer which will handle all the work that this + // driver needs to do. + NDIS_TIMER PollingTimer; + + // Hardware settings on the card. From the configuration manager + ULONG MappedIoBaseAddr; + NDIS_INTERFACE_TYPE BusType; + + // Handles for our adapter and the MAC driver itself. + NDIS_HANDLE NdisMacHandle; + NDIS_HANDLE NdisAdapterHandle; + + // Reset processing. + struct _LT_OPEN * ResetOwner; + + // Queues + LIST_ENTRY LoopBack; + LIST_ENTRY Transmit; + LIST_ENTRY Receive; + LIST_ENTRY Request; + + // Current loopback packet + PNDIS_PACKET CurrentLoopbackPacket; + + // Statistics + ULONG GlobalPacketFilter; + ULONG GlobalLookAheadSize; + LT_STATUS_RESPONSE LastCardStatusResponse; + ULONG GeneralMandatory[GM_ARRAY_SIZE]; + LARGE_INTEGER GeneralOptionalByteCount[GO_COUNT_ARRAY_SIZE]; + ULONG GeneralOptionalFrameCount[GO_COUNT_ARRAY_SIZE]; + ULONG GeneralOptional[GO_ARRAY_SIZE - GO_ARRAY_START]; + ULONG MediaMandatory[MM_ARRAY_SIZE]; + ULONG MediaOptional[MO_ARRAY_SIZE]; + +} LT_ADAPTER, *PLT_ADAPTER; + + + +// Binding states +#define BINDING_OPEN 0x00000001 +#define BINDING_CLOSING 0x00000002 +#define BINDING_DO_RECV_COMPLETION 0x00000004 + +typedef struct _LT_OPEN { + +#if DBG + ULONG Signature; +#endif + + ULONG Flags; + ULONG RefCount; + + LIST_ENTRY Linkage; + PLT_ADAPTER LtAdapter; + + NDIS_HANDLE NdisBindingContext; + UINT CurrentLookAheadSize; + UINT CurrentPacketFilter; + +} LT_OPEN, *PLT_OPEN; + + +#define LT_DIRECTED 1 +#define LT_BROADCAST 2 +#define LT_LOOPBACK 3 + + +// This record type is inserted into the MacReserved portion +// of the packet header when the packet is going through the +// staged allocation of buffer space prior to the actual send. +typedef struct _LT_PACKET_RESERVED { + + // This must be the first entry so we can use CONTAINING_RECORD + // to get back to the packet. + LIST_ENTRY Linkage; + NDIS_HANDLE MacBindingHandle; + +} LT_PACKET_RESERVED, *PLT_PACKET_RESERVED; + + +// This structure is used in the MacReserved field of +// an NDIS_REQUEST_BLOCK, passed in during multicast +// address/packet filter operations. +typedef struct _LT_REQUEST_RESERVED { + LIST_ENTRY RequestList; + PLT_OPEN * OpenBlock; +} LT_REQUEST_RESERVED, *PLT_REQUEST_RESERVED; + +#ifdef LTSFT_LOCALS + +#endif // LTSFT_LOCALS + + +#endif // _LTSFT_ diff --git a/private/ntos/ndis/lt200/lttimer.c b/private/ntos/ndis/lt200/lttimer.c new file mode 100644 index 000000000..99186d552 --- /dev/null +++ b/private/ntos/ndis/lt200/lttimer.c @@ -0,0 +1,280 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + lttimer.c + +Abstract: + + This module contains the polling timer processing routines. + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#define LTTIMER_H_LOCALS +#include "ltmain.h" +#include "lttimer.h" +#include "ltreset.h" + + +// Define file id for errorlogging +#define FILENUM LTTIMER + + +VOID +LtTimerPoll( + IN PVOID SystemSpecific1, + IN PVOID Context, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3 + ) +/*++ + +Routine Description: + + This is the polling timer routine. It will receive data from the card + and process all the queues that are there- send/receive/loopback. NOTE: + Priority must be given to sends. + +Arguments: + + Context : Pointer to the Adapter structure. + All other parameters as described in NDIS 3.0 + +Return Value: + + None. + +--*/ +{ + USHORT ResponseLength; + UCHAR Data, ResponseType; + LT_INIT_RESPONSE InitPacket; + PRECV_DESC RecvDesc; + PUCHAR RecvPkt; + NDIS_STATUS Status; + + BOOLEAN ProcessReset = FALSE; + + BOOLEAN ClearCardData = FALSE; + PLT_ADAPTER Adapter = (PLT_ADAPTER)Context; + + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_LOW, + ("LtTimerPoll: Entering...\n")); + + LtReferenceAdapter(Adapter, &Status); + if (Status != NDIS_STATUS_SUCCESS) + { + // We are probably shutting down. + ASSERTMSG("LtTimerPoll: Adapter not closing!\n", + ((Adapter->Flags & ADAPTER_CLOSING) == 0)); + + // Remove the reference we added at timer set. + LtDeReferenceAdapter(Adapter); + return; + } + + // BUGBUG: Verify reset handling. + + // !!! Send's get very high priority. In total, the queue is processed + // !!! three times, twice in the timer and once in LtSend + LtSendProcessQueue(Adapter); + + // Check for receive data + NdisRawReadPortUchar(SC_PORT, &Data); + + if (Data & RX_READY) + { + // Get the length of the response on the card + NdisRawReadPortUchar(XFER_PORT, &Data); + + ResponseLength = (USHORT)(Data & 0xFF); + + NdisRawReadPortUchar(XFER_PORT, &Data); + + ResponseLength |= (Data << 8); + + // Now get the IO code. + NdisRawReadPortUchar(XFER_PORT, &ResponseType); + + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_INFO, + ("LtPoll: RespType = %x, RespLength = %d\n", + ResponseType, ResponseLength)); + + switch (ResponseType) + { + case LT_RSP_LAP_INIT: + + if (ResponseLength != sizeof(LT_INIT_RESPONSE)) + { + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_ERR, + ("LtTimerPoll: Bad response length %lx! \n", ResponseLength)); + + ClearCardData = TRUE; + } + break; + + case LT_RSP_LAP_FRAME: + + // Verify the frame is of the maximum packet size possible. + if (ResponseLength > LT_MAX_PACKET_SIZE) + { + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_ERR, + ("LtTimerPoll: Bad packet length %lx! \n", ResponseLength)); + + // Keep track of number of bad receives + NdisDprAcquireSpinLock(&Adapter->Lock); + ++Adapter->GeneralMandatory[GM_RECEIVE_BAD]; + NdisDprReleaseSpinLock(&Adapter->Lock); + + ClearCardData = TRUE; + break; + } + + // Allocate a receive buffer descriptor for the packet. + NdisAllocateMemory( + &RecvDesc, + (UINT)(sizeof(RECV_DESC)+ResponseLength), + 0, + LtNdisPhyAddr); + + if (RecvDesc == NULL) + { + // Keep track of the number of times we couldnt get a buffer. + NdisDprAcquireSpinLock(&Adapter->Lock); + ++Adapter->GeneralMandatory[GM_RECEIVE_NO_BUFFER]; + NdisDprReleaseSpinLock(&Adapter->Lock); + + ClearCardData = TRUE; + break; + } + + + // Get a pointer to the receive packet storage. + RecvPkt = (PUCHAR)((PUCHAR)RecvDesc + sizeof(RECV_DESC)); + + NdisRawReadPortBufferUchar(XFER_PORT, + RecvPkt, + ResponseLength); + + RecvDesc->Broadcast = IS_PACKET_BROADCAST(RecvPkt); + RecvDesc->BufferLength = ResponseLength; + + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_INFO, + ("LtTimerPoll: Recd Pkt Desc %lx Pkt %lx! \n", + RecvDesc, RecvPkt)); + + NdisDprAcquireSpinLock(&Adapter->Lock); + ++Adapter->GeneralMandatory[GM_RECEIVE_GOOD]; + if (RecvDesc->Broadcast) + { + ++Adapter->GeneralOptionalFrameCount[GO_BROADCAST_RECEIVES]; + LtAddLongToLargeInteger( + Adapter->GeneralOptionalByteCount[GO_BROADCAST_RECEIVES], + RecvDesc->BufferLength); + + Adapter->MediaMandatory[MM_IN_BROADCASTS]++; + + } + else + { + ++Adapter->GeneralOptionalFrameCount[GO_DIRECTED_RECEIVES]; + LtAddLongToLargeInteger( + Adapter->GeneralOptionalByteCount[GO_DIRECTED_RECEIVES], + RecvDesc->BufferLength); + } + + InsertTailList( + &Adapter->Receive, + &RecvDesc->Linkage); + + NdisDprReleaseSpinLock(&Adapter->Lock); + break; + + case LT_RSP_STATUS: + + if (ResponseLength != sizeof(LT_STATUS_RESPONSE)) + { + ClearCardData = TRUE; + break; + } + + NdisRawReadPortBufferUchar(XFER_PORT, + (PUCHAR)&Adapter->LastCardStatusResponse, + ResponseLength); + + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_INFO, + ("Node ID = %lx, Rom Ver = %lx, FirmWare Ver %lx\n", + Adapter->LastCardStatusResponse.NodeId, + Adapter->LastCardStatusResponse.RomVer, + Adapter->LastCardStatusResponse.SwVer)); + + break; + + default: + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_ERR, + ("LtTimerPoll: Unknown response type %lx\n", ResponseType)); + + ClearCardData = TRUE; + break; + } + } + + if (ClearCardData) + { + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_WARN, + ("LtTimerPoll: Clearing Card of response %d\n", ResponseLength)); + + while (ResponseLength-- > 0 ) + { + NdisRawReadPortUchar(XFER_PORT, &Data); + } + } + + // Call all the processing routines if their respective queues are + // not empty! + NdisDprAcquireSpinLock(&Adapter->Lock); + + ASSERT (Adapter->Flags & ADAPTER_NODE_ID_VALID); + + if (Adapter->Flags & ADAPTER_RESET_IN_PROGRESS) + { + ProcessReset = TRUE; + } + NdisDprReleaseSpinLock(&Adapter->Lock); + + if (ProcessReset) + { + LtResetComplete(Adapter); + } + + // Process our receive queue. + LtRecvProcessQueue(Adapter); + + // Process send queue as processing receives would have entailed + // some sends. + // NOTE: Process LoopQueue after SendQueue as the Send Packet + // goes into the loop queue if it is a broadcast, after + // being sent out on the net. + LtSendProcessQueue(Adapter); + LtLoopProcessQueue(Adapter); + + DBGPRINT(DBG_COMP_TIMER, DBG_LEVEL_LOW, + ("LtTimerPoll: Setting timer and Leaving...\n")); + + // Re-arm the timer + NdisSetTimer(&Adapter->PollingTimer, LT_POLLING_TIME); + + // Remove the reference we added at the beginning of this routine. + LtDeReferenceAdapter(Adapter); +} diff --git a/private/ntos/ndis/lt200/lttimer.h b/private/ntos/ndis/lt200/lttimer.h new file mode 100644 index 000000000..ef6f86248 --- /dev/null +++ b/private/ntos/ndis/lt200/lttimer.h @@ -0,0 +1,46 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + lttimer.h + +Abstract: + + This module contains the polling timer definitions + +Author: + + Stephen Hou (stephh@microsoft.com) + Nikhil Kamkolkar (nikhilk@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTTIMER_H_ +#define _LTTIMER_H_ + +// Poll timer value in milliseconds. +#define LT_POLLING_TIME (UINT)20 + +VOID +LtTimerPoll( + IN PVOID SystemSpecific1, + IN PVOID Context, + IN PVOID SystemSpecific2, + IN PVOID SystemSpecific3); + +#ifdef LTTIMER_H_LOCALS + +// Check to see if packet is broadcast. +#define IS_PACKET_BROADCAST(p) (((UCHAR)p[0] == LT_BROADCAST_NODE_ID)) + +#endif // LTTIMER_H_LOCALS + + +#endif // _LTTIMER_H_ + diff --git a/private/ntos/ndis/lt200/ltutils.c b/private/ntos/ndis/lt200/ltutils.c new file mode 100644 index 000000000..b1d1c2322 --- /dev/null +++ b/private/ntos/ndis/lt200/ltutils.c @@ -0,0 +1,610 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltutils.c + +Abstract: + + This module contains utility routines. + +Author: + + Nikhil Kamkolkar (nikhilk@microsoft.com) + Stephen Hou (stephh@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#include "ltmain.h" +#include "ltutils.h" + + +// Define file id for errorlogging +#define FILENUM LTUTILS + + +USHORT +LtUtilsPacketType( + IN PNDIS_PACKET Packet + ) + +/*++ + +Routine Description: + + Calculates the packet type for this packet. It also determines + if this packet should go out on the wire. + +Arguments: + + Packet - Packet whose source and destination addresses are tested. + +Return Value: + + Returns FALSE if the source is equal to the destination. + + +--*/ + +{ + // Holds the destination and source address from the packet. + UCHAR PacketAddresses[2]; + + // Junk variable to hold the length of the addresses + UINT AddressLength; + + LtUtilsCopyFromPacketToBuffer( + Packet, + 0, + 2, + PacketAddresses, + &AddressLength); + + return(LtUtilsUcharPacketType(PacketAddresses[0], PacketAddresses[1])); +} + + +USHORT +LtUtilsUcharPacketType( + IN UCHAR DestinationAddress, + IN UCHAR SourceAddress + ) + +/*++ + +Routine Description: + + Calculates the packet type for this packet. It also determines + if this packet should go out on the wire. + +Arguments: + + Packet - Packet whose source and destination addresses are tested. + +Return Value: + + Returns FALSE if the source is equal to the destination. + + +--*/ + +{ + int PacketType = LT_DIRECTED; + + if (DestinationAddress == LT_BROADCAST_NODE_ID) + { + PacketType = LT_BROADCAST; + } + else + { + if (DestinationAddress == SourceAddress) + { + PacketType = LT_LOOPBACK; + } + } + + return(PacketType); +} + + +VOID +LtUtilsCopyFromPacketToBuffer( + IN PNDIS_PACKET SrcPacket, + IN UINT SrcOffset, + IN UINT BytesToCopy, + OUT PUCHAR DestBuffer, + OUT PUINT BytesCopied + ) +/*++ + +Routine Description: + + Copy from an ndis packet into a buffer. + +Arguments: + + SrcPacket - The packet to copy from. + + SrcOffset - The offset within the packet from which to start the copy. + + BytesToCopy - The number of bytes to copy from the packet. + + DestBuffer - The destination of the copy. + + BytesCopied - The number of bytes actually copied. Can be less then + BytesToCopy if the packet is shorter than BytesToCopy. + +Return Value: + + None + +--*/ +{ + + UINT SrcBufferCount; // number of buffers in the current buffer + PNDIS_BUFFER SrcCurrentBuffer; // current buffer + UINT SrcCurrentBufferLen; // length of the current buffer + PVOID SrcVirtualAddress; // virtual address of the current buffer + UINT AmountToCopy; // bytes to copy + + UINT LocalBytesCopied = 0; // total bytes copied + + *BytesCopied = 0; + + // Take care of boundary condition of zero length copy. + if (!BytesToCopy) + { + return; + } + + // + // Get the first buffer. + // + + NdisQueryPacket( + SrcPacket, + NULL, + &SrcBufferCount, + &SrcCurrentBuffer, + NULL); + + // Could have a null packet. + if (!SrcBufferCount) + { + return; + } + + NdisQueryBuffer( + SrcCurrentBuffer, + &SrcVirtualAddress, + &SrcCurrentBufferLen); + + // advance to the start point for the copy. + while (SrcOffset) + { + if (SrcOffset > SrcCurrentBufferLen) + { + // + // What we want isn't in this buffer. + // + + SrcOffset -= SrcCurrentBufferLen; + SrcCurrentBufferLen = 0; + + } + else + { + // + SrcVirtualAddress = (PCHAR)SrcVirtualAddress + SrcOffset; + SrcCurrentBufferLen -= SrcOffset; + SrcOffset = 0; + break; + + } + + NdisGetNextBuffer( + SrcCurrentBuffer, + &SrcCurrentBuffer); + + // We hit the end of the packet + if (!SrcCurrentBuffer) + { + return; + } + + NdisQueryBuffer( + SrcCurrentBuffer, + &SrcVirtualAddress, + &SrcCurrentBufferLen); + } + + // Copy the data. + while (LocalBytesCopied < BytesToCopy) + { + AmountToCopy = ((SrcCurrentBufferLen <= (BytesToCopy - LocalBytesCopied))? + (SrcCurrentBufferLen):(BytesToCopy - LocalBytesCopied)); + + NdisMoveMemory( + DestBuffer, + SrcVirtualAddress, + AmountToCopy); + + DestBuffer = (PCHAR)DestBuffer + AmountToCopy; + SrcVirtualAddress = (PCHAR)SrcVirtualAddress + AmountToCopy; + + LocalBytesCopied += AmountToCopy; + SrcCurrentBufferLen -= AmountToCopy; + + // read the entire buffer, read in the next one + if (!SrcCurrentBufferLen) + { + NdisGetNextBuffer( + SrcCurrentBuffer, + &SrcCurrentBuffer); + + // + // We've reached the end of the packet. We return + // with what we've done so far. (Which must be shorter + // than requested. + // + + if (!SrcCurrentBuffer) + break; + + NdisQueryBuffer( + SrcCurrentBuffer, + &SrcVirtualAddress, + &SrcCurrentBufferLen); + + } + } + + *BytesCopied = LocalBytesCopied; +} + + +VOID +LtUtilsCopyFromBufferToPacket( + IN PUCHAR SrcBuffer, + IN UINT SrcOffset, + IN UINT BytesToCopy, + IN PNDIS_PACKET DestPacket, + OUT PUINT BytesCopied + ) +/*++ + +Routine Description: + + Copy from a buffer into an ndis packet. + +Arguments: + + SrcBuffer - The buffer to copy from. + + SrcOffset - The offset within SrcBuffer from which to start the copy. + + DestPacket - The destination of the copy. + + BytesToCopy - The number of bytes to copy from the buffer. + + BytesCopied - The number of bytes actually copied. Will be less + than BytesToCopy if the packet is not large enough. + +Return Value: + + None + +--*/ +{ + + UINT DestBufferCount; // number of buffers in the packet + PNDIS_BUFFER DestCurrentBuffer; // current buffer + UINT DestCurrentBufferLen; // length of the current buffer + PVOID DestVirtualAddress; // virtual addr of the current dest buffer + PUCHAR SrcCurrentAddress; // ptr to current location in src buffer + UINT AmountToCopy; // bytes to copy + UINT BytesRemaining; // bytes left to copy + + UINT LocalBytesCopied = 0; // bytes copied + + *BytesCopied = 0; + + // Take care of boundary condition of zero length copy. + if (!BytesToCopy) + { + return; + } + + // Get the first buffer of the destination. + NdisQueryPacket( + DestPacket, + NULL, + &DestBufferCount, + &DestCurrentBuffer, + NULL); + + // Could have a null packet. + if (!DestBufferCount) + { + return; + } + + NdisQueryBuffer( + DestCurrentBuffer, + &DestVirtualAddress, + &DestCurrentBufferLen); + + // Set up the source address. + SrcCurrentAddress = SrcBuffer + SrcOffset; + + while (LocalBytesCopied < BytesToCopy) + { + // + // Check to see whether we've exhausted the current destination + // buffer. If so, move onto the next one. + // + + if (!DestCurrentBufferLen) + { + NdisGetNextBuffer( + DestCurrentBuffer, + &DestCurrentBuffer); + + if (!DestCurrentBuffer) + { + // + // We've reached the end of the packet. We return + // with what we've done so far. (Which must be shorter + // than requested.) + // + + break; + + } + + NdisQueryBuffer( + DestCurrentBuffer, + &DestVirtualAddress, + &DestCurrentBufferLen); + + // go back to the start of the loop and repeat buffer size check + continue; + + } + + // + // Copy the data. + // + + BytesRemaining = BytesToCopy - LocalBytesCopied; + + AmountToCopy = ((BytesRemaining < DestCurrentBufferLen)? + (BytesRemaining):(DestCurrentBufferLen)); + + NdisMoveMemory( + DestVirtualAddress, + SrcCurrentAddress, + AmountToCopy); + + SrcCurrentAddress += AmountToCopy; + LocalBytesCopied += AmountToCopy; + DestCurrentBufferLen -= AmountToCopy; + + } + + *BytesCopied = LocalBytesCopied; +} + + + + +VOID +LtRefAdapter( + IN OUT PLT_ADAPTER Adapter, + OUT PNDIS_STATUS Status + ) +{ + *Status = NDIS_STATUS_SUCCESS; + + NdisAcquireSpinLock(&Adapter->Lock); + if ((Adapter->Flags & ADAPTER_CLOSING) == 0) + { + Adapter->RefCount++; + } + else + { + *Status = NDIS_STATUS_ADAPTER_REMOVED; + } + NdisReleaseSpinLock(&Adapter->Lock); + + return; +} + + + + +VOID +LtRefAdapterNonInterlock( + IN OUT PLT_ADAPTER Adapter, + OUT PNDIS_STATUS Status + ) +{ + *Status = NDIS_STATUS_SUCCESS; + + if ((Adapter->Flags & ADAPTER_CLOSING) == 0) + { + Adapter->RefCount++; + } + else + { + *Status = NDIS_STATUS_ADAPTER_REMOVED; + } + + return; +} + + + + +VOID +LtDeRefAdapter( + IN OUT PLT_ADAPTER Adapter + ) +{ + BOOLEAN Close = FALSE; + + NdisAcquireSpinLock(&Adapter->Lock); + if (--Adapter->RefCount == 0) + Close = TRUE; + NdisReleaseSpinLock(&Adapter->Lock); + + if (Close) + { + // Last reference on adapter is gone. + ASSERTMSG("LtDeRefAdapter: Closing flag not set!\n", + (Adapter->Flags & ADAPTER_CLOSING)); + + ASSERTMSG("LtDeRefAdapter: Open count is not zero!\n", + (Adapter->OpenCount == 0)); + + // Release the adapter + NdisDeregisterAdapter(Adapter->NdisAdapterHandle); + NdisFreeSpinLock(&Adapter->Lock); + + NdisFreeMemory( + Adapter, + sizeof(LT_ADAPTER), + (UINT)0); + } + + return; +} + + + + +VOID +LtRefBinding( + IN OUT PLT_OPEN Binding, + OUT PNDIS_STATUS Status + ) +{ + *Status = NDIS_STATUS_SUCCESS; + + NdisAcquireSpinLock(&Binding->LtAdapter->Lock); + if ((Binding->Flags & BINDING_CLOSING) == 0) + { + Binding->RefCount++; + } + else + { + *Status = NDIS_STATUS_CLOSING; + } + NdisReleaseSpinLock(&Binding->LtAdapter->Lock); + + return; +} + + + + +VOID +LtRefBindingNextNcNonInterlock( + IN PLIST_ENTRY PList, + IN PLIST_ENTRY PEnd, + OUT PLT_OPEN * Binding, + OUT PNDIS_STATUS Status + ) +{ + PLT_OPEN ChkBinding; + *Status = NDIS_STATUS_FAILURE; + + *Binding = NULL; + while (PList != PEnd) + { + ChkBinding = CONTAINING_RECORD(PList, LT_OPEN, Linkage); + + DBGPRINT(DBG_COMP_UTILS, DBG_LEVEL_INFO, + ("LtRefBindingNextNcNonInterlock: ChkBind %lx\n", ChkBinding)); + + LtRefBindingNonInterlock(ChkBinding, Status); + if (*Status == NDIS_STATUS_SUCCESS) + { + *Binding = ChkBinding; + break; + } + + PList = PList->Flink; + } + + return; +} + + + + +VOID +LtRefBindingNonInterlock( + IN OUT PLT_OPEN Binding, + OUT PNDIS_STATUS Status + ) +{ + *Status = NDIS_STATUS_SUCCESS; + + if ((Binding->Flags & BINDING_CLOSING) == 0) + { + Binding->RefCount++; + } + else + { + *Status = NDIS_STATUS_CLOSING; + } + + return; +} + + + + +VOID +LtDeRefBinding( + IN OUT PLT_OPEN Binding + ) +{ + BOOLEAN Close = FALSE; + + NdisAcquireSpinLock(&Binding->LtAdapter->Lock); + if (--Binding->RefCount == 0) + { + Close = TRUE; + RemoveEntryList(&Binding->Linkage); + (Binding->LtAdapter->OpenCount)--; + } + NdisReleaseSpinLock(&Binding->LtAdapter->Lock); + + if (Close) + { + NDIS_HANDLE OpenBindingContext = Binding->NdisBindingContext; + + // Last reference on binding is gone. + ASSERTMSG("LtDeRefBinding: Closing flag not set!\n", + (Binding->Flags & BINDING_CLOSING)); + + // Release the binding and remove its reference on the + // adapter. + NdisCompleteCloseAdapter(OpenBindingContext, NDIS_STATUS_SUCCESS); + LtDeReferenceAdapter(Binding->LtAdapter); + + // Free up the binding structure + NdisFreeMemory(Binding, sizeof(LT_OPEN), (UINT)0); + } + + return; +} + diff --git a/private/ntos/ndis/lt200/ltutils.h b/private/ntos/ndis/lt200/ltutils.h new file mode 100644 index 000000000..14debcec2 --- /dev/null +++ b/private/ntos/ndis/lt200/ltutils.h @@ -0,0 +1,184 @@ +/*++ + +Copyright (c) 1992 Microsoft Corporation + +Module Name: + + ltutils.h + +Abstract: + + This module contains + +Author: + + Nikhil Kamkolkar (nikhilk@microsoft.com) + Stephen Hou (stephh@microsoft.com) + +Revision History: + 19 Jun 1992 Initial Version (dch@pacvax.pacersoft.com) + +Notes: Tab stop: 4 +--*/ + +#ifndef _LTUTILS_H_ +#define _LTUTILS_H_ + + +USHORT +LtUtilsPacketType( + IN PNDIS_PACKET Packet + ); + +USHORT +LtUtilsUcharPacketType( + IN UCHAR DestinationAddress, + IN UCHAR SourceAddress + ); + +VOID +LtUtilsCopyFromPacketToBuffer( + IN PNDIS_PACKET SrcPacket, + IN UINT SrcOffset, + IN UINT BytesToCopy, + OUT PUCHAR DestBuffer, + OUT PUINT BytesCopied + ); + +VOID +LtUtilsCopyFromBufferToPacket( + IN PUCHAR SrcBuffer, + IN UINT SrcOffset, + IN UINT BytesToCopy, + IN PNDIS_PACKET DestPacket, + OUT PUINT BytesCopied + ); + + +extern +VOID +LtRefAdapter( + IN OUT PLT_ADAPTER Adapter, + OUT PNDIS_STATUS Status); + +extern +VOID +LtRefAdapterNonInterlock( + IN OUT PLT_ADAPTER Adapter, + OUT PNDIS_STATUS Status); + +extern +VOID +LtDeRefAdapter( + IN OUT PLT_ADAPTER Adapter); + +extern +VOID +LtRefBinding( + IN OUT PLT_OPEN Binding, + OUT PNDIS_STATUS Status); + +extern +VOID +LtRefBindingNonInterlock( + IN OUT PLT_OPEN Binding, + OUT PNDIS_STATUS Status); + +extern +VOID +LtRefBindingNextNcNonInterlock( + IN PLIST_ENTRY PList, + IN PLIST_ENTRY PEnd, + OUT PLT_OPEN * Binding, + OUT PNDIS_STATUS Status); + +extern +VOID +LtDeRefBinding( + IN OUT PLT_OPEN Binding); + + +// Reference Macros for Adapter/Bindings +#if DBG +#define LtReferenceAdapter(adapter, perror) \ + { \ + LtRefAdapter(adapter, perror); \ + } + +#define LtReferenceAdapterNonInterlock(adapter, perror) \ + { \ + LtRefAdapterNonInterlock(adapter, perror); \ + } + +#define LtDeReferenceAdapter(adapter) \ + { \ + LtDeRefAdapter(adapter); \ + } + +#define LtReferenceBinding(binding, perror) \ + { \ + LtRefBinding(binding, perror); \ + } + +#define LtReferenceBindingNonInterlock(binding, perror) \ + { \ + LtRefBindingNonInterlock(binding, perror); \ + } + +#define LtReferenceBindingNextNcNonInterlock(PList, PEnd, Binding, Status) \ + { \ + LtRefBindingNextNcNonInterlock(PList, PEnd, Binding, Status); \ + } + +#define LtDeReferenceBinding(binding) \ + { \ + LtDeRefBinding(binding); \ + } + +#else + +#define LtReferenceAdapter(adapter, perror) \ + { \ + LtRefAdapter(adapter, perror); \ + } + +#define LtReferenceAdapterNonInterlock(adapter, perror) \ + { \ + LtRefAdapterNonInterlock(adapter, perror); \ + } + +#define LtDeReferenceAdapter(adapter) \ + { \ + LtDeRefAdapter(adapter); \ + } + +#define LtReferenceBinding(binding, perror) \ + { \ + LtRefBinding(binding, perror); \ + } + +#define LtReferenceBindingNonInterlock(binding, perror) \ + { \ + LtRefBindingNonInterlock(binding, perror); \ + } + +#define LtReferenceBindingNextNcNonInterlock(PList, PEnd, Binding, Status) \ + { \ + LtRefBindingNextNcNonInterlock(PList, PEnd, Binding, Status); \ + } + +#define LtDeReferenceBinding(binding) \ + { \ + LtDeRefBinding(binding); \ + } + +#endif + + +#ifdef NDIS_NT + +#define LtAddLongToLargeInteger(a,b) \ + (RtlLargeIntegerAdd(a, RtlConvertLongToLargeInteger(b))) +#endif + +#endif // _LTUTILS_H_ diff --git a/private/ntos/ndis/lt200/makefile b/private/ntos/ndis/lt200/makefile new file mode 100644 index 000000000..6ee4f43fa --- /dev/null +++ b/private/ntos/ndis/lt200/makefile @@ -0,0 +1,6 @@ +# +# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source +# file to this component. This file merely indirects to the real make file +# that is shared by all the components of NT OS/2 +# +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/private/ntos/ndis/lt200/sources b/private/ntos/ndis/lt200/sources new file mode 100644 index 000000000..cce47fc27 --- /dev/null +++ b/private/ntos/ndis/lt200/sources @@ -0,0 +1,50 @@ +!IF 0 + +Copyright (c) 1989 Microsoft Corporation + +Module Name: + + sources. + +Abstract: + + This file specifies the target component being built and the list of + sources files needed to build that component. Also specifies optional + compiler switches and libraries that are unique for the component being + built. + + +Author: + + Steve Wood (stevewo) 12-Apr-1990 + +NOTE: Commented description of this file is in \nt\bak\bin\sources.tpl + +!ENDIF + +MAJORCOMP=ntos +MINORCOMP=ndis + +TARGETNAME=lt200 +TARGETPATH=$(BASEDIR)\public\sdk\lib +TARGETTYPE=DRIVER + +TARGETLIBS=$(BASEDIR)\public\sdk\lib\*\ndis.lib + +INCLUDES=..\..\inc + +SOURCES=ltinit.c \ + ltfirm.c \ + lttimer.c \ + ltloop.c \ + ltsend.c \ + ltrecv.c \ + ltreg.c \ + ltreq.c \ + ltreset.c \ + ltutils.c \ + lt200.rc + + +MSC_WARNING_LEVEL=/W3 /WX + |