diff --git a/sys/dev/cy/cy.c b/sys/dev/cy/cy.c index 187a3e9e19c9..1d41b5bf3455 100644 --- a/sys/dev/cy/cy.c +++ b/sys/dev/cy/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.72 1998/10/22 05:58:38 bde Exp $ + * $Id: cy.c,v 1.73 1998/11/22 17:40:32 bde Exp $ */ #include "opt_compat.h" @@ -432,11 +432,11 @@ sioprobe(dev) iobase = (cy_addr)dev->id_maddr; /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ - cd_inb(iobase, CY16_RESET, 0); /* XXX? */ + cy_inb(iobase, CY16_RESET, 0); /* XXX? */ DELAY(500); /* wait for the board to get its act together */ /* this is needed to get the board out of reset */ - cd_outb(iobase, CY_CLEAR_INTR, 0, 0); + cy_outb(iobase, CY_CLEAR_INTR, 0, 0); DELAY(500); return (cy_units(iobase, 0) == 0 ? 0 : -1); @@ -646,7 +646,7 @@ cyattach_common(cy_iobase, cy_align) } /* ensure an edge for the next interrupt */ - cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); + cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); return (adapter); } @@ -1068,7 +1068,7 @@ siointr(unit) & CD1400_xIVR_CHAN)); #else /* ack receive service */ - serv_type = cy_inb(iobase, CY8_SVCACKR); + serv_type = cy_inb(iobase, CY8_SVCACKR, cy_align); com = com_addr(baseu + + ((serv_type >> CD1400_xIVR_CHAN_SHIFT) @@ -1241,7 +1241,7 @@ siointr(unit) + (save_mir & CD1400_MIR_CHAN)); #else /* ack modem service */ - vector = cy_inb(iobase, CY8_SVCACKM); + vector = cy_inb(iobase, CY8_SVCACKM, cy_align); com = com_addr(baseu + ((vector >> CD1400_xIVR_CHAN_SHIFT) @@ -1324,7 +1324,7 @@ siointr(unit) + (save_tir & CD1400_TIR_CHAN)); #else /* ack transmit service */ - vector = cy_inb(iobase, CY8_SVCACKT); + vector = cy_inb(iobase, CY8_SVCACKT, cy_align); com = com_addr(baseu + ((vector >> CD1400_xIVR_CHAN_SHIFT) @@ -1384,7 +1384,7 @@ siointr(unit) } /* ensure an edge for the next interrupt */ - cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); + cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); schedsofttty(); diff --git a/sys/dev/cy/cy_isa.c b/sys/dev/cy/cy_isa.c index 187a3e9e19c9..1d41b5bf3455 100644 --- a/sys/dev/cy/cy_isa.c +++ b/sys/dev/cy/cy_isa.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.72 1998/10/22 05:58:38 bde Exp $ + * $Id: cy.c,v 1.73 1998/11/22 17:40:32 bde Exp $ */ #include "opt_compat.h" @@ -432,11 +432,11 @@ sioprobe(dev) iobase = (cy_addr)dev->id_maddr; /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ - cd_inb(iobase, CY16_RESET, 0); /* XXX? */ + cy_inb(iobase, CY16_RESET, 0); /* XXX? */ DELAY(500); /* wait for the board to get its act together */ /* this is needed to get the board out of reset */ - cd_outb(iobase, CY_CLEAR_INTR, 0, 0); + cy_outb(iobase, CY_CLEAR_INTR, 0, 0); DELAY(500); return (cy_units(iobase, 0) == 0 ? 0 : -1); @@ -646,7 +646,7 @@ cyattach_common(cy_iobase, cy_align) } /* ensure an edge for the next interrupt */ - cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); + cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); return (adapter); } @@ -1068,7 +1068,7 @@ siointr(unit) & CD1400_xIVR_CHAN)); #else /* ack receive service */ - serv_type = cy_inb(iobase, CY8_SVCACKR); + serv_type = cy_inb(iobase, CY8_SVCACKR, cy_align); com = com_addr(baseu + + ((serv_type >> CD1400_xIVR_CHAN_SHIFT) @@ -1241,7 +1241,7 @@ siointr(unit) + (save_mir & CD1400_MIR_CHAN)); #else /* ack modem service */ - vector = cy_inb(iobase, CY8_SVCACKM); + vector = cy_inb(iobase, CY8_SVCACKM, cy_align); com = com_addr(baseu + ((vector >> CD1400_xIVR_CHAN_SHIFT) @@ -1324,7 +1324,7 @@ siointr(unit) + (save_tir & CD1400_TIR_CHAN)); #else /* ack transmit service */ - vector = cy_inb(iobase, CY8_SVCACKT); + vector = cy_inb(iobase, CY8_SVCACKT, cy_align); com = com_addr(baseu + ((vector >> CD1400_xIVR_CHAN_SHIFT) @@ -1384,7 +1384,7 @@ siointr(unit) } /* ensure an edge for the next interrupt */ - cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); + cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); schedsofttty(); diff --git a/sys/dev/cy/cyreg.h b/sys/dev/cy/cyreg.h index d98cfd80ece0..baedda4175b2 100644 --- a/sys/dev/cy/cyreg.h +++ b/sys/dev/cy/cyreg.h @@ -26,32 +26,50 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cyreg.h,v 1.6 1998/08/13 13:54:10 bde Exp $ + * $Id: cyreg.h,v 1.7 1998/08/13 19:03:22 bde Exp $ */ /* * Definitions for Cyclades Cyclom-Y serial boards. */ -#define CY8_SVCACKR 0x100 -#define CY8_SVCACKT 0x200 -#define CY8_SVCACKM 0x300 -#define CY16_RESET 0x0a00 -#define CY_CLEAR_INTR 0x0c00 /* intr ack address */ +/* + * Cyclades register offsets. These are physical offsets for ISA boards + * and physical offsets divided by 2 for PCI boards. + */ +#define CY8_SVCACKR 0x100 /* (r) */ +#define CY8_SVCACKT 0x200 /* (r) */ +#define CY8_SVCACKM 0x300 /* (r) */ +#define CY16_RESET 0x1400 /* (r) */ +#define CY_CLEAR_INTR 0x1800 /* intr ack address (w) */ #define CY_MAX_CD1400s 8 /* for Cyclom-32Y */ #define CY_CLOCK(version) ((version) >= 0x48 ? 60000000 : 25000000) #define CY_RTS_DTR_SWAPPED(version) ((version) >= 0x48) +/* + * The `cd' macros are for access to cd1400 registers. The `cy' macros + * are for access to Cyclades registers. Both sets of macros scale the + * register number to get an offset, but the scales are different for + * mostly historical reasons. + */ #ifdef CyDebug -#define cd_inb(iobase, reg, cy_align) (++cd_inbs, *((iobase) + ((reg)*2 << (cy_align)))) -#define cy_inb(iobase, reg) (++cy_inbs, *((iobase) + (reg))) -#define cd_outb(iobase, reg, cy_align, val) (++cd_outbs, (void)(*((iobase) + ((reg)*2 << (cy_align))) = (val))) -#define cy_outb(iobase, reg, val) (++cy_outbs, (void)(*((iobase) + (reg)) = (val))) +#define cd_inb(iobase, reg, cy_align) \ + (++cd_inbs, *((iobase) + (2 * (reg) << (cy_align)))) +#define cy_inb(iobase, reg, cy_align) \ + (++cy_inbs, *((iobase) + ((reg) << (cy_align)))) +#define cd_outb(iobase, reg, cy_align, val) \ + (++cd_outbs, (void)(*((iobase) + (2 * (reg) << (cy_align))) = (val))) +#define cy_outb(iobase, reg, cy_align, val) \ + (++cy_outbs, (void)(*((iobase) + ((reg) << (cy_align))) = (val))) #else -#define cd_inb(iobase, reg, cy_align) (*((iobase) + ((reg)*2 << (cy_align)))) -#define cy_inb(iobase, reg) (*((iobase) + (reg))) -#define cd_outb(iobase, reg, cy_align, val) ((void)(*((iobase) + ((reg)*2 << (cy_align))) = (val))) -#define cy_outb(iobase, reg, val) ((void)(*((iobase) + (reg)) = (val))) +#define cd_inb(iobase, reg, cy_align) \ + (*((iobase) + (2 * (reg) << (cy_align)))) +#define cy_inb(iobase, reg, cy_align) \ + (*((iobase) + ((reg) << (cy_align)))) +#define cd_outb(iobase, reg, cy_align, val) \ + ((void)(*((iobase) + (2 * (reg) << (cy_align))) = (val))) +#define cy_outb(iobase, reg, cy_align, val) \ + ((void)(*((iobase) + ((reg) << (cy_align))) = (val))) #endif diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 187a3e9e19c9..1d41b5bf3455 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.72 1998/10/22 05:58:38 bde Exp $ + * $Id: cy.c,v 1.73 1998/11/22 17:40:32 bde Exp $ */ #include "opt_compat.h" @@ -432,11 +432,11 @@ sioprobe(dev) iobase = (cy_addr)dev->id_maddr; /* Cyclom-16Y hardware reset (Cyclom-8Ys don't care) */ - cd_inb(iobase, CY16_RESET, 0); /* XXX? */ + cy_inb(iobase, CY16_RESET, 0); /* XXX? */ DELAY(500); /* wait for the board to get its act together */ /* this is needed to get the board out of reset */ - cd_outb(iobase, CY_CLEAR_INTR, 0, 0); + cy_outb(iobase, CY_CLEAR_INTR, 0, 0); DELAY(500); return (cy_units(iobase, 0) == 0 ? 0 : -1); @@ -646,7 +646,7 @@ cyattach_common(cy_iobase, cy_align) } /* ensure an edge for the next interrupt */ - cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); + cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); return (adapter); } @@ -1068,7 +1068,7 @@ siointr(unit) & CD1400_xIVR_CHAN)); #else /* ack receive service */ - serv_type = cy_inb(iobase, CY8_SVCACKR); + serv_type = cy_inb(iobase, CY8_SVCACKR, cy_align); com = com_addr(baseu + + ((serv_type >> CD1400_xIVR_CHAN_SHIFT) @@ -1241,7 +1241,7 @@ siointr(unit) + (save_mir & CD1400_MIR_CHAN)); #else /* ack modem service */ - vector = cy_inb(iobase, CY8_SVCACKM); + vector = cy_inb(iobase, CY8_SVCACKM, cy_align); com = com_addr(baseu + ((vector >> CD1400_xIVR_CHAN_SHIFT) @@ -1324,7 +1324,7 @@ siointr(unit) + (save_tir & CD1400_TIR_CHAN)); #else /* ack transmit service */ - vector = cy_inb(iobase, CY8_SVCACKT); + vector = cy_inb(iobase, CY8_SVCACKT, cy_align); com = com_addr(baseu + ((vector >> CD1400_xIVR_CHAN_SHIFT) @@ -1384,7 +1384,7 @@ siointr(unit) } /* ensure an edge for the next interrupt */ - cd_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); + cy_outb(cy_iobase, CY_CLEAR_INTR, cy_align, 0); schedsofttty(); diff --git a/sys/i386/isa/cyreg.h b/sys/i386/isa/cyreg.h index d98cfd80ece0..baedda4175b2 100644 --- a/sys/i386/isa/cyreg.h +++ b/sys/i386/isa/cyreg.h @@ -26,32 +26,50 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cyreg.h,v 1.6 1998/08/13 13:54:10 bde Exp $ + * $Id: cyreg.h,v 1.7 1998/08/13 19:03:22 bde Exp $ */ /* * Definitions for Cyclades Cyclom-Y serial boards. */ -#define CY8_SVCACKR 0x100 -#define CY8_SVCACKT 0x200 -#define CY8_SVCACKM 0x300 -#define CY16_RESET 0x0a00 -#define CY_CLEAR_INTR 0x0c00 /* intr ack address */ +/* + * Cyclades register offsets. These are physical offsets for ISA boards + * and physical offsets divided by 2 for PCI boards. + */ +#define CY8_SVCACKR 0x100 /* (r) */ +#define CY8_SVCACKT 0x200 /* (r) */ +#define CY8_SVCACKM 0x300 /* (r) */ +#define CY16_RESET 0x1400 /* (r) */ +#define CY_CLEAR_INTR 0x1800 /* intr ack address (w) */ #define CY_MAX_CD1400s 8 /* for Cyclom-32Y */ #define CY_CLOCK(version) ((version) >= 0x48 ? 60000000 : 25000000) #define CY_RTS_DTR_SWAPPED(version) ((version) >= 0x48) +/* + * The `cd' macros are for access to cd1400 registers. The `cy' macros + * are for access to Cyclades registers. Both sets of macros scale the + * register number to get an offset, but the scales are different for + * mostly historical reasons. + */ #ifdef CyDebug -#define cd_inb(iobase, reg, cy_align) (++cd_inbs, *((iobase) + ((reg)*2 << (cy_align)))) -#define cy_inb(iobase, reg) (++cy_inbs, *((iobase) + (reg))) -#define cd_outb(iobase, reg, cy_align, val) (++cd_outbs, (void)(*((iobase) + ((reg)*2 << (cy_align))) = (val))) -#define cy_outb(iobase, reg, val) (++cy_outbs, (void)(*((iobase) + (reg)) = (val))) +#define cd_inb(iobase, reg, cy_align) \ + (++cd_inbs, *((iobase) + (2 * (reg) << (cy_align)))) +#define cy_inb(iobase, reg, cy_align) \ + (++cy_inbs, *((iobase) + ((reg) << (cy_align)))) +#define cd_outb(iobase, reg, cy_align, val) \ + (++cd_outbs, (void)(*((iobase) + (2 * (reg) << (cy_align))) = (val))) +#define cy_outb(iobase, reg, cy_align, val) \ + (++cy_outbs, (void)(*((iobase) + ((reg) << (cy_align))) = (val))) #else -#define cd_inb(iobase, reg, cy_align) (*((iobase) + ((reg)*2 << (cy_align)))) -#define cy_inb(iobase, reg) (*((iobase) + (reg))) -#define cd_outb(iobase, reg, cy_align, val) ((void)(*((iobase) + ((reg)*2 << (cy_align))) = (val))) -#define cy_outb(iobase, reg, val) ((void)(*((iobase) + (reg)) = (val))) +#define cd_inb(iobase, reg, cy_align) \ + (*((iobase) + (2 * (reg) << (cy_align)))) +#define cy_inb(iobase, reg, cy_align) \ + (*((iobase) + ((reg) << (cy_align)))) +#define cd_outb(iobase, reg, cy_align, val) \ + ((void)(*((iobase) + (2 * (reg) << (cy_align))) = (val))) +#define cy_outb(iobase, reg, cy_align, val) \ + ((void)(*((iobase) + ((reg) << (cy_align))) = (val))) #endif