diff options
author | Amit S. Kale <amitkale@netxen.com> | 2006-11-29 12:00:10 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-12-02 00:16:36 -0500 |
commit | cb8011ad53e0855ef088e0e5a4bcb98fa90c70b6 (patch) | |
tree | 2ea32fc89dab2257b359a0577ae06c6565cc99d1 /drivers/net/netxen/netxen_nic.h | |
parent | edf901638144525a140c68be01be1b22e6041a6d (diff) |
[PATCH] NetXen: temp monitoring, newer firmware support, mm footprint reduction
NetXen: 1G/10G Ethernet Driver updates
- Temparature monitoring and device control
- Memory footprint reduction
- Driver changes to support newer version of firmware
Signed-off-by: Amit S. Kale <amitkale@netxen.com>
netxen_nic.h | 165 ++++++++++++++++++++++++++++++++--
netxen_nic_ethtool.c | 89 ++++++++++++------
netxen_nic_hdr.h | 71 +++++++++++++-
netxen_nic_hw.c | 206 +++++++++++++++++++++++++++++--------------
netxen_nic_hw.h | 8 +
netxen_nic_init.c | 239 +++++++++++++++++++++++++++++++++++++++++---------
netxen_nic_ioctl.h | 12 +-
netxen_nic_isr.c | 54 +++++------
netxen_nic_main.c | 121 +++++++++++++++++--------
netxen_nic_niu.c | 172 +++++++++++++++++++++++++++--------
netxen_nic_phan_reg.h | 24 ++++-
11 files changed, 891 insertions(+), 270 deletions(-)
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen/netxen_nic.h')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 165 |
1 files changed, 153 insertions, 12 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 0458db45e700..1bee560d7d0a 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -63,12 +63,12 @@ | |||
63 | 63 | ||
64 | #include "netxen_nic_hw.h" | 64 | #include "netxen_nic_hw.h" |
65 | 65 | ||
66 | #define NETXEN_NIC_BUILD_NO "232" | 66 | #define NETXEN_NIC_BUILD_NO "5" |
67 | #define _NETXEN_NIC_LINUX_MAJOR 2 | 67 | #define _NETXEN_NIC_LINUX_MAJOR 2 |
68 | #define _NETXEN_NIC_LINUX_MINOR 3 | 68 | #define _NETXEN_NIC_LINUX_MINOR 3 |
69 | #define _NETXEN_NIC_LINUX_SUBVERSION 57 | 69 | #define _NETXEN_NIC_LINUX_SUBVERSION 59 |
70 | #define NETXEN_NIC_LINUX_VERSIONID "2.3.57" | 70 | #define NETXEN_NIC_LINUX_VERSIONID "2.3.59" "-" NETXEN_NIC_BUILD_NO |
71 | #define NETXEN_NIC_FW_VERSIONID "2.3.57" | 71 | #define NETXEN_NIC_FW_VERSIONID "2.3.59" |
72 | 72 | ||
73 | #define RCV_DESC_RINGSIZE \ | 73 | #define RCV_DESC_RINGSIZE \ |
74 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) | 74 | (sizeof(struct rcv_desc) * adapter->max_rx_desc_count) |
@@ -89,9 +89,24 @@ | |||
89 | * normalize a 64MB crb address to 32MB PCI window | 89 | * normalize a 64MB crb address to 32MB PCI window |
90 | * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 | 90 | * To use NETXEN_CRB_NORMALIZE, window _must_ be set to 1 |
91 | */ | 91 | */ |
92 | #define NETXEN_CRB_NORMAL(reg) \ | ||
93 | (reg) - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST | ||
94 | |||
92 | #define NETXEN_CRB_NORMALIZE(adapter, reg) \ | 95 | #define NETXEN_CRB_NORMALIZE(adapter, reg) \ |
93 | ((adapter)->ahw.pci_base + (reg) \ | 96 | pci_base_offset(adapter, NETXEN_CRB_NORMAL(reg)) |
94 | - NETXEN_CRB_PCIX_HOST2 + NETXEN_CRB_PCIX_HOST) | 97 | |
98 | #define FIRST_PAGE_GROUP_START 0 | ||
99 | #define FIRST_PAGE_GROUP_END 0x400000 | ||
100 | |||
101 | #define SECOND_PAGE_GROUP_START 0x4000000 | ||
102 | #define SECOND_PAGE_GROUP_END 0x66BC000 | ||
103 | |||
104 | #define THIRD_PAGE_GROUP_START 0x70E4000 | ||
105 | #define THIRD_PAGE_GROUP_END 0x8000000 | ||
106 | |||
107 | #define FIRST_PAGE_GROUP_SIZE FIRST_PAGE_GROUP_END - FIRST_PAGE_GROUP_START | ||
108 | #define SECOND_PAGE_GROUP_SIZE SECOND_PAGE_GROUP_END - SECOND_PAGE_GROUP_START | ||
109 | #define THIRD_PAGE_GROUP_SIZE THIRD_PAGE_GROUP_END - THIRD_PAGE_GROUP_START | ||
95 | 110 | ||
96 | #define MAX_RX_BUFFER_LENGTH 2000 | 111 | #define MAX_RX_BUFFER_LENGTH 2000 |
97 | #define MAX_RX_JUMBO_BUFFER_LENGTH 9046 | 112 | #define MAX_RX_JUMBO_BUFFER_LENGTH 9046 |
@@ -328,6 +343,7 @@ typedef enum { | |||
328 | NETXEN_BRDTYPE_P2_SB31_10G_HMEZ = 0x000e, | 343 | NETXEN_BRDTYPE_P2_SB31_10G_HMEZ = 0x000e, |
329 | NETXEN_BRDTYPE_P2_SB31_10G_CX4 = 0x000f | 344 | NETXEN_BRDTYPE_P2_SB31_10G_CX4 = 0x000f |
330 | } netxen_brdtype_t; | 345 | } netxen_brdtype_t; |
346 | #define NUM_SUPPORTED_BOARDS (sizeof(netxen_boards)/sizeof(netxen_brdinfo_t)) | ||
331 | 347 | ||
332 | typedef enum { | 348 | typedef enum { |
333 | NETXEN_BRDMFG_INVENTEC = 1 | 349 | NETXEN_BRDMFG_INVENTEC = 1 |
@@ -615,15 +631,23 @@ struct netxen_rx_buffer { | |||
615 | */ | 631 | */ |
616 | struct netxen_hardware_context { | 632 | struct netxen_hardware_context { |
617 | struct pci_dev *pdev; | 633 | struct pci_dev *pdev; |
618 | void __iomem *pci_base; /* base of mapped phantom memory */ | 634 | void __iomem *pci_base0; |
635 | void __iomem *pci_base1; | ||
636 | void __iomem *pci_base2; | ||
637 | |||
619 | u8 revision_id; | 638 | u8 revision_id; |
620 | u16 board_type; | 639 | u16 board_type; |
621 | u16 max_ports; | 640 | u16 max_ports; |
622 | struct netxen_board_info boardcfg; | 641 | struct netxen_board_info boardcfg; |
623 | u32 xg_linkup; | 642 | u32 xg_linkup; |
643 | u32 qg_linksup; | ||
624 | /* Address of cmd ring in Phantom */ | 644 | /* Address of cmd ring in Phantom */ |
625 | struct cmd_desc_type0 *cmd_desc_head; | 645 | struct cmd_desc_type0 *cmd_desc_head; |
646 | char *pauseaddr; | ||
647 | struct pci_dev *cmd_desc_pdev; | ||
626 | dma_addr_t cmd_desc_phys_addr; | 648 | dma_addr_t cmd_desc_phys_addr; |
649 | dma_addr_t pause_physaddr; | ||
650 | struct pci_dev *pause_pdev; | ||
627 | struct netxen_adapter *adapter; | 651 | struct netxen_adapter *adapter; |
628 | }; | 652 | }; |
629 | 653 | ||
@@ -654,6 +678,7 @@ struct netxen_rcv_desc_ctx { | |||
654 | u32 rcv_pending; /* Num of bufs posted in phantom */ | 678 | u32 rcv_pending; /* Num of bufs posted in phantom */ |
655 | u32 rcv_free; /* Num of bufs in free list */ | 679 | u32 rcv_free; /* Num of bufs in free list */ |
656 | dma_addr_t phys_addr; | 680 | dma_addr_t phys_addr; |
681 | struct pci_dev *phys_pdev; | ||
657 | struct rcv_desc *desc_head; /* address of rx ring in Phantom */ | 682 | struct rcv_desc *desc_head; /* address of rx ring in Phantom */ |
658 | u32 max_rx_desc_count; | 683 | u32 max_rx_desc_count; |
659 | u32 dma_size; | 684 | u32 dma_size; |
@@ -673,6 +698,7 @@ struct netxen_recv_context { | |||
673 | u32 status_rx_producer; | 698 | u32 status_rx_producer; |
674 | u32 status_rx_consumer; | 699 | u32 status_rx_consumer; |
675 | dma_addr_t rcv_status_desc_phys_addr; | 700 | dma_addr_t rcv_status_desc_phys_addr; |
701 | struct pci_dev *rcv_status_desc_pdev; | ||
676 | struct status_desc *rcv_status_desc_head; | 702 | struct status_desc *rcv_status_desc_head; |
677 | }; | 703 | }; |
678 | 704 | ||
@@ -708,6 +734,7 @@ struct netxen_adapter { | |||
708 | u32 flags; | 734 | u32 flags; |
709 | u32 irq; | 735 | u32 irq; |
710 | int driver_mismatch; | 736 | int driver_mismatch; |
737 | u32 temp; | ||
711 | 738 | ||
712 | struct netxen_adapter_stats stats; | 739 | struct netxen_adapter_stats stats; |
713 | 740 | ||
@@ -766,6 +793,43 @@ struct netxen_port { | |||
766 | struct netxen_port_stats stats; | 793 | struct netxen_port_stats stats; |
767 | }; | 794 | }; |
768 | 795 | ||
796 | #define PCI_OFFSET_FIRST_RANGE(adapter, off) \ | ||
797 | ((adapter)->ahw.pci_base0 + (off)) | ||
798 | #define PCI_OFFSET_SECOND_RANGE(adapter, off) \ | ||
799 | ((adapter)->ahw.pci_base1 + (off) - SECOND_PAGE_GROUP_START) | ||
800 | #define PCI_OFFSET_THIRD_RANGE(adapter, off) \ | ||
801 | ((adapter)->ahw.pci_base2 + (off) - THIRD_PAGE_GROUP_START) | ||
802 | |||
803 | static inline void __iomem *pci_base_offset(struct netxen_adapter *adapter, | ||
804 | unsigned long off) | ||
805 | { | ||
806 | if ((off < FIRST_PAGE_GROUP_END) && (off >= FIRST_PAGE_GROUP_START)) { | ||
807 | return (adapter->ahw.pci_base0 + off); | ||
808 | } else if ((off < SECOND_PAGE_GROUP_END) && | ||
809 | (off >= SECOND_PAGE_GROUP_START)) { | ||
810 | return (adapter->ahw.pci_base1 + off - SECOND_PAGE_GROUP_START); | ||
811 | } else if ((off < THIRD_PAGE_GROUP_END) && | ||
812 | (off >= THIRD_PAGE_GROUP_START)) { | ||
813 | return (adapter->ahw.pci_base2 + off - THIRD_PAGE_GROUP_START); | ||
814 | } | ||
815 | return NULL; | ||
816 | } | ||
817 | |||
818 | static inline void __iomem *pci_base(struct netxen_adapter *adapter, | ||
819 | unsigned long off) | ||
820 | { | ||
821 | if ((off < FIRST_PAGE_GROUP_END) && (off >= FIRST_PAGE_GROUP_START)) { | ||
822 | return adapter->ahw.pci_base0; | ||
823 | } else if ((off < SECOND_PAGE_GROUP_END) && | ||
824 | (off >= SECOND_PAGE_GROUP_START)) { | ||
825 | return adapter->ahw.pci_base1; | ||
826 | } else if ((off < THIRD_PAGE_GROUP_END) && | ||
827 | (off >= THIRD_PAGE_GROUP_START)) { | ||
828 | return adapter->ahw.pci_base2; | ||
829 | } | ||
830 | return NULL; | ||
831 | } | ||
832 | |||
769 | struct netxen_drvops { | 833 | struct netxen_drvops { |
770 | int (*enable_phy_interrupts) (struct netxen_adapter *, int); | 834 | int (*enable_phy_interrupts) (struct netxen_adapter *, int); |
771 | int (*disable_phy_interrupts) (struct netxen_adapter *, int); | 835 | int (*disable_phy_interrupts) (struct netxen_adapter *, int); |
@@ -809,7 +873,6 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, long phy, | |||
809 | long reg, __le32 val); | 873 | long reg, __le32 val); |
810 | 874 | ||
811 | /* Functions available from netxen_nic_hw.c */ | 875 | /* Functions available from netxen_nic_hw.c */ |
812 | int netxen_niu_xginit(struct netxen_adapter *); | ||
813 | int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); | 876 | int netxen_nic_set_mtu_xgb(struct netxen_port *port, int new_mtu); |
814 | int netxen_nic_set_mtu_gb(struct netxen_port *port, int new_mtu); | 877 | int netxen_nic_set_mtu_gb(struct netxen_port *port, int new_mtu); |
815 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter); | 878 | void netxen_nic_init_niu_gb(struct netxen_adapter *adapter); |
@@ -828,10 +891,13 @@ void netxen_crb_writelit_adapter(struct netxen_adapter *adapter, | |||
828 | unsigned long off, int data); | 891 | unsigned long off, int data); |
829 | 892 | ||
830 | /* Functions from netxen_nic_init.c */ | 893 | /* Functions from netxen_nic_init.c */ |
831 | void netxen_phantom_init(struct netxen_adapter *adapter); | 894 | void netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); |
832 | void netxen_load_firmware(struct netxen_adapter *adapter); | 895 | void netxen_load_firmware(struct netxen_adapter *adapter); |
833 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); | 896 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); |
834 | int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp); | 897 | int netxen_rom_fast_read(struct netxen_adapter *adapter, int addr, int *valp); |
898 | int netxen_rom_fast_write(struct netxen_adapter *adapter, int addr, int data); | ||
899 | int netxen_rom_se(struct netxen_adapter *adapter, int addr); | ||
900 | int netxen_do_rom_se(struct netxen_adapter *adapter, int addr); | ||
835 | 901 | ||
836 | /* Functions from netxen_nic_isr.c */ | 902 | /* Functions from netxen_nic_isr.c */ |
837 | void netxen_nic_isr_other(struct netxen_adapter *adapter); | 903 | void netxen_nic_isr_other(struct netxen_adapter *adapter); |
@@ -842,6 +908,8 @@ void netxen_handle_port_int(struct netxen_adapter *adapter, u32 port, | |||
842 | void netxen_nic_stop_all_ports(struct netxen_adapter *adapter); | 908 | void netxen_nic_stop_all_ports(struct netxen_adapter *adapter); |
843 | void netxen_initialize_adapter_sw(struct netxen_adapter *adapter); | 909 | void netxen_initialize_adapter_sw(struct netxen_adapter *adapter); |
844 | void netxen_initialize_adapter_hw(struct netxen_adapter *adapter); | 910 | void netxen_initialize_adapter_hw(struct netxen_adapter *adapter); |
911 | void *netxen_alloc(struct pci_dev *pdev, size_t sz, dma_addr_t * ptr, | ||
912 | struct pci_dev **used_dev); | ||
845 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); | 913 | void netxen_initialize_adapter_ops(struct netxen_adapter *adapter); |
846 | int netxen_init_firmware(struct netxen_adapter *adapter); | 914 | int netxen_init_firmware(struct netxen_adapter *adapter); |
847 | void netxen_free_hw_resources(struct netxen_adapter *adapter); | 915 | void netxen_free_hw_resources(struct netxen_adapter *adapter); |
@@ -869,7 +937,10 @@ static inline void netxen_nic_disable_int(struct netxen_adapter *adapter) | |||
869 | /* | 937 | /* |
870 | * ISR_INT_MASK: Can be read from window 0 or 1. | 938 | * ISR_INT_MASK: Can be read from window 0 or 1. |
871 | */ | 939 | */ |
872 | writel(0x7ff, (void __iomem *)(adapter->ahw.pci_base + ISR_INT_MASK)); | 940 | writel(0x7ff, |
941 | (void __iomem | ||
942 | *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK))); | ||
943 | |||
873 | } | 944 | } |
874 | 945 | ||
875 | static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) | 946 | static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) |
@@ -888,13 +959,83 @@ static inline void netxen_nic_enable_int(struct netxen_adapter *adapter) | |||
888 | break; | 959 | break; |
889 | } | 960 | } |
890 | 961 | ||
891 | writel(mask, (void __iomem *)(adapter->ahw.pci_base + ISR_INT_MASK)); | 962 | writel(mask, |
963 | (void __iomem | ||
964 | *)(PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_MASK))); | ||
892 | 965 | ||
893 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { | 966 | if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) { |
894 | mask = 0xbff; | 967 | mask = 0xbff; |
895 | writel(mask, (void __iomem *) | 968 | writel(mask, (void __iomem *) |
896 | (adapter->ahw.pci_base + ISR_INT_TARGET_MASK)); | 969 | (PCI_OFFSET_SECOND_RANGE(adapter, ISR_INT_TARGET_MASK))); |
970 | } | ||
971 | } | ||
972 | |||
973 | /* | ||
974 | * NetXen Board information | ||
975 | */ | ||
976 | |||
977 | #define NETXEN_MAX_SHORT_NAME 16 | ||
978 | typedef struct { | ||
979 | netxen_brdtype_t brdtype; /* type of board */ | ||
980 | long ports; /* max no of physical ports */ | ||
981 | char short_name[NETXEN_MAX_SHORT_NAME]; | ||
982 | } netxen_brdinfo_t; | ||
983 | |||
984 | static const netxen_brdinfo_t netxen_boards[] = { | ||
985 | {NETXEN_BRDTYPE_P2_SB31_10G_CX4, 1, "XGb CX4"}, | ||
986 | {NETXEN_BRDTYPE_P2_SB31_10G_HMEZ, 1, "XGb HMEZ"}, | ||
987 | {NETXEN_BRDTYPE_P2_SB31_10G_IMEZ, 2, "XGb IMEZ"}, | ||
988 | {NETXEN_BRDTYPE_P2_SB31_10G, 1, "XGb XFP"}, | ||
989 | {NETXEN_BRDTYPE_P2_SB35_4G, 4, "Quad Gb"}, | ||
990 | {NETXEN_BRDTYPE_P2_SB31_2G, 2, "Dual Gb"}, | ||
991 | }; | ||
992 | |||
993 | #define NUM_SUPPORTED_BOARDS (sizeof(netxen_boards)/sizeof(netxen_brdinfo_t)) | ||
994 | |||
995 | static inline void get_brd_ports_name_by_type(u32 type, int *ports, char *name) | ||
996 | { | ||
997 | int i, found = 0; | ||
998 | for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { | ||
999 | if (netxen_boards[i].brdtype == type) { | ||
1000 | *ports = netxen_boards[i].ports; | ||
1001 | strcpy(name, netxen_boards[i].short_name); | ||
1002 | found = 1; | ||
1003 | break; | ||
1004 | } | ||
1005 | } | ||
1006 | if (!found) { | ||
1007 | *ports = 0; | ||
1008 | name = "Unknown"; | ||
1009 | } | ||
1010 | } | ||
1011 | |||
1012 | static inline void get_brd_port_by_type(u32 type, int *ports) | ||
1013 | { | ||
1014 | int i, found = 0; | ||
1015 | for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { | ||
1016 | if (netxen_boards[i].brdtype == type) { | ||
1017 | *ports = netxen_boards[i].ports; | ||
1018 | found = 1; | ||
1019 | break; | ||
1020 | } | ||
1021 | } | ||
1022 | if (!found) | ||
1023 | *ports = 0; | ||
1024 | } | ||
1025 | |||
1026 | static inline void get_brd_name_by_type(u32 type, char *name) | ||
1027 | { | ||
1028 | int i, found = 0; | ||
1029 | for (i = 0; i < NUM_SUPPORTED_BOARDS; ++i) { | ||
1030 | if (netxen_boards[i].brdtype == type) { | ||
1031 | strcpy(name, netxen_boards[i].short_name); | ||
1032 | found = 1; | ||
1033 | break; | ||
1034 | } | ||
1035 | |||
897 | } | 1036 | } |
1037 | if (!found) | ||
1038 | name = "Unknown"; | ||
898 | } | 1039 | } |
899 | 1040 | ||
900 | int netxen_is_flash_supported(struct netxen_adapter *adapter); | 1041 | int netxen_is_flash_supported(struct netxen_adapter *adapter); |