/* Ported to U-Boot by Christian Pellegrin Based on sources from the Linux kernel (pcnet_cs.c, 8390.h) and eCOS(if_dp83902a.c, if_dp83902a.h). Both of these 2 wonderful world are GPL, so this is, of course, GPL. ========================================================================== dev/dp83902a.h National Semiconductor DP83902a ethernet chip ========================================================================== ####ECOSGPLCOPYRIGHTBEGIN#### ------------------------------------------- This file is part of eCos, the Embedded Configurable Operating System. Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. eCos is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 or (at your option) any later version. eCos 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 for more details. You should have received a copy of the GNU General Public License along with eCos; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. As a special exception, if other files instantiate templates or use macros or inline functions from this file, or you compile this file and link it with other works to produce a work based on this file, this file does not by itself cause the resulting work to be covered by the GNU General Public License. However the source code for this file must still be made available in accordance with section (3) of the GNU General Public License. This exception does not invalidate any other reasons why a work based on this file might be covered by the GNU General Public License. Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. at http://sources.redhat.com/ecos/ecos-license/ ------------------------------------------- ####ECOSGPLCOPYRIGHTEND#### ####BSDCOPYRIGHTBEGIN#### ------------------------------------------- Portions of this software may have been derived from OpenBSD or other sources, and are covered by the appropriate copyright disclaimers included herein. ------------------------------------------- ####BSDCOPYRIGHTEND#### ========================================================================== #####DESCRIPTIONBEGIN#### Author(s): gthomas Contributors: gthomas, jskov Date: 2001-06-13 Purpose: Description: ####DESCRIPTIONEND#### ========================================================================== */ /* ------------------------------------------------------------------------ Macros for accessing DP registers These can be overridden by the platform header */ #ifndef __NE2000_BASE_H__ #define __NE2000_BASE_H__ /* * Debugging details * * Set to perms of: * 0 disables all debug output * 1 for process debug output * 2 for added data IO output: get_reg, put_reg * 4 for packet allocation/free output * 8 for only startup status, so we can tell we're installed OK */ #if 0 #define DEBUG 0xf #else #define DEBUG 0 #endif #if DEBUG & 1 #define DEBUG_FUNCTION() do { printf("%s\n", __FUNCTION__); } while (0) #define DEBUG_LINE() do { printf("%d\n", __LINE__); } while (0) #define PRINTK(args...) printf(args) #else #define DEBUG_FUNCTION() do {} while(0) #define DEBUG_LINE() do {} while(0) #define PRINTK(args...) #endif /* timeout for tx/rx in s */ #define TOUT 5 /* Ether MAC address size */ #define ETHER_ADDR_LEN 6 #define CYGHWR_NS_DP83902A_PLF_BROKEN_TX_DMA 1 #define CYGACC_CALL_IF_DELAY_US(X) udelay(X) /* H/W infomation struct */ typedef struct hw_info_t { u32 offset; u8 a0, a1, a2; u32 flags; } hw_info_t; typedef struct dp83902a_priv_data { u8* base; u8* data; u8* reset; int tx_next; /* First free Tx page */ int tx_int; /* Expecting interrupt from this buffer */ int rx_next; /* First free Rx page */ int tx1, tx2; /* Page numbers for Tx buffers */ u32 tx1_key, tx2_key; /* Used to ack when packet sent */ int tx1_len, tx2_len; bool tx_started, running, hardwired_esa; u8 esa[6]; void* plf_priv; /* Buffer allocation */ int tx_buf1, tx_buf2; int rx_buf_start, rx_buf_end; } dp83902a_priv_data_t; /* ------------------------------------------------------------------------ */ /* Register offsets */ #define DP_CR 0x00 #define DP_CLDA0 0x01 #define DP_PSTART 0x01 /* write */ #define DP_CLDA1 0x02 #define DP_PSTOP 0x02 /* write */ #define DP_BNDRY 0x03 #define DP_TSR 0x04 #define DP_TPSR 0x04 /* write */ #define DP_NCR 0x05 #define DP_TBCL 0x05 /* write */ #define DP_FIFO 0x06 #define DP_TBCH 0x06 /* write */ #define DP_ISR 0x07 #define DP_CRDA0 0x08 #define DP_RSAL 0x08 /* write */ #define DP_CRDA1 0x09 #define DP_RSAH 0#!/usr/bin/python -u import libvirt import sys import os if not os.access("/proc/xen", os.R_OK): print 'System is not running a Xen kernel' sys.exit(1) conn = libvirt.openReadOnly(None) if conn == None: print 'Failed to open connection to the hypervisor' sys.exit(1) try: (model, memory, cpus, mhz, nodes, socket, cores, threads) = conn.getInfo() except: print 'Failed to extract the current node informations' sys.exit(1) print "Xen running on %d %s processors at %d MHz, %d MBytes of memory" % ( cpus, model, mhz, memory) if cpus > nodes * socket * cores * threads: print "Erroneous CPU informations" sys.exit(1) if cpus < nodes * socket * cores * threads: print "Strange, running in degrated mode, some CPU are not available" del conn print "OK" sys.exit(0) DP_TCR_INLOOP 0x04 /* Full internal loopback */ #define DP_TCR_OUTLOOP 0x08 /* External loopback */ #define DP_TCR_ATD 0x10 /* Auto transmit disable */ #define DP_TCR_OFFSET 0x20 /* Collision offset adjust */ /* Transmit status register */ #define DP_TSR_TxP 0x01 /* Packet transmitted */ #define DP_TSR_COL 0x04 /* Collision (at least one) */ #define DP_TSR_ABT 0x08 /* Aborted because of too many collisions */ #define DP_TSR_CRS 0x10 /* Lost carrier */ #define DP_TSR_FU 0x20 /* FIFO underrun */ #define DP_TSR_CDH 0x40 /* Collision Detect Heartbeat */ #define DP_TSR_OWC 0x80 /* Collision outside normal window */ #define IEEE_8023_MAX_FRAME 1518 /* Largest possible ethernet frame */ #define IEEE_8023_MIN_FRAME 64 /* Smallest possible ethernet frame */ /* Functions */ int get_prom(u8* mac_addr, u8* base_addr); #endif /* __NE2000_BASE_H__ */