o Now that I've had time to test the new interface, reintegrate it back in.

o Fix OLDCARD to use the new interface.
o Rename the offsetp argument to deltap to more closely reflect what it
  is returning (it returns the delta from the requested value to the actual
  value).
o Remove duplicate $FreeBSD$ in pccbb.c
o Allow deltap to be NULL.
o Convert new isa pcic driver and add XXX comments that this function isn't
  actually implemented there (which means that NEWCARD pccard stuff won't
  work there until it is).
o Revert attempts to make old inferface work in NEWCARD.

Subitted by: peter (Parts of the new version code)
This commit is contained in:
imp 2001-01-07 16:31:09 +00:00
parent 23a68f11a9
commit 489dcd9d9c
8 changed files with 29 additions and 28 deletions

View File

@ -64,6 +64,7 @@ METHOD int set_memory_offset {
device_t child;
int rid;
u_int32_t cardaddr;
u_int32_t *deltap;
}
METHOD int get_memory_offset {

View File

@ -391,7 +391,6 @@ 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"));
@ -450,10 +449,7 @@ pccard_function_enable(struct pccard_function *pf)
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);
CARD_GET_MEMORY_OFFSET(device_get_parent(dev), dev,
pf->ccr_rid, &addr);
pf->pf_ccr_offset = pf->ccr_base - addr;
pf->ccr_rid, pf->ccr_base, &pf->pf_ccr_offset);
pf->pf_ccrt = rman_get_bustag(pf->ccr_res);
pf->pf_ccrh = rman_get_bushandle(pf->ccr_res);
pf->pf_ccr_realsize = 1;
@ -841,11 +837,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 offset, u_int32_t *deltap)
{
return CARD_SET_MEMORY_OFFSET(device_get_parent(dev), child, rid,
offset);
offset, deltap);
}
static int

View File

@ -98,11 +98,6 @@
#define PCIC_MASK2(SC,REG,MASK,MASK2) \
PCIC_WRITE(SC,REG,(PCIC_READ(SC,REG) MASK) MASK2)
#if !defined(lint)
static const char rcsid[] =
"$FreeBSD$";
#endif
struct pccbb_sclist {
struct pccbb_softc *sc;
STAILQ_ENTRY(pccbb_sclist) entries;
@ -242,7 +237,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 offset, u_int32_t *deltap);
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,11 +1701,12 @@ 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 cardaddr, u_int32_t *deltap)
{
struct pccbb_softc *sc = device_get_softc(self);
int win;
struct pccbb_reslist *rle;
u_int32_t delta;
win = -1;
@ -1726,11 +1722,14 @@ pccbb_pcic_set_memory_offset(device_t self, device_t child, int rid,
return 1;
}
/* 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);
delta = cardaddr % PCIC_MEM_PAGESIZE;
if (deltap)
*deltap = delta;
cardaddr -= delta;
sc->mem[win].realsize = sc->mem[win].size + delta +
PCIC_MEM_PAGESIZE - 1;
sc->mem[win].realsize = sc->mem[win].realsize -
(sc->mem[win].realsize % PCIC_MEM_PAGESIZE);
sc->mem[win].offset = cardaddr - sc->mem[win].addr;
pccbb_pcic_do_mem_map(sc, win);

View File

@ -1471,9 +1471,11 @@ pcic_set_res_flags(device_t dev, device_t child, int type, int rid,
}
int
pcic_set_memory_offset(device_t dev, device_t child, int rid, u_int32_t offset)
pcic_set_memory_offset(device_t dev, device_t child, int rid, u_int32_t offset,
u_int32_t *deltap)
{
return 0;
/* XXX BAD XXX */
return EIO;
}
static void

View File

@ -163,6 +163,6 @@ int pcic_disable_socket(device_t dev, device_t child);
int pcic_set_res_flags(device_t dev, device_t child, int type, int rid,
u_int32_t flags);
int pcic_set_memory_offset(device_t dev, device_t child, int rid,
u_int32_t offset);
u_int32_t offset, u_int32_t *deltap);
#define PCIC_SOFTC(d) (struct pcic_softc *) device_get_softc(d)

View File

@ -3366,7 +3366,7 @@ ray_res_alloc_am(struct ray_softc *sc)
RAY_PRINTF(sc, "fixing up AM card address from 0x%x to 0x0",
offset);
error = CARD_SET_MEMORY_OFFSET(device_get_parent(sc->dev),
sc->dev, sc->am_rid, 0);
sc->dev, sc->am_rid, 0, NULL);
if (error) {
RAY_PRINTF(sc, "CARD_SET_MEMORY_OFFSET returned 0x%0x",
error);
@ -3454,7 +3454,7 @@ ray_res_alloc_cm(struct ray_softc *sc)
RAY_PRINTF(sc, "fixing up CM card address from 0x%x to 0x0",
offset);
error = CARD_SET_MEMORY_OFFSET(device_get_parent(sc->dev),
sc->dev, sc->cm_rid, 0);
sc->dev, sc->cm_rid, 0, NULL);
if (error) {
RAY_PRINTF(sc, "CARD_SET_MEMORY_OFFSET returned 0x%0x",
error);

View File

@ -305,10 +305,10 @@ pccard_get_res_flags(device_t bus, device_t child, int restype, int rid,
static int
pccard_set_memory_offset(device_t bus, device_t child, int rid,
u_int32_t offset)
u_int32_t offset, u_int32_t *deltap)
{
return CARD_SET_MEMORY_OFFSET(device_get_parent(bus), child, rid,
offset);
offset, deltap);
}
static int

View File

@ -83,6 +83,7 @@ static struct pcic_slot {
static struct slot_ctrl cinfo;
static struct isa_pnp_id pcic_ids[] = {
{0x65374d24, NULL}, /* IBM3765 */
{PCIC_PNP_82365, NULL}, /* PNP0E00 */
{PCIC_PNP_CL_PD6720, NULL}, /* PNP0E01 */
{PCIC_PNP_VLSI_82C146, NULL}, /* PNP0E02 */
@ -977,13 +978,15 @@ pcic_get_res_flags(device_t bus, device_t child, int restype, int rid,
}
static int
pcic_set_memory_offset(device_t bus, device_t child, int rid, u_int32_t offset)
pcic_set_memory_offset(device_t bus, device_t child, int rid, u_int32_t offset,
u_int32_t *deltap)
{
struct pccard_devinfo *devi = device_get_ivars(child);
struct mem_desc *mp = &devi->slt->mem[rid];
mp->card = offset;
if (deltap)
*deltap = 0; /* XXX BAD XXX */
return (pcic_memory(devi->slt, rid));
}