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.
This commit is contained in:
Warner Losh 2001-01-07 08:08:54 +00:00
parent e93f5a3faa
commit 1bc96f7afd
3 changed files with 18 additions and 13 deletions

View File

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

View File

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

View File

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