summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2001-01-07 08:08:54 +0000
committerimp <imp@FreeBSD.org>2001-01-07 08:08:54 +0000
commit4b7a126e06e4c8b7897d75aa7ee1d99a0e5e8060 (patch)
tree32fc6b708606cdec71aff03bf3112324db82ac56 /sys
parent9abe30ef582d87f37c76e2c8d585353ff5a1af44 (diff)
downloadFreeBSD-src-4b7a126e06e4c8b7897d75aa7ee1d99a0e5e8060.zip
FreeBSD-src-4b7a126e06e4c8b7897d75aa7ee1d99a0e5e8060.tar.gz
Undo the interface change to CARD_GET_MEMORY_OFFSET. It wasn't tested
by even a compile of the OLDCARD code, was unapproved by me the keeper of OLDCARD and broke OLDCARD and the ray driver. Adjust new code to cope with the older interface. If the interface changes in the future, it ***MUST*** be cleared by me so that the OLDCARD impacts taken into account. It code in card_if.m is used jointly by both OLDCARD and NEWCARD.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pccard/card_if.m1
-rw-r--r--sys/dev/pccard/pccard.c16
-rw-r--r--sys/dev/pccbb/pccbb.c14
3 files changed, 18 insertions, 13 deletions
diff --git a/sys/dev/pccard/card_if.m b/sys/dev/pccard/card_if.m
index f3813ee..7952b86 100644
--- a/sys/dev/pccard/card_if.m
+++ b/sys/dev/pccard/card_if.m
@@ -64,7 +64,6 @@ METHOD int set_memory_offset {
device_t child;
int rid;
u_int32_t cardaddr;
- u_int32_t *offsetp;
}
METHOD int get_memory_offset {
diff --git a/sys/dev/pccard/pccard.c b/sys/dev/pccard/pccard.c
index 6bbbd12..efa170e 100644
--- a/sys/dev/pccard/pccard.c
+++ b/sys/dev/pccard/pccard.c
@@ -391,6 +391,8 @@ pccard_function_enable(struct pccard_function *pf)
struct pccard_function *tmp;
int reg;
device_t dev = pf->sc->dev;
+ uint32_t addr;
+
if (pf->cfe == NULL) {
DEVPRVERBOSE((dev, "No config entry could be allocated.\n"));
return ENOMEM;
@@ -442,12 +444,16 @@ pccard_function_enable(struct pccard_function *pf)
&pf->ccr_rid, 0, ~0, 1 << 10, RF_ACTIVE);
if (!pf->ccr_res)
goto bad;
- DEVPRINTF((dev, "ccr_res == %lx-%lx, base=%lx\n", rman_get_start(pf->ccr_res), rman_get_end(pf->ccr_res), pf->ccr_base));
+ DEVPRINTF((dev, "ccr_res == %lx-%lx, base=%lx\n",
+ rman_get_start(pf->ccr_res), rman_get_end(pf->ccr_res),
+ pf->ccr_base));
CARD_SET_RES_FLAGS(device_get_parent(dev), dev, SYS_RES_MEMORY,
pf->ccr_rid, PCCARD_A_MEM_ATTR);
CARD_SET_MEMORY_OFFSET(device_get_parent(dev), dev,
- pf->ccr_rid, pf->ccr_base,
- &pf->pf_ccr_offset);
+ pf->ccr_rid, pf->ccr_base);
+ CARD_GET_MEMORY_OFFSET(device_get_parent(dev), dev,
+ pf->ccr_rid, &addr);
+ pf->pf_ccr_offset = pf->ccr_base - addr;
pf->pf_ccrt = rman_get_bustag(pf->ccr_res);
pf->pf_ccrh = rman_get_bushandle(pf->ccr_res);
pf->pf_ccr_realsize = 1;
@@ -835,11 +841,11 @@ pccard_set_res_flags(device_t dev, device_t child, int type, int rid,
static int
pccard_set_memory_offset(device_t dev, device_t child, int rid,
- u_int32_t offset, u_int32_t *offsetp)
+ u_int32_t offset)
{
return CARD_SET_MEMORY_OFFSET(device_get_parent(dev), child, rid,
- offset, offsetp);
+ offset);
}
static int
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c
index e39e956..caa22fd 100644
--- a/sys/dev/pccbb/pccbb.c
+++ b/sys/dev/pccbb/pccbb.c
@@ -242,7 +242,7 @@ static int pccbb_pcic_release_resource(device_t self, device_t child, int type,
static int pccbb_pcic_set_res_flags(device_t self, device_t child, int type,
int rid, u_int32_t flags);
static int pccbb_pcic_set_memory_offset(device_t self, device_t child, int rid,
- u_int32_t offset, u_int32_t *offsetp);
+ u_int32_t offset);
static int pccbb_power_enable_socket(device_t self, device_t child);
static void pccbb_power_disable_socket(device_t self, device_t child);
static int pccbb_activate_resource(device_t self, device_t child, int type,
@@ -1706,7 +1706,7 @@ pccbb_pcic_set_res_flags(device_t self, device_t child, int type, int rid,
static int
pccbb_pcic_set_memory_offset(device_t self, device_t child, int rid,
- u_int32_t cardaddr, u_int32_t *offsetp)
+ u_int32_t cardaddr)
{
struct pccbb_softc *sc = device_get_softc(self);
int win;
@@ -1726,11 +1726,11 @@ pccbb_pcic_set_memory_offset(device_t self, device_t child, int rid,
return 1;
}
- *offsetp = cardaddr % PCIC_MEM_PAGESIZE;
- cardaddr -= *offsetp;
- sc->mem[win].realsize = sc->mem[win].size + *offsetp + PCIC_MEM_PAGESIZE - 1;
- sc->mem[win].realsize = sc->mem[win].realsize -
- (sc->mem[win].realsize % PCIC_MEM_PAGESIZE);
+ /* Fixup size since cardaddr must align to PCIC_MEM_PAGESIZE */
+ /* XXX This should be a marco XXX */
+ sc->mem[win].realsize = (sc->mem[win].size +
+ (cardaddr & (PCIC_MEM_PAGESIZE - 1))) & ~(PCIC_MEM_PAGESIZE - 1);
+ cardaddr &= ~(PCIC_MEM_PAGESIZE - 1);
sc->mem[win].offset = cardaddr - sc->mem[win].addr;
pccbb_pcic_do_mem_map(sc, win);
OpenPOWER on IntegriCloud