⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sunhme.h

📁 powerpc内核mpc8241linux系统下net驱动程序
💻 H
📖 第 1 页 / 共 3 页
字号:
	struct happy_meal_txd happy_meal_txd[TX_RING_MAXSIZE];};#define hblock_offset(mem, elem) \((__u32)((unsigned long)(&(((struct hmeal_init_block *)0)->mem[elem]))))#define SUN4C_PKT_BUF_SZ	1546#define SUN4C_RX_BUFF_SIZE	SUN4C_PKT_BUF_SZ#define SUN4C_TX_BUFF_SIZE	SUN4C_PKT_BUF_SZstruct hmeal_buffers {	char	tx_buf[TX_RING_SIZE][SUN4C_TX_BUFF_SIZE];	char	rx_buf[RX_RING_SIZE][SUN4C_RX_BUFF_SIZE];};#define hbuf_offset(mem, elem) \((__u32)((unsigned long)(&(((struct hmeal_buffers *)0)->mem[elem][0]))))/* Now software state stuff. */enum happy_transceiver {	external = 0,	internal = 1,	none     = 2,};/* Timer state engine. */enum happy_timer_state {	arbwait  = 0,  /* Waiting for auto negotiation to complete.          */	lupwait  = 1,  /* Auto-neg complete, awaiting link-up status.        */	ltrywait = 2,  /* Forcing try of all modes, from fastest to slowest. */	asleep   = 3,  /* Time inactive.                                     */};struct quattro;/* Happy happy, joy joy! */struct happy_meal {	struct hmeal_gregs       *gregs;          /* Happy meal global registers       */	struct hmeal_etxregs     *etxregs;        /* External transmitter regs         */	struct hmeal_erxregs     *erxregs;        /* External receiver regs            */	struct hmeal_bigmacregs  *bigmacregs;     /* I said NO SOLARIS with my bigmac! */	struct hmeal_tcvregs     *tcvregs;        /* MIF transceiver regs              */	struct hmeal_init_block  *happy_block;    /* RX and TX descriptors (CPU addr)  */	__u32                     hblock_dvma;    /* DVMA visible address happy block  */	struct sk_buff           *rx_skbs[RX_RING_SIZE];	struct sk_buff           *tx_skbs[TX_RING_SIZE];	int rx_new, tx_new, rx_old, tx_old;	/* We may use this for Ultra as well, will have to see, maybe not. */	struct hmeal_buffers     *sun4c_buffers;  /* CPU visible address.              */#define	sun4d_buffers		  sun4c_buffers	  /* No need to make this a separate.  */	__u32                     s4c_buf_dvma;   /* DVMA visible address.             */	unsigned int              happy_flags;    /* Driver state flags                */	enum happy_transceiver    tcvr_type;      /* Kind of transceiver in use        */	unsigned int              happy_bursts;   /* Get your mind out of the gutter   */	unsigned int              paddr;          /* PHY address for transceiver       */	unsigned short            hm_revision;    /* Happy meal revision               */	unsigned short            sw_bmcr;        /* SW copy of BMCR                   */	unsigned short            sw_bmsr;        /* SW copy of BMSR                   */	unsigned short            sw_physid1;     /* SW copy of PHYSID1                */	unsigned short            sw_physid2;     /* SW copy of PHYSID2                */	unsigned short            sw_advertise;   /* SW copy of ADVERTISE              */	unsigned short            sw_lpa;         /* SW copy of LPA                    */	unsigned short            sw_expansion;   /* SW copy of EXPANSION              */	unsigned short            sw_csconfig;    /* SW copy of CSCONFIG               */	unsigned int              auto_speed;     /* Auto-nego link speed              */        unsigned int              forced_speed;   /* Force mode link speed             */	unsigned int              poll_data;      /* MIF poll data                     */	unsigned int              poll_flag;      /* MIF poll flag                     */	unsigned int              linkcheck;      /* Have we checked the link yet?     */	unsigned int              lnkup;          /* Is the link up as far as we know? */	unsigned int              lnkdown;        /* Trying to force the link down?    */	unsigned int              lnkcnt;         /* Counter for link-up attempts.     */	struct timer_list         happy_timer;    /* To watch the link when coming up. */	enum happy_timer_state    timer_state;    /* State of the auto-neg timer.      */	unsigned int              timer_ticks;    /* Number of clicks at each state.   */	struct net_device_stats	  net_stats;      /* Statistical counters              */	struct linux_sbus_device *happy_sbus_dev; /* ;-)                               */#ifdef CONFIG_PCI	struct pci_dev		 *happy_pci_dev;#endif	struct device            *dev;            /* Backpointer                       */	struct quattro		 *qfe_parent;	  /* For Quattro cards                 */	int			  qfe_ent;	  /* Which instance on quattro         */	struct happy_meal        *next_module;};/* Here are the happy flags. */#define HFLAG_POLL                0x00000001      /* We are doing MIF polling          */#define HFLAG_FENABLE             0x00000002      /* The MII frame is enabled          */#define HFLAG_LANCE               0x00000004      /* We are using lance-mode           */#define HFLAG_RXENABLE            0x00000008      /* Receiver is enabled               */#define HFLAG_AUTO                0x00000010      /* Using auto-negotiation, 0 = force */#define HFLAG_FULL                0x00000020      /* Full duplex enable                */#define HFLAG_MACFULL             0x00000040      /* Using full duplex in the MAC      */#define HFLAG_POLLENABLE          0x00000080      /* Actually try MIF polling          */#define HFLAG_RXCV                0x00000100      /* XXX RXCV ENABLE                   */#define HFLAG_INIT                0x00000200      /* Init called at least once         */#define HFLAG_LINKUP              0x00000400      /* 1 = Link is up                    */#define HFLAG_PCI                 0x00000800      /* PCI based Happy Meal              */#define HFLAG_QUATTRO		  0x00001000      /* On QFE/Quattro card	       */#define HFLAG_20_21  (HFLAG_POLLENABLE | HFLAG_FENABLE)#define HFLAG_NOT_A0 (HFLAG_POLLENABLE | HFLAG_FENABLE | HFLAG_LANCE | HFLAG_RXCV)/* Support for QFE/Quattro cards. */struct quattro {	volatile u32		 *irq_status[4];	struct device		 *happy_meals[4];	void (*handler)(int, void *, struct pt_regs *);	struct linux_sbus_device *quattro_sbus_dev;#ifdef CONFIG_PCI	struct pci_dev		 *quattro_pci_dev;#endif	struct quattro		 *next;	/* PROM ranges, if any. */	struct linux_prom_ranges  ranges[8];	int			  nranges;};/* We use this to acquire receive skb's that we can DMA directly into. */#define ALIGNED_RX_SKB_ADDR(addr) \        ((((unsigned long)(addr) + (64 - 1)) & ~(64 - 1)) - (unsigned long)(addr))static inline struct sk_buff *happy_meal_alloc_skb(unsigned int length, int gfp_flags){	struct sk_buff *skb;	skb = alloc_skb(length + 64, gfp_flags);	if(skb) {		int offset = ALIGNED_RX_SKB_ADDR(skb->data);		if(offset)			skb_reserve(skb, offset);	}	return skb;}/* Register/DMA access stuff, used to cope with differences between * PCI and SBUS happy meals. */extern inline u32 kva_to_hva(struct happy_meal *hp, char *addr){#ifdef CONFIG_PCI	if(hp->happy_flags & HFLAG_PCI)		return (u32) virt_to_bus((volatile void *)addr);	else#endif	{#ifdef __sparc_v9__		if (((unsigned long) addr) >= MAX_DMA_ADDRESS) {			printk("sunhme: Bogus DMA buffer address "			       "[%016lx]\n", ((unsigned long) addr));			panic("DMA address too large, tell DaveM");		}#endif		return sbus_dvma_addr(addr);	}}extern inline unsigned int hme_read32(struct happy_meal *hp,				      volatile unsigned int *reg){#ifdef CONFIG_PCI	if(hp->happy_flags & HFLAG_PCI)		return readl((unsigned long)reg);	else#endif		return *reg;}extern inline void hme_write32(struct happy_meal *hp,			       volatile unsigned int *reg,			       unsigned int val){#ifdef CONFIG_PCI	if(hp->happy_flags & HFLAG_PCI)		writel(val, (unsigned long)reg);	else#endif		*reg = val;}#ifdef CONFIG_PCI#ifdef __sparc_v9__extern inline void pcihme_write_rxd(struct happy_meal_rxd *rp,				    unsigned int flags,				    unsigned int addr){	__asm__ __volatile__("	stwa	%3, [%0] %2	stwa	%4, [%1] %2"	: /* no outputs */	: "r" (&rp->rx_addr), "r" (&rp->rx_flags),	  "i" (ASI_PL), "r" (addr), "r" (flags));}extern inline void pcihme_write_txd(struct happy_meal_txd *tp,				    unsigned int flags,				    unsigned int addr){	__asm__ __volatile__("	stwa	%3, [%0] %2	stwa	%4, [%1] %2"	: /* no outputs */	: "r" (&tp->tx_addr), "r" (&tp->tx_flags),	  "i" (ASI_PL), "r" (addr), "r" (flags));}#elseextern inline void pcihme_write_rxd(struct happy_meal_rxd *rp,				    unsigned int flags,				    unsigned int addr){	rp->rx_addr = flip_dword(addr);	rp->rx_flags = flip_dword(flags);}	extern inline void pcihme_write_txd(struct happy_meal_txd *tp,				    unsigned int flags,				    unsigned int addr){	tp->tx_addr = flip_dword(addr);	tp->tx_flags = flip_dword(flags);}	#endif  /* def __sparc_v9__ */#endif  /* def CONFIG_PCI */#endif /* !(_SUNHME_H) */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -