Skip to content

Instantly share code, notes, and snippets.

@ao-kenji
Created April 5, 2014 08:07
Show Gist options
  • Save ao-kenji/9988805 to your computer and use it in GitHub Desktop.
Save ao-kenji/9988805 to your computer and use it in GitHub Desktop.
Make closer to hp300 version.
Index: sys/arch/luna88k/dev/mb89352.c
===================================================================
RCS file: /cvs/src/sys/arch/luna88k/dev/mb89352.c,v
retrieving revision 1.17
diff -u -r1.17 mb89352.c
--- sys/arch/luna88k/dev/mb89352.c 30 May 2011 20:01:29 -0000 1.17
+++ sys/arch/luna88k/dev/mb89352.c 5 Apr 2014 08:05:44 -0000
@@ -166,6 +166,7 @@
void spc_msgout (struct spc_softc *);
int spc_dataout_pio (struct spc_softc *, u_char *, int);
int spc_datain_pio (struct spc_softc *, u_char *, int);
+void spc_process_intr(void *, u_char);
#ifdef SPC_DEBUG
void spc_print_acb (struct spc_acb *);
void spc_dump_driver (struct spc_softc *);
@@ -478,6 +479,7 @@
{
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
+ u_char intr;
SPC_TRACE(("spc_poll "));
while (count) {
@@ -485,8 +487,9 @@
* If we had interrupts enabled, would we
* have got an interrupt?
*/
- if (bus_space_read_1(iot, ioh, INTS) != 0)
- spc_intr(sc);
+ intr = bus_space_read_1(iot, ioh, INTS);
+ if (intr != 0)
+ spc_process_intr(sc, intr);
if ((xs->flags & ITSDONE) != 0)
return 0;
delay(1000);
@@ -1563,10 +1566,8 @@
bus_space_tag_t iot = sc->sc_iot;
bus_space_handle_t ioh = sc->sc_ioh;
u_char ints;
- struct spc_acb *acb;
- struct scsi_link *sc_link;
- struct spc_tinfo *ti;
- int n;
+
+ SPC_TRACE(("spc_intr "));
/*
* Disable interrupt.
@@ -1574,24 +1575,43 @@
bus_space_write_1(iot, ioh, SCTL,
bus_space_read_1(iot, ioh, SCTL) & ~SCTL_INTR_ENAB);
- SPC_TRACE(("spc_intr "));
+ ints = bus_space_read_1(iot, ioh, INTS);
+ if (ints != 0)
+ spc_process_intr(arg, ints);
+
+ bus_space_write_1(iot, ioh, SCTL,
+ bus_space_read_1(iot, ioh, SCTL) | SCTL_INTR_ENAB);
+ return 1;
+}
+
+void
+spc_process_intr(arg, ints)
+ void *arg;
+ u_char ints;
+{
+ struct spc_softc *sc = arg;
+ bus_space_tag_t iot = sc->sc_iot;
+ bus_space_handle_t ioh = sc->sc_ioh;
+ struct spc_acb *acb;
+ struct scsi_link *sc_link;
+ struct spc_tinfo *ti;
+ int n;
+
+ SPC_TRACE(("spc_process_intr "));
+
+ goto start;
loop:
/*
* Loop until transfer completion.
*/
- /*
- * First check for abnormal conditions, such as reset.
- */
-#ifdef x68k /* XXX? */
- while ((ints = bus_space_read_1(iot, ioh, INTS)) == 0)
- delay(1);
- SPC_MISC(("ints = 0x%x ", ints));
-#else
ints = bus_space_read_1(iot, ioh, INTS);
+start:
SPC_MISC(("ints = 0x%x ", ints));
-#endif
+ /*
+ * Check for abnormal conditions, such as reset.
+ */
if ((ints & INTS_RST) != 0) {
printf("%s: SCSI bus reset\n", sc->sc_dev.dv_xname);
goto reset;
@@ -1910,14 +1930,14 @@
SPC_BREAK();
reset:
spc_init(sc);
- return 1;
+ return;
finish:
timeout_del(&acb->xs->stimeout);
bus_space_write_1(iot, ioh, INTS, ints);
ints = 0;
spc_done(sc, acb);
- goto out;
+ return;
sched:
sc->sc_state = SPC_IDLE;
@@ -1925,11 +1945,8 @@
goto out;
out:
- if (ints)
+ if (ints != 0)
bus_space_write_1(iot, ioh, INTS, ints);
- bus_space_write_1(iot, ioh, SCTL,
- bus_space_read_1(iot, ioh, SCTL) | SCTL_INTR_ENAB);
- return 1;
}
void
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment