59 DBG(
"phy(%d) read timeout : %d\n", phy,
reg);
88 DBG(
"phy(%d) write timeout : %d\n", phy,
reg);
184 u32 *mask,
u32 crc,
int fnr)
213 u32 crc = 0xCDCDCDCD;
283 DBG(
"Can not allocate transmit ring descriptors.\n");
294 DBG(
"Can not allocate transmit buffer info.\n");
378 DBG(
"Disable TX engine timeout.\n");
412 DBG(
"Allocate receive iob error.\n");
464 DBG(
"Can not allocate receive ring descriptors.\n");
475 DBG(
"Can not allocate receive buffer info.\n");
589 DBG(
"Disable RX engine timeout.\n");
645 while (rxring->
bufinf[i] &&
652 DBG2(
"Cleaning rx desc=%d, cnt=%d\n", i, desccnt);
655 for (j = i, ccnt = desccnt ; ccnt-- ; ) {
657 j = (j + 1) & (mask);
659 DBG(
"Dropped packet due to ");
661 DBG(
"long packet.(%d descriptors)\n", desccnt);
663 DBG(
"Packet error.\n");
669 i = (i + desccnt) & (mask);
686 (
addr[2] & 0xff) << 16 |
687 (
addr[1] & 0xff) << 8 |
712 DBG(
"Allocate receive resources error.\n");
721 DBG(
"Allocate transmit resources error.\n");
722 goto free_rx_resources_out;
731 free_rx_resources_out:
776 unsigned long int mapping;
780 DBG2(
"TX buffer address: %p(%08lx+%x)\n",
803 txring->
bufinf[idx] = iob;
824 DBG(
"TX ring full!\n");
834 DBG2(
"xmit: idx=%d\n", idx);
859 DBG(
"Waiting speed resolve timeout.\n");
929 DBG(
"Link is up at %d Mbps, %s-Duplex, MDI%s.\n",
941 DBG(
"Link is down.\n");
987 int i, cnt = 0,
max, err, mask;
997 DBG2(
"TX clean address: %08lx(%08lx+%zx)\n",
998 (
unsigned long)txbi->
data,
1014 DBG2(
"txclean: next %d\n", i);
1040 if (intrstat == ~((
typeof(intrstat))0))
1043 DBG2(
"intrstat 0x%08x\n", intrstat);
1045 DBG2(
"Link changed\n");
1064 DBG2(
"Packet transmit complete\n");
1070 DBG2(
"Packet received\n");
1096 DBG(
"jme interrupts %s\n", (enable ?
"enabled" :
"disabled"));
1145 DBG(
"eeprom reload timeout\n");
1157 unsigned char macaddr[6];
1161 macaddr[0] = (
val >> 0) & 0xFF;
1162 macaddr[1] = (
val >> 8) & 0xFF;
1163 macaddr[2] = (
val >> 16) & 0xFF;
1164 macaddr[3] = (
val >> 24) & 0xFF;
1166 macaddr[4] = (
val >> 0) & 0xFF;
1167 macaddr[5] = (
val >> 8) & 0xFF;
1196 DBG(
"Mapping PCI resource region error.\n");
1260 DBG(
"Reload eeprom for reading MAC Address error.\n");
1267 DBG(
"Register net_device error.\n");
1299 PCI_ROM(0x197b, 0x0250,
"jme",
"JMicron Gigabit Ethernet", 0),
1300 PCI_ROM(0x197b, 0x0260,
"jmfe",
"JMicron Fast Ethernet", 0),
#define EINVAL
Invalid argument.
unsigned long membase
Memory base.
struct arbelprm_rc_send_wqe rc
static void netdev_tx_complete(struct net_device *netdev, struct io_buffer *iobuf)
Complete network transmission.
#define iob_put(iobuf, len)
void netdev_rx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard received packet.
#define ADVERTISE_1000FULL
static void jme_set_phyfifoa(struct jme_adapter *jme)
static unsigned int unsigned int reg
#define WAKEUP_FRAME_MASK_DWNR
static void jwrite32(struct jme_adapter *jme, uint32_t reg, uint32_t val)
int(* open)(struct net_device *netdev)
Open network device.
static void jme_set_custom_macaddr(struct net_device *netdev)
static void jme_tx_clean(struct jme_adapter *jme)
static void jme_enable_tx_engine(struct jme_adapter *jme)
static void jme_reset_ghc_speed(struct jme_adapter *jme)
static void jme_restart_an(struct jme_adapter *jme)
int(* mdio_read)(struct net_device *dev, int phy_id, int location)
static void jme_disable_tx_engine(struct jme_adapter *jme)
static void jme_reset_phy_processor(struct jme_adapter *jme)
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct pci_device_id * ids
PCI ID table.
static void jme_phy_off(struct jme_adapter *jme)
static void jme_free_rx_buf(struct jme_adapter *jme, int i)
static void jme_set_multi(struct jme_adapter *jme)
static uint32_t jread32(struct jme_adapter *jme, uint32_t reg)
#define JME_TX_DISABLE_TIMEOUT
#define PCI_DEVICE_ID_JMICRON_JMC250
static int jme_alloc_tx_resources(struct jme_adapter *jme)
unsigned long long uint64_t
static void *__malloc malloc_phys(size_t size, size_t phys_align)
Allocate memory with specified physical alignment.
static void jme_disable_rx_engine(struct jme_adapter *jme)
static void jme_set_clean_rxdesc(struct jme_adapter *jme, int i)
void netdev_link_down(struct net_device *netdev)
Mark network device as having link down.
struct mii_if_info mii_if
struct rxdesc::@79::@82 descwb
struct io_buffer ** bufinf
void adjust_pci_device(struct pci_device *pci)
Enable PCI device.
struct io_buffer * alloc_iob(size_t len)
Allocate I/O buffer.
struct pci_driver jme_driver __pci_driver
#define PCI_DCSR_MRRS_MASK
struct device dev
Generic device.
static void jme_mdio_write(struct net_device *netdev, int phy, int reg, int val)
static int jme_make_new_rx_buf(struct io_buffer **rxbip)
Dynamic memory allocation.
static struct pci_device_id jm_nics[]
static void jme_load_macaddr(struct net_device *netdev)
static void netdev_init(struct net_device *netdev, struct net_device_operations *op)
Initialise a network device.
static void jme_irq(struct net_device *netdev, int enable)
Enable/disable interrupts.
static void pci_set_drvdata(struct pci_device *pci, void *priv)
Set PCI driver-private data.
static void jme_check_hw_ver(struct jme_adapter *jme)
static void jme_init_rx_ring(struct jme_adapter *jme)
#define ENOMEM
Not enough space.
static int jme_mdio_read(struct net_device *netdev, int phy, int reg)
static void jme_refill_rx_ring(struct jme_adapter *jme, int curhole)
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static __always_inline unsigned long virt_to_bus(volatile const void *addr)
Convert virtual address to a bus address.
uint16_t device
Device ID.
static int jme_probe(struct pci_device *pci)
Probe PCI device.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
unsigned int supports_gmii
void * priv
Driver private data.
#define JME_SPDRSV_TIMEOUT
static void netdev_link_up(struct net_device *netdev)
Mark network device as having link up.
void udelay(unsigned long usecs)
Delay for a fixed number of microseconds.
static void jme_process_receive(struct jme_adapter *jme)
static int netdev_link_ok(struct net_device *netdev)
Check link state of network device.
static struct net_device * netdev
static void jme_link_change(struct net_device *netdev)
void unregister_netdev(struct net_device *netdev)
Unregister network device.
#define cpu_to_le32(value)
static int jme_alloc_rx_resources(struct jme_adapter *jme)
static const uint32_t INTR_ENABLE
#define ADVERTISE_PAUSE_ASYM
static void(* free)(struct refcnt *refcnt))
static int jme_check_link(struct net_device *netdev, int testonly)
FILE_LICENCE(GPL2_OR_LATER)
int register_netdev(struct net_device *netdev)
Register network device.
static size_t iob_len(struct io_buffer *iobuf)
Calculate length of data in an I/O buffer.
static void jwrite32f(struct jme_adapter *jme, uint32_t reg, uint32_t val)
static void jme_free_rx_resources(struct jme_adapter *jme)
static uint32_t smi_reg_addr(int x)
#define EOVERFLOW
Value too large to be stored in data type.
void(* mdio_write)(struct net_device *dev, int phy_id, int location, int val)
static void netdev_nullify(struct net_device *netdev)
Stop using a network device.
#define ENOLINK
Link has been severed.
static void jme_reset_mac_processor(struct jme_adapter *jme)
#define JME_RX_DISABLE_TIMEOUT
struct txdesc::@74::@76 desc1
A PCI device ID list entry.
#define ADVERTISE_1000HALF
#define le16_to_cpu(value)
void * malloc(size_t size)
Allocate memory.
static void jme_setup_wakeup_frame(struct jme_adapter *jme, u32 *mask, u32 crc, int fnr)
static struct xen_remove_from_physmap * remove
Network device operations.
void netdev_rx(struct net_device *netdev, struct io_buffer *iobuf)
Add packet to receive queue.
struct device * dev
Underlying hardware device.
Network device management.
static int jme_reload_eeprom(struct jme_adapter *jme)
static void * pci_get_drvdata(struct pci_device *pci)
Get PCI driver-private data.
void mdelay(unsigned long msecs)
Delay for a fixed number of milliseconds.
static int jme_alloc_txdesc(struct jme_adapter *jme)
static void jme_alloc_and_feed_iob(struct jme_adapter *jme, int idx)
void netdev_tx_complete_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Complete network transmission.
static void jme_remove(struct pci_device *pci)
Remove PCI device.
Media Independent Interface constants.
int(* probe)(struct pci_device *pci)
Probe device.
void * data
Start of data.
#define EIO
Input/output error.
#define JME_EEPROM_RELOAD_TIMEOUT
struct net_device * alloc_etherdev(size_t priv_size)
Allocate Ethernet device.
static void jme_poll(struct net_device *netdev)
Poll for received packets.
#define cpu_to_le16(value)
static void jme_enable_rx_engine(struct jme_adapter *jme)
void iounmap(volatile const void *io_addr)
Unmap I/O address.
static void jme_free_tx_buffers(struct jme_adapter *jme)
static void free_phys(void *ptr, size_t size)
Free memory allocated with malloc_phys()
struct rxdesc::@79::@81 desc1
#define ADVERTISE_PAUSE_CAP
static uint32_t smi_phy_addr(int x)
static void jme_set_phyfifob(struct jme_adapter *jme)
typeof(acpi_finder=acpi_find)
ACPI table finder.
static void jme_close(struct net_device *netdev)
Close NIC.
uint8_t ll_addr[MAX_LL_ADDR_LEN]
Link-layer address.
static void jme_init_tx_ring(struct jme_adapter *jme)
static void jme_stop_irq(struct jme_adapter *jme)
static void jme_start_irq(struct jme_adapter *jme)
#define DBG(...)
Print a debugging message.
void * pci_ioremap(struct pci_device *pci, unsigned long bus_addr, size_t len)
Map PCI bus address as an I/O address.
static int jme_transmit(struct net_device *netdev, struct io_buffer *iobuf)
Transmit packet.
static void jme_restart_rx_engine(struct jme_adapter *jme)
uint8_t hw_addr[MAX_HW_ADDR_LEN]
Hardware address.
#define NULL
NULL pointer (VOID *)
#define PCI_ROM(_vendor, _device, _name, _description, _data)
static void jme_fill_tx_desc(struct jme_adapter *jme, struct io_buffer *iob, int idx)
struct txdesc::@74::@78 descwb
static int jme_open(struct net_device *netdev)
Open NIC.
static void jme_phy_init(struct jme_adapter *jme)
static int is_buggy250(unsigned short device, unsigned int chiprev)
static void jme_free_tx_resources(struct jme_adapter *jme)
void * memset(void *dest, int character, size_t len) __nonnull
static struct net_device_operations jme_operations
JME net device operations.
int pci_read_config_byte(struct pci_device *pci, unsigned int where, uint8_t *value)
Read byte from PCI configuration space.