static void rge_chip_peek_cfg(rge_t *rgep, rge_peekpoke_t *ppd) { uint64_t regval; uint64_t regno; RGE_TRACE(("rge_chip_peek_cfg($%p, $%p)", (void *)rgep, (void *)ppd)); regno = ppd->pp_acc_offset; switch (ppd->pp_acc_size) { case 1: regval = pci_config_get8(rgep->cfg_handle, regno); break; case 2: regval = pci_config_get16(rgep->cfg_handle, regno); break; case 4: regval = pci_config_get32(rgep->cfg_handle, regno); break; case 8: regval = pci_config_get64(rgep->cfg_handle, regno); break; } ppd->pp_acc_data = regval; }
/* * agp_target_get_aperbase() * * Description: * This function gets the AGP aperture base address from the AGP target * register, the AGP aperture base register was programmed by the BIOS. * * Arguments: * softstate driver soft state pointer * * Returns: * aper_base AGP aperture base address * * Notes: * If a 64bit bridge device is available, the AGP aperture base address * can be 64 bit. */ static uint64_t agp_target_get_apbase(agp_target_softstate_t *softstate) { uint64_t aper_base; if (!is_64bit_aper(softstate)) { aper_base = pci_config_get32(softstate->tsoft_pcihdl, AGP_CONF_APERBASE) & AGP_32_APERBASE_MASK; } else { aper_base = pci_config_get64(softstate->tsoft_pcihdl, AGP_CONF_APERBASE); /* 32-bit or 64-bit aperbase base pointer */ if ((aper_base & AGP_APER_TYPE_MASK) == 0) aper_base &= AGP_32_APERBASE_MASK; else aper_base &= AGP_64_APERBASE_MASK; } return (aper_base); }