Public Types | Public Member Functions

HostPci Class Reference

PCI helper functions for PCI drivers. More...

#include <hostpci.h>

Inheritance diagram for HostPci:
HostVfPci DirectPciDevice

List of all members.

Public Types

enum  {
  BAR0 = 4, MAX_BAR = 6, BAR_TYPE_MASK = 0x6, BAR_TYPE_32B = 0x0,
  BAR_TYPE_64B = 0x4, BAR_IO = 0x1, BAR_IO_MASK = 0xFFFFFFFCU, BAR_MEM_MASK = 0xFFFFFFF0U,
  CAP_MSI = 0x05U, CAP_MSIX = 0x11U, CAP_PCIE = 0x10U
}

Public Member Functions

unsigned conf_read (unsigned bdf, unsigned dword)
void conf_write (unsigned bdf, unsigned dword, unsigned value)
unsigned count_bars (unsigned bdf)
 Induce the number of the bars from the header-type.
unsigned search_device (unsigned theclass, unsigned subclass, unsigned instance)
 Searches for a given device and returns the bdf of it.
unsigned search_bridge (unsigned dst)
 Scan the PCI root bus for bridges.
unsigned get_gsi_msi (DBus< MessageHostOp > &bus_hostop, unsigned bdf, unsigned nr, void *msix_table=0)
 Program the nr-th MSI/MSI-X vector of the given device.
unsigned get_gsi (DBus< MessageHostOp > &bus_hostop, DBus< MessageAcpi > &bus_acpi, unsigned bdf, unsigned nr, bool level=false, void *msix_table=0)
 Returns the gsi and enables them.
unsigned find_cap (unsigned bdf, unsigned char id)
 Find the position of a legacy PCI capability.
unsigned find_extended_cap (unsigned bdf, unsigned short id)
 Find the position of an extended PCI capability.
unsigned long long bar_base (unsigned bdf, unsigned bar, unsigned *type=0)
 Get the base and the type of a bar.
unsigned long long bar_size (unsigned bdf, unsigned bar, bool *is64bit=0)
 Determines BAR size.
 HostPci (DBus< MessagePciConfig > &bus_pcicfg, DBus< MessageHostOp > &bus_hostop)

Detailed Description

PCI helper functions for PCI drivers.

Copyright (C) 2009-2010, Bernhard Kauer <bk@vmmon.org> Economic rights: Technische Universitaet Dresden (Germany)

This file is part of Vancouver.

Vancouver is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

Vancouver is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details. A helper for PCI config space access.


Member Enumeration Documentation

anonymous enum
Enumerator:
BAR0 
MAX_BAR 
BAR_TYPE_MASK 
BAR_TYPE_32B 
BAR_TYPE_64B 
BAR_IO 
BAR_IO_MASK 
BAR_MEM_MASK 
CAP_MSI 
CAP_MSIX 
CAP_PCIE 

Constructor & Destructor Documentation

HostPci::HostPci ( DBus< MessagePciConfig > &  bus_pcicfg,
DBus< MessageHostOp > &  bus_hostop 
) [inline]

Member Function Documentation

unsigned long long HostPci::bar_base ( unsigned  bdf,
unsigned  bar,
unsigned *  type = 0 
) [inline]

Get the base and the type of a bar.

unsigned long long HostPci::bar_size ( unsigned  bdf,
unsigned  bar,
bool *  is64bit = 0 
) [inline]

Determines BAR size.

You should probably disable interrupt delivery from this device, while querying BAR sizes.

unsigned HostPci::conf_read ( unsigned  bdf,
unsigned  dword 
) [inline]
void HostPci::conf_write ( unsigned  bdf,
unsigned  dword,
unsigned  value 
) [inline]
unsigned HostPci::count_bars ( unsigned  bdf  )  [inline]

Induce the number of the bars from the header-type.

unsigned HostPci::find_cap ( unsigned  bdf,
unsigned char  id 
) [inline]

Find the position of a legacy PCI capability.

unsigned HostPci::find_extended_cap ( unsigned  bdf,
unsigned short  id 
) [inline]

Find the position of an extended PCI capability.

unsigned HostPci::get_gsi ( DBus< MessageHostOp > &  bus_hostop,
DBus< MessageAcpi > &  bus_acpi,
unsigned  bdf,
unsigned  nr,
bool  level = false,
void *  msix_table = 0 
) [inline]

Returns the gsi and enables them.

unsigned HostPci::get_gsi_msi ( DBus< MessageHostOp > &  bus_hostop,
unsigned  bdf,
unsigned  nr,
void *  msix_table = 0 
) [inline]

Program the nr-th MSI/MSI-X vector of the given device.

unsigned HostPci::search_bridge ( unsigned  dst  )  [inline]

Scan the PCI root bus for bridges.

unsigned HostPci::search_device ( unsigned  theclass,
unsigned  subclass,
unsigned  instance 
) [inline]

Searches for a given device and returns the bdf of it.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines