Changeset 587 for GPL/trunk/drv32/strategy.c
- Timestamp:
- Jun 9, 2016, 10:38:13 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/drv32/strategy.c
r549 r587 5 5 * (C) 2000-2002 InnoTek Systemberatung GmbH 6 6 * (C) 2000-2001 Sander van Leeuwen (sandervl@xs4all.nl) 7 * Copyright (c) 2013-2015 David Azarewicz david@88watts.net 7 8 * 8 9 * This program is free software; you can redistribute it and/or … … 24 25 25 26 #define INCL_NOPMAPI 26 #define INCL_DOSINFOSEG 27 #define INCL_DOSINFOSEG // Need Global info seg in rm.cpp algorithms 27 28 #include <os2.h> 28 29 29 30 #include <devhelp.h> 30 #include <devrp.h>31 //DAZ #include <devrp.h> 31 32 #include <devown.h> 32 33 #include "strategy.h" … … 35 36 #include <string.h> 36 37 37 ULONG StratRead(R P__far *_rp);38 ULONG StratIOCtl(R P__far *_rp);39 ULONG StratClose(R P__far *_rp);38 ULONG StratRead(REQPACKET __far *_rp); 39 ULONG StratIOCtl(REQPACKET __far *_rp); 40 ULONG StratClose(REQPACKET __far *_rp); 40 41 41 ULONG DiscardableInit(R PInit__far*);42 ULONG DiscardableInit(REQPACKET __far*); 42 43 ULONG deviceOwner = DEV_NO_OWNER; 43 44 ULONG numOS2Opens = 0; 44 extern "C"BOOL fRewired; //pci.c45 extern BOOL fRewired; //pci.c 45 46 46 extern "C"DBGINT DbgInt;47 extern DBGINT DbgInt; 47 48 48 49 //****************************************************************************** 50 ULONG StratOpen(REQPACKET __far* rp) 51 { 52 if (numOS2Opens == 0) 53 { 54 deviceOwner = DEV_PDD_OWNER; 55 } 56 numOS2Opens++; 57 return RPDONE; 58 } 59 49 60 //****************************************************************************** 50 ULONG StratOpen(RP __far*) 51 { 52 if (numOS2Opens == 0) { 53 deviceOwner = DEV_PDD_OWNER; 54 } 55 numOS2Opens++; 56 return RPDONE; 57 } 58 //****************************************************************************** 59 //****************************************************************************** 60 #pragma off (unreferenced) 61 static ULONG StratWrite(RP __far* _rp) 62 #pragma on (unreferenced) 61 //DAZ #pragma off (unreferenced) 62 static ULONG StratWrite(REQPACKET __far* rp) 63 //DAZ #pragma on (unreferenced) 63 64 { 64 65 return RPDONE | RPERR; 65 66 } 67 66 68 //****************************************************************************** 67 69 // External initialization entry-point 68 70 //****************************************************************************** 69 ULONG StratInit(R P __far* _rp)71 ULONG StratInit(REQPACKET __far* rp) 70 72 { 71 73 ULONG rc; 72 74 73 74 75 memset(&DbgInt, 0, sizeof(DbgInt)); 76 DbgPrintIrq(); 75 77 76 77 78 79 80 81 78 //DAZ RPInit __far* rp = (RPInit __far*)_rp; 79 rc = DiscardableInit(rp); 80 //dprintf(("StratInit End rc=%d", rc)); 81 DbgPrintIrq(); 82 DbgInt.ulState = 1; 83 return rc; 82 84 } 85 83 86 //****************************************************************************** 84 87 // External initialization complete entry-point 85 #ifdef ACPI86 #include "irqos2.h"87 #endif //ACPI88 88 //****************************************************************************** 89 #pragma off (unreferenced)90 ULONG StratInitComplete(R P __far* _rp)91 #pragma on (unreferenced)89 //DAZ #pragma off (unreferenced) 90 ULONG StratInitComplete(REQPACKET __far* rp) 91 //DAZ #pragma on (unreferenced) 92 92 { 93 DbgInt.ulState = 2; 94 #ifdef ACPI 95 PciAdjustInterrupts(); 96 #endif 97 DbgPrintIrq(); 98 //dprintf(("StratInitComplete")); 99 return(RPDONE); 93 DbgInt.ulState = 2; 94 DbgPrintIrq(); 95 //dprintf(("StratInitComplete")); 96 return(RPDONE); 100 97 } 98 101 99 //****************************************************************************** 102 //****************************************************************************** 103 #pragma off (unreferenced) 104 ULONG StratShutdown(RP __far *_rp) 105 #pragma on (unreferenced) 100 //DAZ #pragma off (unreferenced) 101 ULONG StratShutdown(REQPACKET __far *rp) 102 //DAZ #pragma on (unreferenced) 106 103 { 107 104 //DAZ RPShutdown __far *rp = (RPShutdown __far *)_rp; 108 105 109 //dprintf(("StratShutdown %d", rp->Function)); 110 if(rp->Function == 1) {//end of shutdown 111 OSS32_Shutdown(); 112 } 113 return(RPDONE); 106 //dprintf(("StratShutdown %d", rp->Function)); 107 if(rp->shutdown.Function == 1) //end of shutdown 108 { 109 OSS32_Shutdown(); 110 } 111 return(RPDONE); 114 112 } 115 //****************************************************************************** 113 116 114 //****************************************************************************** 117 115 // Handle unsupported requests 118 static ULONG StratError(R P __far*)116 static ULONG StratError(REQPACKET __far* rp) 119 117 { 120 return RPERR_ COMMAND | RPDONE;118 return RPERR_BADCOMMAND | RPDONE; 121 119 } 120 122 121 //****************************************************************************** 123 122 // Strategy dispatch table … … 125 124 // This table is used by the strategy routine to dispatch strategy requests 126 125 //****************************************************************************** 127 typedef ULONG (*RPHandler)(R P__far* rp);126 typedef ULONG (*RPHandler)(REQPACKET __far* rp); 128 127 RPHandler StratDispatch[] = 129 128 { 130 StratInit, 131 StratError, 132 StratError, 133 StratError, 134 StratRead, 135 StratError, 136 StratError, 137 StratError, 138 StratWrite, 139 StratError, 140 StratError, 141 StratError, 142 StratError, 143 StratOpen, 144 StratClose, 145 StratError, 146 StratIOCtl, 147 StratError, 148 StratError, 149 StratError, 150 StratError, 151 StratError, 152 StratError, 153 StratError, 154 StratError, 155 StratError, 156 StratError, 157 StratError, 158 StratShutdown, 159 StratError, 160 StratError, 161 StratInitComplete 129 StratInit, // 00 (BC): Initialization 130 StratError, // 01 (B ): Media check 131 StratError, // 02 (B ): Build BIOS parameter block 132 StratError, // 03 ( ): Unused 133 StratRead, // 04 (BC): Read 134 StratError, // 05 ( C): Nondestructive read with no wait 135 StratError, // 06 ( C): Input status 136 StratError, // 07 ( C): Input flush 137 StratWrite, // 08 (BC): Write 138 StratError, // 09 (BC): Write verify 139 StratError, // 0A ( C): Output status 140 StratError, // 0B ( C): Output flush 141 StratError, // 0C ( ): Unused 142 StratOpen, // 0D (BC): Open 143 StratClose, // 0E (BC): Close 144 StratError, // 0F (B ): Removable media check 145 StratIOCtl, // 10 (BC): IO Control 146 StratError, // 11 (B ): Reset media 147 StratError, // 12 (B ): Get logical unit 148 StratError, // 13 (B ): Set logical unit 149 StratError, // 14 ( C): Deinstall character device driver 150 StratError, // 15 ( ): Unused 151 StratError, // 16 (B ): Count partitionable fixed disks 152 StratError, // 17 (B ): Get logical unit mapping of fixed disk 153 StratError, // 18 ( ): Unused 154 StratError, // 19 ( ): Unused 155 StratError, // 1A ( ): Unused 156 StratError, // 1B ( ): Unused 157 StratShutdown, // 1C (BC): Notify start or end of system shutdown 158 StratError, // 1D (B ): Get driver capabilities 159 StratError, // 1E ( ): Unused 160 StratInitComplete // 1F (BC): Notify end of initialization 162 161 }; 162 163 163 //****************************************************************************** 164 164 // Strategy entry point … … 167 167 // calling convention, which fetches arguments from the correct registers. 168 168 //****************************************************************************** 169 ULONG Strategy(RP __far* rp);170 169 #pragma aux (STRATEGY) Strategy "ALSA_STRATEGY"; 171 ULONG Strategy(R P__far* rp)170 ULONG Strategy(REQPACKET __far* rp) 172 171 { 173 if (fRewired) { 174 fRewired = FALSE; 175 rprintf(("Strategy: Resuming")); 176 OSS32_APMResume(); 177 DbgPrintIrq(); 178 } 172 if (fRewired) 173 { 174 fRewired = FALSE; 175 rprintf(("Strategy: Resuming")); 176 OSS32_APMResume(); 177 DbgPrintIrq(); 178 } 179 179 180 if (rp->Command < sizeof(StratDispatch)/sizeof(StratDispatch[0])) 181 return(StratDispatch[rp->Command](rp)); 182 else return(RPERR_COMMAND | RPDONE); 180 if (rp->bCommand < sizeof(StratDispatch)/sizeof(StratDispatch[0])) return(StratDispatch[rp->bCommand](rp)); 181 else return(RPERR_BADCOMMAND | RPDONE); 183 182 } 184 //****************************************************************************** 185 //****************************************************************************** 183
Note:
See TracChangeset
for help on using the changeset viewer.