Browse Source

Added friendly enable/disable functions

tags/v0.9.3
Michael Brown 19 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,10 +155,10 @@ void eisa_fill_nic ( struct nic *nic, struct eisa_device *eisa ) {
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 162
 	/* Set reset line high for 1000 µs.  Spec says 500 µs, but
163 163
 	 * this doesn't work for all cards, so we are conservative.
164 164
 	 */
@@ -168,6 +168,7 @@ void enable_eisa_device ( struct eisa_device *eisa ) {
168 168
 	/* Set reset low and write a 1 to ENABLE.  Delay again, in
169 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 173
 	udelay ( 1000 ); /* Must wait 800 */
173 174
 }

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

@@ -607,8 +607,8 @@ struct bus_driver isapnp_driver __bus_driver = {
607 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 612
 	/* Wake the card and select the logical device */
613 613
 	isapnp_wait_for_key ();
614 614
 	isapnp_send_key ();
@@ -616,7 +616,7 @@ void activate_isapnp_device ( struct isapnp_device *isapnp,
616 616
 	isapnp_logicaldevice ( isapnp->logdev );
617 617
 
618 618
 	/* Activate/deactivate the logical device */
619
-	isapnp_activate ( activate );
619
+	isapnp_activate ( activation );
620 620
 	isapnp_delay();
621 621
 
622 622
 	/* Return all cards to Wait for Key state */

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

@@ -75,9 +75,16 @@ struct eisa_driver {
75 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 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 89
  * EISA bus global definition
83 90
  *

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

@@ -209,10 +209,17 @@ struct isapnp_driver {
209 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 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 224
  * ISAPnP bus global definition
218 225
  *

Loading…
Cancel
Save