Browse Source

Added friendly enable/disable functions

tags/v0.9.3
Michael Brown 20 years ago
parent
commit
97346a75f7
4 changed files with 24 additions and 9 deletions
  1. 4
    3
      src/drivers/bus/eisa.c
  2. 3
    3
      src/drivers/bus/isapnp.c
  3. 8
    1
      src/include/eisa.h
  4. 9
    2
      src/include/isapnp.h

+ 4
- 3
src/drivers/bus/eisa.c View File

155
 }
155
 }
156
 
156
 
157
 /*
157
 /*
158
- * Reset and enable an EISA device
158
+ * Reset and enable/disable an EISA device
159
  *
159
  *
160
  */
160
  */
161
-void enable_eisa_device ( struct eisa_device *eisa ) {
161
+void eisa_device_enabled ( struct eisa_device *eisa, int enabled ) {
162
 	/* Set reset line high for 1000 µs.  Spec says 500 µs, but
162
 	/* Set reset line high for 1000 µs.  Spec says 500 µs, but
163
 	 * this doesn't work for all cards, so we are conservative.
163
 	 * this doesn't work for all cards, so we are conservative.
164
 	 */
164
 	 */
168
 	/* Set reset low and write a 1 to ENABLE.  Delay again, in
168
 	/* Set reset low and write a 1 to ENABLE.  Delay again, in
169
 	 * case the card takes a while to wake up.
169
 	 * case the card takes a while to wake up.
170
 	 */
170
 	 */
171
-	outb ( EISA_CMD_ENABLE, eisa->ioaddr + EISA_GLOBAL_CONFIG );
171
+	outb ( enabled ? EISA_CMD_ENABLE : 0,
172
+	       eisa->ioaddr + EISA_GLOBAL_CONFIG );
172
 	udelay ( 1000 ); /* Must wait 800 */
173
 	udelay ( 1000 ); /* Must wait 800 */
173
 }
174
 }

+ 3
- 3
src/drivers/bus/isapnp.c View File

607
  * arbitration.
607
  * arbitration.
608
  *
608
  *
609
  */
609
  */
610
-void activate_isapnp_device ( struct isapnp_device *isapnp,
611
-			      int activate ) {
610
+void isapnp_device_activation ( struct isapnp_device *isapnp,
611
+				int activation ) {
612
 	/* Wake the card and select the logical device */
612
 	/* Wake the card and select the logical device */
613
 	isapnp_wait_for_key ();
613
 	isapnp_wait_for_key ();
614
 	isapnp_send_key ();
614
 	isapnp_send_key ();
616
 	isapnp_logicaldevice ( isapnp->logdev );
616
 	isapnp_logicaldevice ( isapnp->logdev );
617
 
617
 
618
 	/* Activate/deactivate the logical device */
618
 	/* Activate/deactivate the logical device */
619
-	isapnp_activate ( activate );
619
+	isapnp_activate ( activation );
620
 	isapnp_delay();
620
 	isapnp_delay();
621
 
621
 
622
 	/* Return all cards to Wait for Key state */
622
 	/* Return all cards to Wait for Key state */

+ 8
- 1
src/include/eisa.h View File

75
  * Functions in eisa.c
75
  * Functions in eisa.c
76
  *
76
  *
77
  */
77
  */
78
-extern void enable_eisa_device ( struct eisa_device *eisa );
78
+extern void eisa_device_enabled ( struct eisa_device *eisa, int enabled );
79
 extern void fill_eisa_nic ( struct nic *nic, struct eisa_device *eisa );
79
 extern void fill_eisa_nic ( struct nic *nic, struct eisa_device *eisa );
80
 
80
 
81
+static inline void enable_eisa_device ( struct eisa_device *eisa ) {
82
+	eisa_device_enabled ( eisa, 1 );
83
+}
84
+static inline void disable_eisa_device ( struct eisa_device *eisa ) {
85
+	eisa_device_enabled ( eisa, 0 );
86
+}
87
+
81
 /*
88
 /*
82
  * EISA bus global definition
89
  * EISA bus global definition
83
  *
90
  *

+ 9
- 2
src/include/isapnp.h View File

209
  * Functions in isapnp.c
209
  * Functions in isapnp.c
210
  *
210
  *
211
  */
211
  */
212
-extern void activate_isapnp_device ( struct isapnp_device *isapnp,
213
-				     int active );
212
+extern void isapnp_device_activation ( struct isapnp_device *isapnp,
213
+				       int activation );
214
 extern void isapnp_fill_nic ( struct nic *nic, struct isapnp_device *isapnp );
214
 extern void isapnp_fill_nic ( struct nic *nic, struct isapnp_device *isapnp );
215
 
215
 
216
+static inline void activate_isapnp_device ( struct isapnp_device *isapnp ) {
217
+	isapnp_device_activation ( isapnp, 1 );
218
+}
219
+static inline void deactivate_isapnp_device ( struct isapnp_device *isapnp ) {
220
+	isapnp_device_activation ( isapnp, 0 );
221
+}
222
+
216
 /*
223
 /*
217
  * ISAPnP bus global definition
224
  * ISAPnP bus global definition
218
  *
225
  *

Loading…
Cancel
Save