////////////////////////////////////////////////////////////////
// File - pci_regs.h
//
// Copyright (c) 2003 - 2004 Jungo Ltd.  http://www.jungo.com
//
////////////////////////////////////////////////////////////////

#ifndef _PCI_REGS_H_
#define _PCI_REGS_H_

// PCI configuration registers definitions 
enum {
    PCI_IDR  = 0x00,  // 31:16 - device ID, 15:0 - vendor ID
    PCI_CR   = 0x04,  // command register
    PCI_SR   = 0x06,  // status register
    PCI_REV  = 0x08,  // revision ID
    PCI_CCR  = 0x09,  // prog interface
    PCI_CCSC = 0x0a,  // sub class code
    PCI_CCBC = 0x0b,  // base class code
    PCI_CLSR = 0x0c,  // cache line size
    PCI_LTR  = 0x0d,  // latency timer
    PCI_HTR  = 0x0e,  // header type
    PCI_BISTR= 0x0f,  // built-in self test
    PCI_BAR0 = 0x10,  // base address register
    PCI_BAR1 = 0x14,  // base address register
    PCI_BAR2 = 0x18,  // base address register
    PCI_BAR3 = 0x1c,  // base address register
    PCI_BAR4 = 0x20,  // base address register
    PCI_BAR5 = 0x24,  // base address register
    PCI_CIS  = 0x28,  // cardbus CIS pointer
    PCI_SVID = 0x2c,  // subsystem vendor ID
    PCI_SID  = 0x2e,  // subsystem ID
    PCI_ERBAR= 0x30,  // expansion ROM base address
    PCI_CAP  = 0x34,  // new capability pointer
    PCI_ILR  = 0x3c,  // interrupt line
    PCI_IPR  = 0x3d,  // interrupt pin
    PCI_MGR  = 0x3e,  // how long a burst period device needs
    PCI_MLR  = 0x3f   // how often device must gain access to PCI bus
};

#define PCI_CONFIG_SPACE_SIZE 0x100

enum {
    AD_PCI_BAR0 = 0,
    AD_PCI_BAR1 = 1,
    AD_PCI_BAR2 = 2,
    AD_PCI_BAR3 = 3,
    AD_PCI_BAR4 = 4,
    AD_PCI_BAR5 = 5,
    AD_PCI_BAR_EPROM = 6,
    AD_PCI_BARS = 7,
};

#endif
