src/devices/bus/drivers/pci/bus.cc
// Maps a vmo as an mmio_buffer to be used as this Bus driver's ECAM region
// for config space access.
Maps a vmo as an mmio_buffer to be used as this Bus driver's ECAM region
for config space access.
Maps a vmo as an mmio_buffer to be used as this Bus driver ' s ECAM region for config space access .
zx_status_t Bus::MapEcam(void) {
  ZX_DEBUG_ASSERT(info_.ecam_vmo != ZX_HANDLE_INVALID);
  size_t size;
  zx_status_t status = zx_vmo_get_size(info_.ecam_vmo, &size);
  if (status != ZX_OK) {
    zxlogf(ERROR, "couldn't get ecam vmo size: %d!", status);
    return status;
  }
  status = ddk::MmioBuffer::Create(0, size, zx::vmo(info_.ecam_vmo),
                                   ZX_CACHE_POLICY_UNCACHED_DEVICE, &ecam_);
  if (status != ZX_OK) {
    zxlogf(ERROR, "couldn't map ecam vmo: %d!", status);
    return status;
  }
  zxlogf(INFO, "ecam for segment %u mapped at %p (size: %#zx)", info_.segment_group, ecam_->get(),
         ecam_->get_size());
  return ZX_OK;
}
zx_status_t Bus :: MapEcam ( void ) { ZX_DEBUG_ASSERT ( info_ . ecam_vmo != ZX_HANDLE_INVALID ) ; size_t size ; zx_status_t status = zx_vmo_get_size ( info_ . ecam_vmo , & size ) ; if ( status != ZX_OK ) { zxlogf ( ERROR , " " , status ) ; return status ; } status = ddk :: MmioBuffer :: Create ( 0 , size , zx :: vmo ( info_ . ecam_vmo ) , ZX_CACHE_POLICY_UNCACHED_DEVICE , & ecam_ ) ; if ( status != ZX_OK ) { zxlogf ( ERROR , " " , status ) ; return status ; } zxlogf ( INFO , " " , info_ . segment_group , ecam_ -> get ( ) , ecam_ -> get_size ( ) ) ; return ZX_OK ; }
Maps a vmo as an mmio_buffer to be used as this Bus driver's ECAM region
for config space access.
Maps a vmo as an mmio_buffer to be used as this Bus driver ' s ECAM region for config space access .