Untangled the Cyclades offsets a little. CY16_RESET and CY_CLEAR_INTR

were half of their physical offsets for ISA and 1/4 of their physical
offsets for PCI, while all other Cyclades offsets were physical/1 for
ISA and physical/2 for PCI.  Logically wrong macros were used to scale
CY16_RESET and CY_CLEAR_INTR to the correct physical offsets.

Fixed some style bugs (mostly long lines).
This commit is contained in:
Bruce Evans 1998-11-23 13:58:55 +00:00
parent aa045fa499
commit 976d09b9f2
5 changed files with 88 additions and 52 deletions

View File

@ -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 @@ cont:
+ (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 @@ cont:
+ (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 @@ cont:
}
/* 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();

View File

@ -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 @@ cont:
+ (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 @@ cont:
+ (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 @@ cont:
}
/* 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();

View File

@ -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

View File

@ -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 @@ cont:
+ (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 @@ cont:
+ (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 @@ cont:
}
/* 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();

View File

@ -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