From c68183d0b8cb8cb595c0fac05b6d989132543595 Mon Sep 17 00:00:00 2001 From: nate Date: Sun, 26 Oct 1997 04:36:24 +0000 Subject: - Do a bunch of gratuitous changes intended to make the code easier to follow. * Rename/reorder all of the pccard structures, change many of the member names to be descriptive, and follow more closely other 'bus' drivers naming schemes. * Rename a bunch of parameter and local variable names to be more consistant in the code. * Renamed the PCCARD 'crd' device to be the 'card' device * KNF and make the code consistant where it was obvious. * ifdef'd out some unused code --- sys/i386/isa/aic6360.c | 84 ++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 41 deletions(-) (limited to 'sys/i386/isa/aic6360.c') diff --git a/sys/i386/isa/aic6360.c b/sys/i386/isa/aic6360.c index eede184..8622ef4 100644 --- a/sys/i386/isa/aic6360.c +++ b/sys/i386/isa/aic6360.c @@ -31,7 +31,7 @@ */ /* - * $Id: aic6360.c,v 1.31 1997/09/21 21:40:51 gibbs Exp $ + * $Id: aic6360.c,v 1.32 1997/10/21 17:57:31 nate Exp $ * * Acknowledgements: Many of the algorithms used in this driver are * inspired by the work of Julian Elischer (julian@tfs.com) and @@ -698,69 +698,58 @@ static struct scsi_device aic_dev = { /* PCCARD suport */ -#include "crd.h" -#if NCRD > 0 +#include "card.h" +#if NCARD > 0 #include #include #include #include -static int aic_card_intr(struct pccard_dev *); /* Interrupt handler */ -void aicunload(struct pccard_dev *); /* Disable driver */ -void aicsuspend(struct pccard_dev *); /* Suspend driver */ -static int aicinit(struct pccard_dev *, int); /* init device */ +static int aicinit(struct pccard_devinfo *, int); /* init device */ +void aicunload(struct pccard_devinfo *); /* Disable driver */ +static int aic_card_intr(struct pccard_devinfo *); /* Interrupt handler */ +void aicsuspend(struct pccard_devinfo *); /* Suspend driver */ -static struct pccard_drv aic_info = { +static struct pccard_device aic_info = { "aic", - aic_card_intr, + aicinit, aicunload, + aic_card_intr, aicsuspend, - aicinit, 0, /* Attributes - presently unused */ &bio_imask /* Interrupt mask for device */ }; /* - * Called when a power down is wanted. Shuts down the - * device and configures the device as unavailable (but - * still loaded...). A resume is done by calling - * feinit with first=0. This is called when the user suspends - * the system, or the APM code suspends the system. - */ -void -aicsuspend(struct pccard_dev *dp) -{ - printf("aic%d: suspending\n", dp->isahd.id_unit); -} - -/* * Initialize the device - called from Slot manager. + * * if first is set, then initially check for * the device's existence before initialising it. * Once initialised, the device table may be set up. */ int -aicinit(struct pccard_dev *dp, int first) +aicinit(struct pccard_devinfo *devi, int first) { static int already_aicinit[NAIC]; + /* validate unit number */ if (first) { - if (dp->isahd.id_unit >= NAIC) + if (devi->isahd.id_unit >= NAIC) return(ENODEV); /* Make sure it isn't already initialised */ - if (already_aicinit[dp->isahd.id_unit] == 1) { - if (aicattach(&dp->isahd) == 0) + if (already_aicinit[devi->isahd.id_unit] == 1) { + if (aicattach(&devi->isahd) == 0) return(ENXIO); return(0); - } + } /* * Probe the device. If a value is returned, the * device was found at the location. */ - if (aicprobe(&dp->isahd) == 0) + if (aicprobe(&devi->isahd) == 0) return(ENXIO); - if (aicattach(&dp->isahd) == 0) + if (aicattach(&devi->isahd) == 0) return(ENXIO); } /* @@ -770,7 +759,7 @@ aicinit(struct pccard_dev *dp, int first) * reset (and possibly restart) the hardware, but * I am not sure of the best way to do this... */ - already_aicinit[dp->isahd.id_unit] = 1; + already_aicinit[devi->isahd.id_unit] = 1; return(0); } @@ -784,14 +773,14 @@ aicinit(struct pccard_dev *dp, int first) * read and write do not hang. */ void -aicunload(struct pccard_dev *dp) +aicunload(struct pccard_devinfo *devi) { - printf("aic%d: unload\n", dp->isahd.id_unit); + printf("aic%d: unload\n", devi->isahd.id_unit); #if 0 - aicstop(dp->isahd.id_unit); + aicstop(devi->isahd.id_unit); #endif #ifdef SCSI_DETACH - aicdetach(&dp->isahd); + aicdetach(&devi->isahd); #endif } @@ -799,12 +788,25 @@ aicunload(struct pccard_dev *dp) * card_intr - Shared interrupt called from front end of PC-Card handler. */ static int -aic_card_intr(struct pccard_dev *dp) +aic_card_intr(struct pccard_devinfo *devi) { - aicintr(dp->isahd.id_unit); + aicintr(devi->isahd.id_unit); return(1); } -#endif /* NCRD > 0 */ + +/* + * Called when a power down is wanted. Shuts down the + * device and configures the device as unavailable (but + * still loaded...). A resume is done by calling + * feinit with first=0. This is called when the user suspends + * the system, or the APM code suspends the system. + */ +void +aicsuspend(struct pccard_devinfo *devi) +{ + printf("aic%d: suspending\n", devi->isahd.id_unit); +} +#endif /* NCARD > 0 */ /* * INITIALIZATION ROUTINES (probe, attach ++) @@ -819,7 +821,7 @@ aicprobe(dev) struct isa_device *dev; { struct aic_data *aic; -#if NCRD > 0 +#if NCARD > 0 int unit = dev->id_unit; int aic_reg_drv[NAIC]; static int aic_already_init; @@ -833,7 +835,7 @@ aicprobe(dev) } dev->id_unit = unit; -#if NCRD > 0 +#if NCARD > 0 if (!aic_reg_drv[unit]) aic_reg_drv[unit] = 1; @@ -1427,7 +1429,7 @@ aic_done(acb) * longer busy. This code is sickening, but it works. */ if (acb == aic->nexus) { -#if NAPM > 0 && NCRD > 0 +#if NAPM > 0 && NCARD > 0 /* SlimSCSI dies without this when it resumes from suspend */ aic->nexus = NULL; #endif -- cgit v1.1