* FILE: ndis/main.c
* PURPOSE: Driver entry point
* PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
+ * Vizzini (vizzini@plasmic.com)
* REVISIONS:
* CSH 01/08-2000 Created
+ * 8/20/2003 Vizzini - NDIS4/5 revisions
*/
#include <ndissys.h>
#include <protocol.h>
#endif /* DBG */
+/* see miniport.c */
+extern KSPIN_LOCK OrphanAdapterListLock;
+extern LIST_ENTRY OrphanAdapterListHead;
VOID MainUnload(
PDRIVER_OBJECT DriverObject)
NDIS_DbgPrint(MAX_TRACE, ("Leaving.\n"));
}
-
NTSTATUS
-#ifndef _MSC_VER
STDCALL
-#endif
DriverEntry(
PDRIVER_OBJECT DriverObject,
PUNICODE_STRING RegistryPath)
* Status of driver initialization
*/
{
- NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
+ NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
+
+ InitializeListHead(&ProtocolListHead);
+ KeInitializeSpinLock(&ProtocolListLock);
+
+ InitializeListHead(&MiniportListHead);
+ KeInitializeSpinLock(&MiniportListLock);
- InitializeListHead(&ProtocolListHead);
- KeInitializeSpinLock(&ProtocolListLock);
+ InitializeListHead(&AdapterListHead);
+ KeInitializeSpinLock(&AdapterListLock);
- InitializeListHead(&MiniportListHead);
- KeInitializeSpinLock(&MiniportListLock);
+ InitializeListHead(&OrphanAdapterListHead);
+ KeInitializeSpinLock(&OrphanAdapterListLock);
+
+ DriverObject->DriverUnload = (PDRIVER_UNLOAD)MainUnload;
+
+ /*
+ * until we have PNP support, query the enum key and NdisFindDevice() each one
+ * NOTE- this will load and start other services before this one returns STATUS_SUCCESS.
+ * I hope there aren't code reentrancy problems. :)
+ */
+ NdisStartDevices();
+
+ return STATUS_SUCCESS;
+}
- InitializeListHead(&AdapterListHead);
- KeInitializeSpinLock(&AdapterListLock);
+/*
+ * @implemented
+ */
+VOID
+CDECL
+NdisWriteErrorLogEntry(
+ IN NDIS_HANDLE NdisAdapterHandle,
+ IN NDIS_ERROR_CODE ErrorCode,
+ IN ULONG NumberOfErrorValues,
+ IN ULONG ERROR_LOG_MAXIMUM_SIZE)
+/* IN ULONG ...)
+ * ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
+ */
+/*
+ * FUNCTION: Write a syslog error
+ * ARGUMENTS:
+ * NdisAdapterHandle: Handle passed into MiniportInitialize
+ * ErrorCode: 32-bit error code to be logged
+ * NumberOfErrorValues: number of errors to log
+ * Variable: list of log items
+ * NOTES:
+ * - THIS IS >CDECL<
+ * - This needs to be fixed to do var args
+ * - FIXME - this needs to be properly implemented once we have an event log
+ */
+{
+ NDIS_DbgPrint(MIN_TRACE, ("ERROR: ErrorCode 0x%x\n", ErrorCode));
-#ifdef _MSC_VER
- DriverObject->DriverUnload = MainUnload;
-#else
- DriverObject->DriverUnload = (PDRIVER_UNLOAD)MainUnload;
+#if DBG
+ /* break into a debugger so we can see what's up */
+ __asm__("int $3\n");
#endif
+}
- return STATUS_SUCCESS;
+/*
+ * @implemented
+ */
+VOID
+EXPORT
+NdisInitializeReadWriteLock(
+ IN PNDIS_RW_LOCK Lock)
+/*
+ * FUNCTION: Initialize a NDIS_RW_LOCK
+ * ARGUMENTS:
+ * Lock: pointer to the lock to initialize
+ * NOTES:
+ * NDIS 5.0
+ */
+{
+ memset(Lock,0,sizeof(NDIS_RW_LOCK));
+}
+
+/*
+ * @implemented
+ */
+NDIS_STATUS
+EXPORT
+NdisWriteEventLogEntry(
+ IN PVOID LogHandle,
+ IN NDIS_STATUS EventCode,
+ IN ULONG UniqueEventValue,
+ IN USHORT NumStrings,
+ IN PVOID StringsList OPTIONAL,
+ IN ULONG DataSize,
+ IN PVOID Data OPTIONAL)
+/*
+ * FUNCTION: Log an event in the system event log
+ * ARGUMENTS:
+ * LogHandle: pointer to the driver object of the protocol logging the event
+ * EventCode: NDIS_STATUS_XXX describing the event
+ * UniqueEventValue: identifiees this instance of the error value
+ * NumStrings: number of strings in StringList
+ * StringList: list of strings to log
+ * DataSize: number of bytes in Data
+ * Data: binary dump data to help analyzing the event
+ * NOTES:
+ * - STDCALL, not CDECL like WriteError...
+ * - FIXME Needs to use the real log interface, once there is one
+ */
+{
+ /*
+ * just returning true until we have an event log
+ */
+ NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
+ return NDIS_STATUS_SUCCESS;
}
/* EOF */
+