Date: Mon, 5 Jan 2009 21:00:22 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r186796 - head/sys/dev/exca Message-ID: <200901052100.n05L0McF011137@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Mon Jan 5 21:00:22 2009 New Revision: 186796 URL: http://svn.freebsd.org/changeset/base/186796 Log: First cut at fixing memory mapping botch. Nobody must use the ray(4) driver since it couldn't have worked with NEWCARD w/o these fixes. This should allow selecting 16-bit memory width as well (which was what was broken). Modified: head/sys/dev/exca/exca.c Modified: head/sys/dev/exca/exca.c ============================================================================== --- head/sys/dev/exca/exca.c Mon Jan 5 20:58:41 2009 (r186795) +++ head/sys/dev/exca/exca.c Mon Jan 5 21:00:22 2009 (r186796) @@ -179,39 +179,38 @@ exca_do_mem_map(struct exca_softc *sc, i struct mem_map_index_st *map; struct pccard_mem_handle *mem; uint32_t offset; - int mem8 = 1 /* mem->kind == PCCARD_A_MEM_ATTR */; + uint32_t mem16; + uint32_t attrmem; map = &mem_map_index[win]; mem = &sc->mem[win]; + mem16 = (mem->kind & PCCARD_MEM_16BIT) ? + EXCA_SYSMEM_ADDRX_START_MSB_DATASIZE_16BIT : 0; + attrmem = (mem->kind & PCCARD_MEM_ATTR) ? + EXCA_CARDMEM_ADDRX_MSB_REGACTIVE_ATTR : 0; offset = ((mem->cardaddr >> EXCA_CARDMEM_ADDRX_SHIFT) - (mem->addr >> EXCA_SYSMEM_ADDRX_SHIFT)) & 0x3fff; exca_putb(sc, map->sysmem_start_lsb, - (mem->addr >> EXCA_SYSMEM_ADDRX_SHIFT) & 0xff); + mem->addr >> EXCA_SYSMEM_ADDRX_SHIFT); exca_putb(sc, map->sysmem_start_msb, ((mem->addr >> (EXCA_SYSMEM_ADDRX_SHIFT + 8)) & - EXCA_SYSMEM_ADDRX_START_MSB_ADDR_MASK) | - (mem8 ? 0 : EXCA_SYSMEM_ADDRX_START_MSB_DATASIZE_16BIT)); + EXCA_SYSMEM_ADDRX_START_MSB_ADDR_MASK) | mem16); exca_putb(sc, map->sysmem_stop_lsb, - ((mem->addr + mem->realsize - 1) >> - EXCA_SYSMEM_ADDRX_SHIFT) & 0xff); + (mem->addr + mem->realsize - 1) >> EXCA_SYSMEM_ADDRX_SHIFT); exca_putb(sc, map->sysmem_stop_msb, (((mem->addr + mem->realsize - 1) >> (EXCA_SYSMEM_ADDRX_SHIFT + 8)) & EXCA_SYSMEM_ADDRX_STOP_MSB_ADDR_MASK) | EXCA_SYSMEM_ADDRX_STOP_MSB_WAIT2); - - exca_putb(sc, map->sysmem_win, - (mem->addr >> EXCA_MEMREG_WIN_SHIFT) & 0xff); + exca_putb(sc, map->sysmem_win, mem->addr >> EXCA_MEMREG_WIN_SHIFT); exca_putb(sc, map->cardmem_lsb, offset & 0xff); - exca_putb(sc, map->cardmem_msb, (((offset >> 8) & 0xff) & - EXCA_CARDMEM_ADDRX_MSB_ADDR_MASK) | - ((mem->kind == PCCARD_A_MEM_ATTR) ? - EXCA_CARDMEM_ADDRX_MSB_REGACTIVE_ATTR : 0)); + exca_putb(sc, map->cardmem_msb, ((offset >> 8) & + EXCA_CARDMEM_ADDRX_MSB_ADDR_MASK) | attrmem); #ifdef EXCA_DEBUG - if (mem->kind == PCCARD_A_MEM_ATTR) + if (mem->kind & PCCARD_MEM_ATTR) printf("attribtue memory\n"); else printf("common memory\n"); @@ -342,7 +341,21 @@ exca_mem_set_flags(struct exca_softc *sc return (ENOENT); } - sc->mem[win].kind = flags; + switch (flags) + { + case PCCARD_A_MEM_ATTR: + sc->mem[win].kind |= PCCARD_MEM_ATTR; + break; + case PCCARD_A_MEM_COM: + sc->mem[win].kind &= ~PCCARD_MEM_ATTR; + break; + case PCCARD_A_MEM_16BIT: + sc->mem[win].kind |= PCCARD_MEM_16BIT; + break; + case PCCARD_A_MEM_8BIT: + sc->mem[win].kind &= ~PCCARD_MEM_16BIT; + break; + } exca_do_mem_map(sc, win); return (0); } @@ -801,7 +814,7 @@ exca_activate_resource(struct exca_softc err = exca_io_map(exca, PCCARD_WIDTH_AUTO, res); break; case SYS_RES_MEMORY: - err = exca_mem_map(exca, PCCARD_A_MEM_COM, res); + err = exca_mem_map(exca, 0, res); break; } if (err)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901052100.n05L0McF011137>