diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2007-01-02 05:39:10 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-01-31 04:59:08 -0500 |
commit | a608ab9cb6a5050394498b2520c6e7c162f4e2cf (patch) | |
tree | f22716ac7293bc77bab7fc48f4d8dbd0a2ecd57d /drivers/net/netxen/netxen_nic_niu.c | |
parent | f56df2f4db6e4af87fb8e941cff69f4501a111df (diff) |
netxen patches
Have fun.
>From 24f4a1a77431575a9cdfaae25adda85842099f70 Mon Sep 17 00:00:00 2001
From: Al Viro <viro@zeniv.linux.org.uk>
Date: Mon, 1 Jan 2007 15:22:56 -0500
Subject: [PATCH] netxen trivial annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_niu.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_niu.c | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/drivers/net/netxen/netxen_nic_niu.c b/drivers/net/netxen/netxen_nic_niu.c index 4987dc765d99..40d7003a371c 100644 --- a/drivers/net/netxen/netxen_nic_niu.c +++ b/drivers/net/netxen/netxen_nic_niu.c | |||
@@ -89,15 +89,15 @@ static inline int phy_unlock(struct netxen_adapter *adapter) | |||
89 | * | 89 | * |
90 | */ | 90 | */ |
91 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | 91 | int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, |
92 | long reg, __le32 * readval) | 92 | long reg, __u32 * readval) |
93 | { | 93 | { |
94 | long timeout = 0; | 94 | long timeout = 0; |
95 | long result = 0; | 95 | long result = 0; |
96 | long restore = 0; | 96 | long restore = 0; |
97 | __le32 address; | 97 | __u32 address; |
98 | __le32 command; | 98 | __u32 command; |
99 | __le32 status; | 99 | __u32 status; |
100 | __le32 mac_cfg0; | 100 | __u32 mac_cfg0; |
101 | 101 | ||
102 | if (phy_lock(adapter) != 0) { | 102 | if (phy_lock(adapter) != 0) { |
103 | return -1; | 103 | return -1; |
@@ -112,7 +112,7 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | |||
112 | &mac_cfg0, 4)) | 112 | &mac_cfg0, 4)) |
113 | return -EIO; | 113 | return -EIO; |
114 | if (netxen_gb_get_soft_reset(mac_cfg0)) { | 114 | if (netxen_gb_get_soft_reset(mac_cfg0)) { |
115 | __le32 temp; | 115 | __u32 temp; |
116 | temp = 0; | 116 | temp = 0; |
117 | netxen_gb_tx_reset_pb(temp); | 117 | netxen_gb_tx_reset_pb(temp); |
118 | netxen_gb_rx_reset_pb(temp); | 118 | netxen_gb_rx_reset_pb(temp); |
@@ -184,15 +184,15 @@ int netxen_niu_gbe_phy_read(struct netxen_adapter *adapter, long phy, | |||
184 | * | 184 | * |
185 | */ | 185 | */ |
186 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | 186 | int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, |
187 | long phy, long reg, __le32 val) | 187 | long phy, long reg, __u32 val) |
188 | { | 188 | { |
189 | long timeout = 0; | 189 | long timeout = 0; |
190 | long result = 0; | 190 | long result = 0; |
191 | long restore = 0; | 191 | long restore = 0; |
192 | __le32 address; | 192 | __u32 address; |
193 | __le32 command; | 193 | __u32 command; |
194 | __le32 status; | 194 | __u32 status; |
195 | __le32 mac_cfg0; | 195 | __u32 mac_cfg0; |
196 | 196 | ||
197 | /* | 197 | /* |
198 | * MII mgmt all goes through port 0 MAC interface, so it | 198 | * MII mgmt all goes through port 0 MAC interface, so it |
@@ -203,7 +203,7 @@ int netxen_niu_gbe_phy_write(struct netxen_adapter *adapter, | |||
203 | &mac_cfg0, 4)) | 203 | &mac_cfg0, 4)) |
204 | return -EIO; | 204 | return -EIO; |
205 | if (netxen_gb_get_soft_reset(mac_cfg0)) { | 205 | if (netxen_gb_get_soft_reset(mac_cfg0)) { |
206 | __le32 temp; | 206 | __u32 temp; |
207 | temp = 0; | 207 | temp = 0; |
208 | netxen_gb_tx_reset_pb(temp); | 208 | netxen_gb_tx_reset_pb(temp); |
209 | netxen_gb_rx_reset_pb(temp); | 209 | netxen_gb_rx_reset_pb(temp); |
@@ -269,7 +269,7 @@ int netxen_niu_gbe_enable_phy_interrupts(struct netxen_adapter *adapter, | |||
269 | int port) | 269 | int port) |
270 | { | 270 | { |
271 | int result = 0; | 271 | int result = 0; |
272 | __le32 enable = 0; | 272 | __u32 enable = 0; |
273 | netxen_set_phy_int_link_status_changed(enable); | 273 | netxen_set_phy_int_link_status_changed(enable); |
274 | netxen_set_phy_int_autoneg_completed(enable); | 274 | netxen_set_phy_int_autoneg_completed(enable); |
275 | netxen_set_phy_int_speed_changed(enable); | 275 | netxen_set_phy_int_speed_changed(enable); |
@@ -402,7 +402,7 @@ void netxen_niu_gbe_set_gmii_mode(struct netxen_adapter *adapter, | |||
402 | int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | 402 | int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) |
403 | { | 403 | { |
404 | int result = 0; | 404 | int result = 0; |
405 | __le32 status; | 405 | __u32 status; |
406 | if (adapter->disable_phy_interrupts) | 406 | if (adapter->disable_phy_interrupts) |
407 | adapter->disable_phy_interrupts(adapter, port); | 407 | adapter->disable_phy_interrupts(adapter, port); |
408 | mdelay(2); | 408 | mdelay(2); |
@@ -410,7 +410,7 @@ int netxen_niu_gbe_init_port(struct netxen_adapter *adapter, int port) | |||
410 | if (0 == | 410 | if (0 == |
411 | netxen_niu_gbe_phy_read(adapter, port, | 411 | netxen_niu_gbe_phy_read(adapter, port, |
412 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | 412 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, |
413 | (__le32 *) & status)) { | 413 | &status)) { |
414 | if (netxen_get_phy_link(status)) { | 414 | if (netxen_get_phy_link(status)) { |
415 | if (netxen_get_phy_speed(status) == 2) { | 415 | if (netxen_get_phy_speed(status) == 2) { |
416 | netxen_niu_gbe_set_gmii_mode(adapter, port, 1); | 416 | netxen_niu_gbe_set_gmii_mode(adapter, port, 1); |
@@ -489,7 +489,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
489 | int port, long enable) | 489 | int port, long enable) |
490 | { | 490 | { |
491 | int result = 0; | 491 | int result = 0; |
492 | __le32 int_src; | 492 | __u32 int_src; |
493 | 493 | ||
494 | printk(KERN_INFO PFX "NETXEN: Handling PHY interrupt on port %d" | 494 | printk(KERN_INFO PFX "NETXEN: Handling PHY interrupt on port %d" |
495 | " (device enable = %d)\n", (int)port, (int)enable); | 495 | " (device enable = %d)\n", (int)port, (int)enable); |
@@ -530,7 +530,7 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
530 | printk(KERN_INFO PFX "autoneg_error "); | 530 | printk(KERN_INFO PFX "autoneg_error "); |
531 | if ((netxen_get_phy_int_speed_changed(int_src)) | 531 | if ((netxen_get_phy_int_speed_changed(int_src)) |
532 | || (netxen_get_phy_int_link_status_changed(int_src))) { | 532 | || (netxen_get_phy_int_link_status_changed(int_src))) { |
533 | __le32 status; | 533 | __u32 status; |
534 | 534 | ||
535 | printk(KERN_INFO PFX | 535 | printk(KERN_INFO PFX |
536 | "speed_changed or link status changed"); | 536 | "speed_changed or link status changed"); |
@@ -583,9 +583,9 @@ int netxen_niu_gbe_handle_phy_interrupt(struct netxen_adapter *adapter, | |||
583 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, | 583 | int netxen_niu_macaddr_get(struct netxen_adapter *adapter, |
584 | int phy, netxen_ethernet_macaddr_t * addr) | 584 | int phy, netxen_ethernet_macaddr_t * addr) |
585 | { | 585 | { |
586 | u64 result = 0; | 586 | u32 stationhigh; |
587 | __le32 stationhigh; | 587 | u32 stationlow; |
588 | __le32 stationlow; | 588 | u8 val[8]; |
589 | 589 | ||
590 | if (addr == NULL) | 590 | if (addr == NULL) |
591 | return -EINVAL; | 591 | return -EINVAL; |
@@ -598,10 +598,10 @@ int netxen_niu_macaddr_get(struct netxen_adapter *adapter, | |||
598 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), | 598 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), |
599 | &stationlow, 4)) | 599 | &stationlow, 4)) |
600 | return -EIO; | 600 | return -EIO; |
601 | ((__le32 *)val)[1] = cpu_to_le32(stationhigh); | ||
602 | ((__le32 *)val)[0] = cpu_to_le32(stationlow); | ||
601 | 603 | ||
602 | result = (u64) netxen_gb_get_stationaddress_low(stationlow); | 604 | memcpy(addr, val + 2, 6); |
603 | result |= (u64) stationhigh << 16; | ||
604 | memcpy(*addr, &result, sizeof(netxen_ethernet_macaddr_t)); | ||
605 | 605 | ||
606 | return 0; | 606 | return 0; |
607 | } | 607 | } |
@@ -613,24 +613,25 @@ int netxen_niu_macaddr_get(struct netxen_adapter *adapter, | |||
613 | int netxen_niu_macaddr_set(struct netxen_port *port, | 613 | int netxen_niu_macaddr_set(struct netxen_port *port, |
614 | netxen_ethernet_macaddr_t addr) | 614 | netxen_ethernet_macaddr_t addr) |
615 | { | 615 | { |
616 | __le32 temp = 0; | 616 | u8 temp[4]; |
617 | u32 val; | ||
617 | struct netxen_adapter *adapter = port->adapter; | 618 | struct netxen_adapter *adapter = port->adapter; |
618 | int phy = port->portnum; | 619 | int phy = port->portnum; |
619 | unsigned char mac_addr[6]; | 620 | unsigned char mac_addr[6]; |
620 | int i; | 621 | int i; |
621 | 622 | ||
622 | for (i = 0; i < 10; i++) { | 623 | for (i = 0; i < 10; i++) { |
623 | memcpy(&temp, addr, 2); | 624 | temp[0] = temp[1] = 0; |
624 | temp <<= 16; | 625 | memcpy(temp + 2, addr, 2); |
626 | val = le32_to_cpu(*(__le32 *)temp); | ||
625 | if (netxen_nic_hw_write_wx | 627 | if (netxen_nic_hw_write_wx |
626 | (adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), &temp, 4)) | 628 | (adapter, NETXEN_NIU_GB_STATION_ADDR_1(phy), &val, 4)) |
627 | return -EIO; | 629 | return -EIO; |
628 | 630 | ||
629 | temp = 0; | 631 | memcpy(temp, ((u8 *) addr) + 2, sizeof(__le32)); |
630 | 632 | val = le32_to_cpu(*(__le32 *)temp); | |
631 | memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32)); | ||
632 | if (netxen_nic_hw_write_wx | 633 | if (netxen_nic_hw_write_wx |
633 | (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &temp, 4)) | 634 | (adapter, NETXEN_NIU_GB_STATION_ADDR_0(phy), &val, 4)) |
634 | return -2; | 635 | return -2; |
635 | 636 | ||
636 | netxen_niu_macaddr_get(adapter, phy, | 637 | netxen_niu_macaddr_get(adapter, phy, |
@@ -659,9 +660,9 @@ int netxen_niu_macaddr_set(struct netxen_port *port, | |||
659 | int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter, | 660 | int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter, |
660 | int port, netxen_niu_gbe_ifmode_t mode) | 661 | int port, netxen_niu_gbe_ifmode_t mode) |
661 | { | 662 | { |
662 | __le32 mac_cfg0; | 663 | __u32 mac_cfg0; |
663 | __le32 mac_cfg1; | 664 | __u32 mac_cfg1; |
664 | __le32 mii_cfg; | 665 | __u32 mii_cfg; |
665 | 666 | ||
666 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 667 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
667 | return -EINVAL; | 668 | return -EINVAL; |
@@ -736,7 +737,7 @@ int netxen_niu_enable_gbe_port(struct netxen_adapter *adapter, | |||
736 | /* Disable a GbE interface */ | 737 | /* Disable a GbE interface */ |
737 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port) | 738 | int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port) |
738 | { | 739 | { |
739 | __le32 mac_cfg0; | 740 | __u32 mac_cfg0; |
740 | 741 | ||
741 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 742 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
742 | return -EINVAL; | 743 | return -EINVAL; |
@@ -752,7 +753,7 @@ int netxen_niu_disable_gbe_port(struct netxen_adapter *adapter, int port) | |||
752 | /* Disable an XG interface */ | 753 | /* Disable an XG interface */ |
753 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port) | 754 | int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port) |
754 | { | 755 | { |
755 | __le32 mac_cfg; | 756 | __u32 mac_cfg; |
756 | 757 | ||
757 | if (port != 0) | 758 | if (port != 0) |
758 | return -EINVAL; | 759 | return -EINVAL; |
@@ -769,7 +770,7 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter, int port) | |||
769 | int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port, | 770 | int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port, |
770 | netxen_niu_prom_mode_t mode) | 771 | netxen_niu_prom_mode_t mode) |
771 | { | 772 | { |
772 | __le32 reg; | 773 | __u32 reg; |
773 | 774 | ||
774 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 775 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
775 | return -EINVAL; | 776 | return -EINVAL; |
@@ -826,22 +827,21 @@ int netxen_niu_set_promiscuous_mode(struct netxen_adapter *adapter, int port, | |||
826 | int netxen_niu_xg_macaddr_set(struct netxen_port *port, | 827 | int netxen_niu_xg_macaddr_set(struct netxen_port *port, |
827 | netxen_ethernet_macaddr_t addr) | 828 | netxen_ethernet_macaddr_t addr) |
828 | { | 829 | { |
829 | __le32 temp = 0; | 830 | u8 temp[4]; |
831 | u32 val; | ||
830 | struct netxen_adapter *adapter = port->adapter; | 832 | struct netxen_adapter *adapter = port->adapter; |
831 | 833 | ||
832 | memcpy(&temp, addr, 2); | 834 | temp[0] = temp[1] = 0; |
833 | temp = cpu_to_le32(temp); | 835 | memcpy(temp + 2, addr, 2); |
834 | temp <<= 16; | 836 | val = le32_to_cpu(*(__le32 *)temp); |
835 | if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1, | 837 | if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1, |
836 | &temp, 4)) | 838 | &val, 4)) |
837 | return -EIO; | 839 | return -EIO; |
838 | 840 | ||
839 | temp = 0; | ||
840 | |||
841 | memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32)); | 841 | memcpy(&temp, ((u8 *) addr) + 2, sizeof(__le32)); |
842 | temp = cpu_to_le32(temp); | 842 | val = le32_to_cpu(*(__le32 *)temp); |
843 | if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI, | 843 | if (netxen_nic_hw_write_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_HI, |
844 | &temp, 4)) | 844 | &val, 4)) |
845 | return -EIO; | 845 | return -EIO; |
846 | 846 | ||
847 | return 0; | 847 | return 0; |
@@ -854,9 +854,9 @@ int netxen_niu_xg_macaddr_set(struct netxen_port *port, | |||
854 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, | 854 | int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, |
855 | netxen_ethernet_macaddr_t * addr) | 855 | netxen_ethernet_macaddr_t * addr) |
856 | { | 856 | { |
857 | __le32 stationhigh; | 857 | u32 stationhigh; |
858 | __le32 stationlow; | 858 | u32 stationlow; |
859 | u64 result; | 859 | u8 val[8]; |
860 | 860 | ||
861 | if (addr == NULL) | 861 | if (addr == NULL) |
862 | return -EINVAL; | 862 | return -EINVAL; |
@@ -869,10 +869,10 @@ int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, | |||
869 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1, | 869 | if (netxen_nic_hw_read_wx(adapter, NETXEN_NIU_XGE_STATION_ADDR_0_1, |
870 | &stationlow, 4)) | 870 | &stationlow, 4)) |
871 | return -EIO; | 871 | return -EIO; |
872 | ((__le32 *)val)[1] = cpu_to_le32(stationhigh); | ||
873 | ((__le32 *)val)[0] = cpu_to_le32(stationlow); | ||
872 | 874 | ||
873 | result = ((u64) stationlow) >> 16; | 875 | memcpy(addr, val + 2, 6); |
874 | result |= (u64) stationhigh << 16; | ||
875 | memcpy(*addr, &result, sizeof(netxen_ethernet_macaddr_t)); | ||
876 | 876 | ||
877 | return 0; | 877 | return 0; |
878 | } | 878 | } |
@@ -880,7 +880,7 @@ int netxen_niu_xg_macaddr_get(struct netxen_adapter *adapter, int phy, | |||
880 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, | 880 | int netxen_niu_xg_set_promiscuous_mode(struct netxen_adapter *adapter, |
881 | int port, netxen_niu_prom_mode_t mode) | 881 | int port, netxen_niu_prom_mode_t mode) |
882 | { | 882 | { |
883 | __le32 reg; | 883 | __u32 reg; |
884 | 884 | ||
885 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) | 885 | if ((port < 0) || (port > NETXEN_NIU_MAX_GBE_PORTS)) |
886 | return -EINVAL; | 886 | return -EINVAL; |