📄 pci_cfg.h
字号:
#ifndef CYGONCE_PCI_CFG_H
#define CYGONCE_PCI_CFG_H
//=============================================================================
//
// pci_cfg.h
//
// PCI configuration definitions
//
//=============================================================================
//####COPYRIGHTBEGIN####
//
// -------------------------------------------
// The contents of this file are subject to the Red Hat eCos Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://www.redhat.com/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations under
// the License.
//
// The Original Code is eCos - Embedded Configurable Operating System,
// released September 30, 1998.
//
// The Initial Developer of the Original Code is Red Hat.
// Portions created by Red Hat are
// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
// All Rights Reserved.
// -------------------------------------------
//
//####COPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): jskov
// Contributors: jskov
// Date: 1999-08-09
// Purpose: Provides PCI configuration information
// (common structure layout & defined vendor/class codes)
// Usage:
// #include <cyg/io/pci_cfg.h>
//
//####DESCRIPTIONEND####
//
//=============================================================================
//----------------------------------------------------------------------
// PCI Configuration structure offsets
#define CYG_PCI_CFG_VENDOR 0x00
#define CYG_PCI_CFG_DEVICE 0x02
#define CYG_PCI_CFG_COMMAND 0x04
#define CYG_PCI_CFG_STATUS 0x06
#define CYG_PCI_CFG_CLASS_REV 0x08
#define CYG_PCI_CFG_CACHE_LINE_SIZE 0x0c
#define CYG_PCI_CFG_LATENCY_TIMER 0x0d
#define CYG_PCI_CFG_HEADER_TYPE 0x0e
#define CYG_PCI_CFG_BIST 0x0f
#define CYG_PCI_CFG_BAR_BASE 0x10
#define CYG_PCI_CFG_BAR_0 0x10
#define CYG_PCI_CFG_BAR_1 0x14
#define CYG_PCI_CFG_BAR_2 0x18
#define CYG_PCI_CFG_BAR_3 0x1c
#define CYG_PCI_CFG_BAR_4 0x20
#define CYG_PCI_CFG_BAR_5 0x24
#define CYG_PCI_CFG_CARDBUS_CIS 0x28
#define CYG_PCI_CFG_SUB_VENDOR 0x2c
#define CYG_PCI_CFG_SUB_ID 0x2e
#define CYG_PCI_CFG_ROM_ADDRESS 0x30
#define CYG_PCI_CFG_CAP_LIST 0x34
#define CYG_PCI_CFG_INT_LINE 0x3c
#define CYG_PCI_CFG_INT_PIN 0x3d
#define CYG_PCI_CFG_MIN_GNT 0x3e
#define CYG_PCI_CFG_MAX_LAT 0x3f
// Bridge configuration offsets
#define CYG_PCI_CFG_PRI_BUS 0x18
#define CYG_PCI_CFG_SEC_BUS 0x19
#define CYG_PCI_CFG_SUB_BUS 0x1a
#define CYG_PCI_CFG_SEC_LATENCY_TIMER 0x1b
#define CYG_PCI_CFG_IO_BASE 0x1c
#define CYG_PCI_CFG_IO_LIMIT 0x1d
#define CYG_PCI_CFG_SEC_STATUS 0x1e
#define CYG_PCI_CFG_MEM_BASE 0x20
#define CYG_PCI_CFG_MEM_LIMIT 0x22
#define CYG_PCI_CFG_PREFETCH_BASE 0x24
#define CYG_PCI_CFG_PREFETCH_LIMIT 0x26
#define CYG_PCI_CFG_PREFETCH_BASE_UPPER32 0x28
#define CYG_PCI_CFG_PREFETCH_LIMIT_UPPER32 0x2c
#define CYG_PCI_CFG_IO_BASE_UPPER16 0x30
#define CYG_PCI_CFG_IO_LIMIT_UPPER16 0x32
#define CYG_PCI_CFG_BRIDGE_ROM_ADDRESS 0x38
#define CYG_PCI_CFG_BRIDGE_CONTROL 0x3e
//-----------------------------------------------------------------
// PCI Control bits
// Command
#define CYG_PCI_CFG_COMMAND_IO 0x0001
#define CYG_PCI_CFG_COMMAND_MEMORY 0x0002
#define CYG_PCI_CFG_COMMAND_MASTER 0x0004
#define CYG_PCI_CFG_COMMAND_SPECIAL 0x0008
#define CYG_PCI_CFG_COMMAND_INVALIDATE 0x0010
#define CYG_PCI_CFG_COMMAND_VGA_SNOOP 0x0020
#define CYG_PCI_CFG_COMMAND_PARITY 0x0040
#define CYG_PCI_CFG_COMMAND_WAIT 0x0080
#define CYG_PCI_CFG_COMMAND_SERR 0x0100
#define CYG_PCI_CFG_COMMAND_FAST_BACK 0x0200
// Consider the device active if any of these bits are set.
#define CYG_PCI_CFG_COMMAND_ACTIVE \
(CYG_PCI_CFG_COMMAND_IO \
|CYG_PCI_CFG_COMMAND_MEMORY \
|CYG_PCI_CFG_COMMAND_MASTER)
// Header type
#define CYG_PCI_CFG_HEADER_TYPE_MASK 0x7f
#define CYG_PCI_CFG_HEADER_TYPE_MF 0x80
// BAR
#define CYG_PCI_CFG_BAR_SPACE_MASK 0x00000001
#define CYG_PCI_CFG_BAR_SPACE_MEM 0x00000000
#define CYG_PCI_CFG_BAR_SPACE_IO 0x00000001
#define CYG_PRI_CFG_BAR_MEM_TYPE_MASK 0x00000006
#define CYG_PRI_CFG_BAR_MEM_TYPE_32 0x00000000
#define CYG_PRI_CFG_BAR_MEM_TYPE_1M 0x00000002
#define CYG_PRI_CFG_BAR_MEM_TYPE_64 0x00000004
#define CYG_PRI_CFG_BAR_MEM_PREFETCH 0x00000008
#define CYG_PRI_CFG_BAR_MEM_MASK 0xfffffff0
#define CYG_PRI_CFG_BAR_IO_MASK 0xfffffffc
// Bridge control
#define CYG_PCI_CFG_BRIDGE_CTL_PARITY 0x0001
#define CYG_PCI_CFG_BRIDGE_CTL_SERR 0x0002
#define CYG_PCI_CFG_BRIDGE_CTL_ISA 0x0004
#define CYG_PCI_CFG_BRIDGE_CTL_VGA 0x0008
#define CYG_PCI_CFG_BRIDGE_CTL_MASTER 0x0020
#define CYG_PCI_CFG_BRIDGE_CTL_RESET 0x0040
#define CYG_PCI_CFG_BRIDGE_CTL_FAST_BACK 0x0080
//----------------------------------------------------------------------
// PCI Vendor IDs
/***********************************************************************
Can be extracted from the PCICODE List at http://www.yourvote.com/pci
maintained by Jib Boemler. Use the below Perl script and fix any
bad vendor names by hand.
#!/usr/bin/perl
while(<>) {
if (/PCI_VENTABLE/) {
%mvendors = {};
@vendors = ();
@codes = ();
while(<>) {
# Collect vendor names and codes.
if (m!.*0x([0-9A-F]{4}), \"([^\"]*)\".*!) {
$c = lc($1);
$v = uc($2);
$v =~ tr/-+ \/&.!/______ /;
$v =~ s/__/_/g;
$v =~ s/_$//;
push @vendors, $v;
push @codes, $c;
# Count occurences of vendor name.
$mvendors{$v} += 1;
}
last if (/;/);
}
# Ouput definitions.
while ($#vendors >= 0) {
$v = shift @vendors;
$c = shift @codes;
$o = "#define CYG_PCI_VENDOR_$v";
# If a vendor name occurs more than once, append code
# to get unique definitions.
if ($mvendors{$v} > 1) {
$o .= "_0x$c";
}
print $o . " " x (60-length($o)) . "0x$c\n";
}
}
}
***********************************************************************/
//---------------------- AUTO GENERATED START --------------------------
#define CYG_PCI_VENDOR_LOCKHEED_MARTIN 0x003d
#define CYG_PCI_VENDOR_COMPAQ_0x0e11 0x0e11
#define CYG_PCI_VENDOR_SYM 0x1000
#define CYG_PCI_VENDOR_ATI 0x1002
#define CYG_PCI_VENDOR_ULSI 0x1003
#define CYG_PCI_VENDOR_VLSI 0x1004
#define CYG_PCI_VENDOR_AVANCE_0x1005 0x1005
#define CYG_PCI_VENDOR_REPLY 0x1006
#define CYG_PCI_VENDOR_NETFRAME 0x1007
#define CYG_PCI_VENDOR_EPSON 0x1008
#define CYG_PCI_VENDOR_PHOENIX 0x100a
#define CYG_PCI_VENDOR_NSC 0x100b
#define CYG_PCI_VENDOR_TSENG_0x100c 0x100c
#define CYG_PCI_VENDOR_AST 0x100d
#define CYG_PCI_VENDOR_WEITEK 0x100e
#define CYG_PCI_VENDOR_VLOGIC 0x1010
#define CYG_PCI_VENDOR_DEC_0x1011 0x1011
#define CYG_PCI_VENDOR_MICRONICS 0x1012
#define CYG_PCI_VENDOR_CIRRUS 0x1013
#define CYG_PCI_VENDOR_IBM 0x1014
#define CYG_PCI_VENDOR_LSIL 0x1015
#define CYG_PCI_VENDOR_FUJITSU_ICL 0x1016
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -