From c55a14c5796e65896cc9cf3676fec224809e5cac Mon Sep 17 00:00:00 2001 From: imp Date: Tue, 11 Jan 2005 00:32:43 +0000 Subject: Properly calculate the offset in mapping the memory of pccards. This allows my 3com cards to work again. It appears that this code was once there, but I removed it when I added the alignment issues. MFC After: 5 days PR: 70639 (and likely others) --- sys/dev/exca/exca.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/dev/exca/exca.c b/sys/dev/exca/exca.c index 2ef4f89..3700cbd 100644 --- a/sys/dev/exca/exca.c +++ b/sys/dev/exca/exca.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002 M Warner Losh. All rights reserved. + * Copyright (c) 2002-2005 M Warner Losh. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -180,9 +180,12 @@ exca_do_mem_map(struct exca_softc *sc, int win) { struct mem_map_index_st *map; struct pccard_mem_handle *mem; + uint32_t offset; map = &mem_map_index[win]; mem = &sc->mem[win]; + 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); exca_putb(sc, map->sysmem_start_msb, @@ -201,10 +204,8 @@ exca_do_mem_map(struct exca_softc *sc, int win) exca_putb(sc, map->sysmem_win, (mem->addr >> EXCA_MEMREG_WIN_SHIFT) & 0xff); - exca_putb(sc, map->cardmem_lsb, - (mem->cardaddr >> EXCA_CARDMEM_ADDRX_SHIFT) & 0xff); - exca_putb(sc, map->cardmem_msb, - ((mem->cardaddr >> (EXCA_CARDMEM_ADDRX_SHIFT + 8)) & + 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)); -- cgit v1.1