diff options
Diffstat (limited to 'sys/arch/vax')
-rw-r--r-- | sys/arch/vax/vsa/gpx.c | 29 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcg.c | 40 | ||||
-rw-r--r-- | sys/arch/vax/vsa/lcspx.c | 44 | ||||
-rw-r--r-- | sys/arch/vax/vsa/smg.c | 15 |
4 files changed, 89 insertions, 39 deletions
diff --git a/sys/arch/vax/vsa/gpx.c b/sys/arch/vax/vsa/gpx.c index 0da4588c287..b1bf27bdb0e 100644 --- a/sys/arch/vax/vsa/gpx.c +++ b/sys/arch/vax/vsa/gpx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpx.c,v 1.19 2008/08/24 14:49:59 miod Exp $ */ +/* $OpenBSD: gpx.c,v 1.20 2008/12/21 21:39:50 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -1238,6 +1238,7 @@ gpxcnprobe() volatile struct adder *adder; vaddr_t tmp; int depth; + u_short status; switch (vax_boardtype) { case VAX_BTYP_410: @@ -1254,7 +1255,9 @@ gpxcnprobe() ioaccess(tmp, vax_trunc_page(GPXADDR + GPX_ADDER_OFFSET), 1); adder = (struct adder *)tmp; adder->status = 0; - if (adder->status == offsetof(struct adder, status)) + status = adder->status; + iounaccess(tmp, 1); + if (status == offsetof(struct adder, status)) return (0); /* Check for a recognized color depth */ @@ -1262,6 +1265,7 @@ gpxcnprobe() ioaccess(tmp, vax_trunc_page(GPXADDR + GPX_READBACK_OFFSET), 1); depth = *(u_int16_t *) (tmp + (GPX_READBACK_OFFSET & VAX_PGOFSET)) & 0x00f0; + iounaccess(tmp, 1); if (depth == 0x00f0 || depth == 0x0080) return (1); @@ -1284,14 +1288,16 @@ gpxcninit() { struct gpx_screen *ss = &gpx_consscr; extern vaddr_t virtual_avail; - vaddr_t tmp; + vaddr_t ova; long defattr; struct rasops_info *ri; - tmp = virtual_avail; - ioaccess(tmp, vax_trunc_page(GPXADDR + GPX_READBACK_OFFSET), 1); - ss->ss_depth = (0x00f0 & *(u_int16_t *) - (tmp + (GPX_READBACK_OFFSET & VAX_PGOFSET))) == 0x00f0 ? 4 : 8; + ova = virtual_avail; + + ioaccess(virtual_avail, + vax_trunc_page(GPXADDR + GPX_READBACK_OFFSET), 1); + ss->ss_depth = (0x00f0 & *(u_int16_t *)(virtual_avail + + (GPX_READBACK_OFFSET & VAX_PGOFSET))) == 0x00f0 ? 4 : 8; ioaccess(virtual_avail, GPXADDR + GPX_ADDER_OFFSET, 1); ss->ss_adder = (struct adder *)virtual_avail; @@ -1310,8 +1316,15 @@ gpxcninit() virtual_avail = round_page(virtual_avail); /* this had better not fail */ - if (gpx_setup_screen(ss) != 0) + if (gpx_setup_screen(ss) != 0) { +#if 0 + iounaccess((vaddr_t)ss->ss_cursor, 1); +#endif + iounaccess((vaddr_t)ss->ss_vdac, 1); + iounaccess((vaddr_t)ss->ss_adder, 1); + virtual_avail = ova; return (1); + } ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); diff --git a/sys/arch/vax/vsa/lcg.c b/sys/arch/vax/vsa/lcg.c index c52a601b8a9..d2cbecb56f8 100644 --- a/sys/arch/vax/vsa/lcg.c +++ b/sys/arch/vax/vsa/lcg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcg.c,v 1.13 2007/12/28 20:44:39 miod Exp $ */ +/* $OpenBSD: lcg.c,v 1.14 2008/12/21 21:39:50 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -716,6 +716,7 @@ lcgcnprobe() vaddr_t tmp; #ifdef PARANOIA volatile u_int8_t *ch; + int rc; #endif switch (vax_boardtype) { @@ -731,6 +732,7 @@ lcgcnprobe() ioaccess(tmp, vax_trunc_page(LCG_CONFIG_ADDR), 1); cfg = *(volatile u_int32_t *) (tmp + (LCG_CONFIG_ADDR & VAX_PGOFSET)); + iounaccess(tmp, 1); if (lcg_probe_screen(cfg, NULL, NULL) <= 0) break; /* no lcg or unsupported configuration */ @@ -740,13 +742,17 @@ lcgcnprobe() * Check for video memory. * We can not use badaddr() on these models. */ + rc = 0; ioaccess(tmp, LCG_FB_ADDR, 1); ch = (volatile u_int8_t *)tmp; *ch = 0x01; - if ((*ch & 0x01) == 0) - break; - *ch = 0x00; - if ((*ch & 0x01) != 0) + if ((*ch & 0x01) != 0) { + *ch = 0x00; + if ((*ch & 0x01) == 0) + rc = 1; + } + iounaccess(tmp, 1); + if (rc == 0) break; #endif @@ -769,14 +775,15 @@ lcgcninit() { struct lcg_screen *ss = &lcg_consscr; extern vaddr_t virtual_avail; - vaddr_t tmp; + vaddr_t ova; long defattr; struct rasops_info *ri; - tmp = virtual_avail; - ioaccess(tmp, vax_trunc_page(LCG_CONFIG_ADDR), 1); + ova = virtual_avail; + ioaccess(virtual_avail, vax_trunc_page(LCG_CONFIG_ADDR), 1); ss->ss_cfg = *(volatile u_int32_t *) - (tmp + (LCG_CONFIG_ADDR & VAX_PGOFSET)); + (virtual_avail + (LCG_CONFIG_ADDR & VAX_PGOFSET)); + iounaccess(virtual_avail, 1); ss->ss_depth = lcg_probe_screen(ss->ss_cfg, &ss->ss_width, &ss->ss_height); @@ -784,23 +791,28 @@ lcgcninit() ss->ss_fbsize = roundup(ss->ss_width * ss->ss_height, PAGE_SIZE); ss->ss_addr = (caddr_t)virtual_avail; + ioaccess(virtual_avail, LCG_FB_ADDR, ss->ss_fbsize / VAX_NBPG); virtual_avail += ss->ss_fbsize; - ioaccess((vaddr_t)ss->ss_addr, LCG_FB_ADDR, ss->ss_fbsize / VAX_NBPG); ss->ss_reg = virtual_avail; + ioaccess(virtual_avail, LCG_REG_ADDR, LCG_REG_SIZE / VAX_NBPG); virtual_avail += LCG_REG_SIZE; - ioaccess(ss->ss_reg, LCG_REG_ADDR, LCG_REG_SIZE / VAX_NBPG); ss->ss_lut = (volatile u_int8_t *)virtual_avail; - virtual_avail += LCG_LUT_SIZE; - ioaccess((vaddr_t)ss->ss_lut, LCG_LUT_ADDR + LCG_LUT_OFFSET, + ioaccess(virtual_avail, LCG_LUT_ADDR + LCG_LUT_OFFSET, LCG_LUT_SIZE / VAX_NBPG); + virtual_avail += LCG_LUT_SIZE; virtual_avail = round_page(virtual_avail); /* this had better not fail */ - if (lcg_setup_screen(ss) != 0) + if (lcg_setup_screen(ss) != 0) { + iounaccess((vaddr_t)ss->ss_lut, LCG_LUT_SIZE / VAX_NBPG); + iounaccess((vaddr_t)ss->ss_reg, LCG_REG_SIZE / VAX_NBPG); + iounaccess((vaddr_t)ss->ss_addr, ss->ss_fbsize / VAX_NBPG); + virtual_avail = ova; return (1); + } ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); diff --git a/sys/arch/vax/vsa/lcspx.c b/sys/arch/vax/vsa/lcspx.c index a6bf26497a0..2298006bdcc 100644 --- a/sys/arch/vax/vsa/lcspx.c +++ b/sys/arch/vax/vsa/lcspx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lcspx.c,v 1.14 2007/12/28 20:44:39 miod Exp $ */ +/* $OpenBSD: lcspx.c,v 1.15 2008/12/21 21:39:50 miod Exp $ */ /* * Copyright (c) 2006 Miodrag Vallat. * @@ -627,6 +627,8 @@ lcspxcnprobe() extern vaddr_t virtual_avail; volatile struct adder *adder; volatile u_int8_t *ch; + u_short status; + int rc; switch (vax_boardtype) { case VAX_BTYP_410: @@ -652,7 +654,9 @@ lcspxcnprobe() ioaccess(virtual_avail, GPXADDR + GPX_ADDER_OFFSET, 1); adder = (volatile struct adder *)virtual_avail; adder->status = 0; - if (adder->status != offsetof(struct adder, status)) + status = adder->status; + iounaccess(virtual_avail, 1); + if (status != offsetof(struct adder, status)) break; return (1); @@ -673,13 +677,18 @@ lcspxcnprobe() /* * Check for video memory at SPX address. */ + rc = 0; ioaccess(virtual_avail, LCSPX_FB_ADDR, 1); ch = (volatile u_int8_t *)virtual_avail; *ch = 0x01; - if ((*ch & 0x01) == 0) - break; - *ch = 0x00; - if ((*ch & 0x01) != 0) + if ((*ch & 0x01) != 0) { + *ch = 0x00; + if ((*ch & 0x01) == 0) + rc = 1; + } + iounaccess(virtual_avail, 1); + + if (rc == 0) break; return (1); @@ -703,11 +712,13 @@ lcspxcninit() extern vaddr_t virtual_avail; int i; u_int width, height; - vaddr_t reg1; + vaddr_t ova, reg1; u_int32_t magic; long defattr; struct rasops_info *ri; + ova = virtual_avail; + switch (vax_boardtype) { case VAX_BTYP_410: case VAX_BTYP_420: @@ -727,8 +738,9 @@ lcspxcninit() * if things go wrong. */ reg1 = virtual_avail; - ioaccess(reg1, LCSPX_REG1_ADDR, 1); + ioaccess(virtual_avail, LCSPX_REG1_ADDR, 1); magic = *(u_int32_t *)(reg1 + 0x11c); + iounaccess(virtual_avail, 1); if (magic & 0x80) { width = 1280; @@ -746,25 +758,31 @@ lcspxcninit() ss->ss_fbsize = width * height; ss->ss_addr = (caddr_t)virtual_avail; + ioaccess(virtual_avail, LCSPX_FB_ADDR, ss->ss_fbsize / VAX_NBPG); virtual_avail += ss->ss_fbsize; - ioaccess((vaddr_t)ss->ss_addr, LCSPX_FB_ADDR, ss->ss_fbsize / VAX_NBPG); ss->ss_reg = virtual_avail; + ioaccess(virtual_avail, LCSPX_REG_ADDR, LCSPX_REG_SIZE / VAX_NBPG); virtual_avail += LCSPX_REG_SIZE; - ioaccess(ss->ss_reg, LCSPX_REG_ADDR, LCSPX_REG_SIZE / VAX_NBPG); for (i = 0; i < 4; i++) { ss->ss_ramdac[i] = (volatile u_int8_t *)virtual_avail; - virtual_avail += VAX_NBPG; - ioaccess((vaddr_t)ss->ss_ramdac[i], + ioaccess(virtual_avail, LCSPX_RAMDAC_ADDR + i * LCSPX_RAMDAC_INTERLEAVE, 1); + virtual_avail += VAX_NBPG; } virtual_avail = round_page(virtual_avail); /* this had better not fail */ - if (lcspx_setup_screen(ss, width, height) != 0) + if (lcspx_setup_screen(ss, width, height) != 0) { + for (i = 3; i >= 0; i--) + iounaccess((vaddr_t)ss->ss_ramdac[i], 1); + iounaccess(ss->ss_reg, LCSPX_REG_SIZE / VAX_NBPG); + iounaccess((vaddr_t)ss->ss_addr, ss->ss_fbsize / VAX_NBPG); + virtual_avail = ova; return (1); + } ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c index b22617f2213..319c35ce394 100644 --- a/sys/arch/vax/vsa/smg.c +++ b/sys/arch/vax/vsa/smg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smg.c,v 1.21 2007/12/28 20:44:39 miod Exp $ */ +/* $OpenBSD: smg.c,v 1.22 2008/12/21 21:39:50 miod Exp $ */ /* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */ /* * Copyright (c) 2006, Miodrag Vallat @@ -844,22 +844,29 @@ smgcninit() { struct smg_screen *ss = &smg_consscr; extern vaddr_t virtual_avail; + vaddr_t ova; long defattr; struct rasops_info *ri; + ova = virtual_avail; + ss->ss_addr = (caddr_t)virtual_avail; + ioaccess(virtual_avail, SMADDR, SMSIZE / VAX_NBPG); virtual_avail += SMSIZE; - ioaccess((vaddr_t)ss->ss_addr, SMADDR, SMSIZE / VAX_NBPG); ss->ss_cursor = (struct dc503reg *)virtual_avail; + ioaccess(virtual_avail, KA420_CUR_BASE, 1); virtual_avail += VAX_NBPG; - ioaccess((vaddr_t)ss->ss_cursor, KA420_CUR_BASE, 1); virtual_avail = round_page(virtual_avail); /* this had better not fail */ - if (smg_setup_screen(ss) != 0) + if (smg_setup_screen(ss) != 0) { + iounaccess((vaddr_t)ss->ss_addr, SMSIZE / VAX_NBPG); + iounaccess((vaddr_t)ss->ss_cursor, 1); + virtual_avail = ova; return (1); + } ri = &ss->ss_ri; ri->ri_ops.alloc_attr(ri, 0, 0, 0, &defattr); |