Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3a185ec4
Commit
3a185ec4
authored
Jul 08, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/davem/net-2.5
into home.osdl.org:/home/torvalds/v2.5/linux
parents
e7d4d40e
b84c5126
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
230 additions
and
117 deletions
+230
-117
drivers/acpi/sleep/main.c
drivers/acpi/sleep/main.c
+1
-1
drivers/net/8139too.c
drivers/net/8139too.c
+1
-1
drivers/net/e1000/e1000.h
drivers/net/e1000/e1000.h
+0
-1
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000/e1000_ethtool.c
+3
-2
drivers/net/e1000/e1000_hw.c
drivers/net/e1000/e1000_hw.c
+53
-6
drivers/net/e1000/e1000_hw.h
drivers/net/e1000/e1000_hw.h
+18
-0
drivers/net/e1000/e1000_main.c
drivers/net/e1000/e1000_main.c
+98
-88
drivers/net/via-rhine.c
drivers/net/via-rhine.c
+25
-11
drivers/serial/core.c
drivers/serial/core.c
+2
-4
include/asm-generic/div64.h
include/asm-generic/div64.h
+3
-2
include/linux/compiler.h
include/linux/compiler.h
+18
-0
lib/div64.c
lib/div64.c
+8
-1
No files found.
drivers/acpi/sleep/main.c
View file @
3a185ec4
...
@@ -238,7 +238,7 @@ acpi_suspend (
...
@@ -238,7 +238,7 @@ acpi_suspend (
/* do we have a wakeup address for S2 and S3? */
/* do we have a wakeup address for S2 and S3? */
/* Here, we support only S4BIOS, those we set the wakeup address */
/* Here, we support only S4BIOS, those we set the wakeup address */
/* S4OS is only supported for now via swsusp.. */
/* S4OS is only supported for now via swsusp.. */
if
(
state
==
ACPI_STATE_S2
||
state
==
ACPI_STATE_S3
||
ACPI_STATE_S4
)
{
if
(
state
==
ACPI_STATE_S2
||
state
==
ACPI_STATE_S3
||
state
==
ACPI_STATE_S4
)
{
if
(
!
acpi_wakeup_address
)
if
(
!
acpi_wakeup_address
)
return
AE_ERROR
;
return
AE_ERROR
;
acpi_set_firmware_waking_vector
((
acpi_physical_address
)
acpi_wakeup_address
);
acpi_set_firmware_waking_vector
((
acpi_physical_address
)
acpi_wakeup_address
);
...
...
drivers/net/8139too.c
View file @
3a185ec4
...
@@ -2070,7 +2070,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
...
@@ -2070,7 +2070,7 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance,
RTL_W16
(
IntrStatus
,
ackstat
);
RTL_W16
(
IntrStatus
,
ackstat
);
DPRINTK
(
"%s: interrupt status=%#4.4x ackstat=%#4.4x new intstat=%#4.4x.
\n
"
,
DPRINTK
(
"%s: interrupt status=%#4.4x ackstat=%#4.4x new intstat=%#4.4x.
\n
"
,
dev
->
name
,
ackstat
,
status
,
RTL_R16
(
IntrStatus
));
dev
->
name
,
status
,
ackstat
,
RTL_R16
(
IntrStatus
));
if
(
netif_running
(
dev
)
&&
(
status
&
RxAckBits
))
if
(
netif_running
(
dev
)
&&
(
status
&
RxAckBits
))
rtl8139_rx_interrupt
(
dev
,
tp
,
ioaddr
);
rtl8139_rx_interrupt
(
dev
,
tp
,
ioaddr
);
...
...
drivers/net/e1000/e1000.h
View file @
3a185ec4
...
@@ -224,6 +224,5 @@ struct e1000_adapter {
...
@@ -224,6 +224,5 @@ struct e1000_adapter {
uint32_t
pci_state
[
16
];
uint32_t
pci_state
[
16
];
char
ifname
[
IFNAMSIZ
];
};
};
#endif
/* _E1000_H_ */
#endif
/* _E1000_H_ */
drivers/net/e1000/e1000_ethtool.c
View file @
3a185ec4
...
@@ -1112,8 +1112,9 @@ e1000_ethtool_test(struct e1000_adapter *adapter,
...
@@ -1112,8 +1112,9 @@ e1000_ethtool_test(struct e1000_adapter *adapter,
if
(
if_running
)
if
(
if_running
)
e1000_down
(
adapter
);
e1000_down
(
adapter
);
else
e1000_reset
(
adapter
);
e1000_reset
(
adapter
);
if
(
e1000_reg_test
(
adapter
,
&
data
[
0
]))
if
(
e1000_reg_test
(
adapter
,
&
data
[
0
]))
eth_test
->
flags
|=
ETH_TEST_FL_FAILED
;
eth_test
->
flags
|=
ETH_TEST_FL_FAILED
;
...
...
drivers/net/e1000/e1000_hw.c
View file @
3a185ec4
...
@@ -135,6 +135,41 @@ e1000_phy_init_script(struct e1000_hw *hw)
...
@@ -135,6 +135,41 @@ e1000_phy_init_script(struct e1000_hw *hw)
e1000_write_phy_reg
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
,
0x0000
);
e1000_write_phy_reg
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
,
0x0000
);
e1000_write_phy_reg
(
hw
,
0x0000
,
0x3300
);
e1000_write_phy_reg
(
hw
,
0x0000
,
0x3300
);
if
(
hw
->
mac_type
==
e1000_82547
)
{
uint16_t
fused
,
fine
,
coarse
;
/* Move to analog registers page */
e1000_write_phy_reg
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
,
IGP01E1000_ANALOG_REGS_PAGE
);
e1000_read_phy_reg
(
hw
,
IGP01E1000_ANALOG_SPARE_FUSE_STATUS
,
&
fused
);
if
(
!
(
fused
&
IGP01E1000_ANALOG_SPARE_FUSE_ENABLED
))
{
e1000_read_phy_reg
(
hw
,
IGP01E1000_ANALOG_FUSE_STATUS
,
&
fused
);
fine
=
fused
&
IGP01E1000_ANALOG_FUSE_FINE_MASK
;
coarse
=
fused
&
IGP01E1000_ANALOG_FUSE_COARSE_MASK
;
if
(
coarse
>
IGP01E1000_ANALOG_FUSE_COARSE_THRESH
)
{
coarse
-=
IGP01E1000_ANALOG_FUSE_COARSE_10
;
fine
-=
IGP01E1000_ANALOG_FUSE_FINE_1
;
}
else
if
(
coarse
==
IGP01E1000_ANALOG_FUSE_COARSE_THRESH
)
fine
-=
IGP01E1000_ANALOG_FUSE_FINE_10
;
fused
=
(
fused
&
IGP01E1000_ANALOG_FUSE_POLY_MASK
)
|
(
fine
&
IGP01E1000_ANALOG_FUSE_FINE_MASK
)
|
(
coarse
&
IGP01E1000_ANALOG_FUSE_COARSE_MASK
);
e1000_write_phy_reg
(
hw
,
IGP01E1000_ANALOG_FUSE_CONTROL
,
fused
);
e1000_write_phy_reg
(
hw
,
IGP01E1000_ANALOG_FUSE_BYPASS
,
IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL
);
}
/* Return to first page of registers */
e1000_write_phy_reg
(
hw
,
IGP01E1000_PHY_PAGE_SELECT
,
IGP01E1000_IEEE_REGS_PAGE
);
}
}
}
}
}
...
@@ -259,10 +294,20 @@ e1000_reset_hw(struct e1000_hw *hw)
...
@@ -259,10 +294,20 @@ e1000_reset_hw(struct e1000_hw *hw)
msec_delay
(
5
);
msec_delay
(
5
);
}
}
if
(
hw
->
mac_type
>
e1000_82543
)
switch
(
hw
->
mac_type
)
{
E1000_WRITE_REG_IO
(
hw
,
CTRL
,
(
ctrl
|
E1000_CTRL_RST
));
case
e1000_82544
:
else
case
e1000_82540
:
E1000_WRITE_REG
(
hw
,
CTRL
,
(
ctrl
|
E1000_CTRL_RST
));
case
e1000_82545
:
case
e1000_82546
:
case
e1000_82541
:
/* These controllers can't ack the 64-bit write when issuing the
* reset, so use IO-mapping as a workaround to issue the reset */
E1000_WRITE_REG_IO
(
hw
,
CTRL
,
(
ctrl
|
E1000_CTRL_RST
));
break
;
default:
E1000_WRITE_REG
(
hw
,
CTRL
,
(
ctrl
|
E1000_CTRL_RST
));
break
;
}
/* Force a reload from the EEPROM if necessary */
/* Force a reload from the EEPROM if necessary */
if
(
hw
->
mac_type
<
e1000_82540
)
{
if
(
hw
->
mac_type
<
e1000_82540
)
{
...
@@ -687,7 +732,8 @@ e1000_setup_fiber_link(struct e1000_hw *hw)
...
@@ -687,7 +732,8 @@ e1000_setup_fiber_link(struct e1000_hw *hw)
static
int32_t
static
int32_t
e1000_setup_copper_link
(
struct
e1000_hw
*
hw
)
e1000_setup_copper_link
(
struct
e1000_hw
*
hw
)
{
{
uint32_t
ctrl
,
led_ctrl
;
uint32_t
ctrl
;
uint32_t
led_ctrl
;
int32_t
ret_val
;
int32_t
ret_val
;
uint16_t
i
;
uint16_t
i
;
uint16_t
phy_data
;
uint16_t
phy_data
;
...
@@ -2249,7 +2295,8 @@ e1000_write_phy_reg(struct e1000_hw *hw,
...
@@ -2249,7 +2295,8 @@ e1000_write_phy_reg(struct e1000_hw *hw,
void
void
e1000_phy_hw_reset
(
struct
e1000_hw
*
hw
)
e1000_phy_hw_reset
(
struct
e1000_hw
*
hw
)
{
{
uint32_t
ctrl
,
ctrl_ext
,
led_ctrl
;
uint32_t
ctrl
,
ctrl_ext
;
uint32_t
led_ctrl
;
DEBUGFUNC
(
"e1000_phy_hw_reset"
);
DEBUGFUNC
(
"e1000_phy_hw_reset"
);
...
...
drivers/net/e1000/e1000_hw.h
View file @
3a185ec4
...
@@ -1668,6 +1668,7 @@ struct e1000_hw {
...
@@ -1668,6 +1668,7 @@ struct e1000_hw {
#define M88E1000_EXT_PHY_SPEC_CTRL 0x14
/* Extended PHY Specific Control */
#define M88E1000_EXT_PHY_SPEC_CTRL 0x14
/* Extended PHY Specific Control */
#define M88E1000_RX_ERR_CNTR 0x15
/* Receive Error Counter */
#define M88E1000_RX_ERR_CNTR 0x15
/* Receive Error Counter */
#define IGP01E1000_IEEE_REGS_PAGE 0x0000
/* IGP01E1000 Specific Registers */
/* IGP01E1000 Specific Registers */
#define IGP01E1000_PHY_PORT_CONFIG 0x10
/* PHY Specific Port Config Register */
#define IGP01E1000_PHY_PORT_CONFIG 0x10
/* PHY Specific Port Config Register */
#define IGP01E1000_PHY_PORT_STATUS 0x11
/* PHY Specific Status Register */
#define IGP01E1000_PHY_PORT_STATUS 0x11
/* PHY Specific Status Register */
...
@@ -1690,6 +1691,7 @@ struct e1000_hw {
...
@@ -1690,6 +1691,7 @@ struct e1000_hw {
* speed = 1000 Mbps. */
* speed = 1000 Mbps. */
#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4
#define IGP01E1000_PHY_PCS_INIT_REG 0x00B4
#define IGP01E1000_ANALOG_REGS_PAGE 0x20C0
#define MAX_PHY_REG_ADDRESS 0x1F
/* 5 bit address bus (0-0x1F) */
#define MAX_PHY_REG_ADDRESS 0x1F
/* 5 bit address bus (0-0x1F) */
...
@@ -1980,6 +1982,22 @@ uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] =
...
@@ -1980,6 +1982,22 @@ uint16_t e1000_igp_cable_length_table[IGP01E1000_AGC_LENGTH_TABLE_SIZE] =
#define IGP01E1000_GMII_FLEX_SPD 0x10
/* Enable flexible speed
#define IGP01E1000_GMII_FLEX_SPD 0x10
/* Enable flexible speed
* on Link-Up */
* on Link-Up */
#define IGP01E1000_GMII_SPD 0x20
/* Enable SPD */
#define IGP01E1000_GMII_SPD 0x20
/* Enable SPD */
/* IGP01E1000 Analog Register */
#define IGP01E1000_ANALOG_SPARE_FUSE_STATUS 0x0011
#define IGP01E1000_ANALOG_FUSE_STATUS 0x0010
#define IGP01E1000_ANALOG_FUSE_CONTROL 0x001C
#define IGP01E1000_ANALOG_FUSE_BYPASS 0x001E
#define IGP01E1000_ANALOG_FUSE_POLY_MASK 0xF000
#define IGP01E1000_ANALOG_FUSE_FINE_MASK 0x0F80
#define IGP01E1000_ANALOG_FUSE_COARSE_MASK 0x0070
#define IGP01E1000_ANALOG_SPARE_FUSE_ENABLED 0x0100
#define IGP01E1000_ANALOG_FUSE_ENABLE_SW_CONTROL 0x0002
#define IGP01E1000_ANALOG_FUSE_COARSE_THRESH 0x0040
#define IGP01E1000_ANALOG_FUSE_COARSE_10 0x0010
#define IGP01E1000_ANALOG_FUSE_FINE_1 0x0080
#define IGP01E1000_ANALOG_FUSE_FINE_10 0x0500
/* Bit definitions for valid PHY IDs. */
/* Bit definitions for valid PHY IDs. */
#define M88E1000_E_PHY_ID 0x01410C50
#define M88E1000_E_PHY_ID 0x01410C50
...
...
drivers/net/e1000/e1000_main.c
View file @
3a185ec4
This diff is collapsed.
Click to expand it.
drivers/net/via-rhine.c
View file @
3a185ec4
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
/*
/*
Written 1998-2001 by Donald Becker.
Written 1998-2001 by Donald Becker.
Current Maintainer: Roger Luethi <rl@hellgate.ch>
This software may be used and distributed according to the terms of
This software may be used and distributed according to the terms of
the GNU General Public License (GPL), incorporated herein by reference.
the GNU General Public License (GPL), incorporated herein by reference.
Drivers based on or derived from this code fall under the GPL and must
Drivers based on or derived from this code fall under the GPL and must
...
@@ -9,8 +11,9 @@
...
@@ -9,8 +11,9 @@
a complete program and may only be used when the entire operating
a complete program and may only be used when the entire operating
system is licensed under the GPL.
system is licensed under the GPL.
This driver is designed for the VIA VT86C100A Rhine-I.
This driver is designed for the VIA VT86C100A Rhine-I.
It also works with the 6102 Rhine-II, and 6105/6105M Rhine-III.
It also works with the Rhine-II (6102) and Rhine-III (6105/6105L/6105LOM
and management NIC 6105M).
The author may be reached as becker@scyld.com, or C/O
The author may be reached as becker@scyld.com, or C/O
Scyld Computing Corporation
Scyld Computing Corporation
...
@@ -115,11 +118,15 @@
...
@@ -115,11 +118,15 @@
- Force flushing for PCI posted writes
- Force flushing for PCI posted writes
- More reset code changes
- More reset code changes
LK1.1.18 (Roger Luethi)
- No filtering multicast in promisc mode (Edward Peng)
- Fix for Rhine-I Tx timeouts
*/
*/
#define DRV_NAME "via-rhine"
#define DRV_NAME "via-rhine"
#define DRV_VERSION "1.1.1
7
"
#define DRV_VERSION "1.1.1
8-2.5
"
#define DRV_RELDATE "
March-1
-2003"
#define DRV_RELDATE "
July-4
-2003"
/* A few user-configurable values.
/* A few user-configurable values.
...
@@ -386,17 +393,17 @@ static struct via_rhine_chip_info via_rhine_chip_info[] __devinitdata =
...
@@ -386,17 +393,17 @@ static struct via_rhine_chip_info via_rhine_chip_info[] __devinitdata =
{
"VIA VT6102 Rhine-II"
,
RHINE_IOTYPE
,
256
,
{
"VIA VT6102 Rhine-II"
,
RHINE_IOTYPE
,
256
,
CanHaveMII
|
HasWOL
},
CanHaveMII
|
HasWOL
},
{
"VIA VT6105 Rhine-III"
,
RHINE_IOTYPE
,
256
,
{
"VIA VT6105 Rhine-III"
,
RHINE_IOTYPE
,
256
,
CanHaveMII
|
HasWOL
},
CanHaveMII
|
HasWOL
},
{
"VIA VT6105M Rhine-III"
,
RHINE_IOTYPE
,
256
,
{
"VIA VT6105M Rhine-III"
,
RHINE_IOTYPE
,
256
,
CanHaveMII
|
HasWOL
},
CanHaveMII
|
HasWOL
},
};
};
static
struct
pci_device_id
via_rhine_pci_tbl
[]
__devinitdata
=
static
struct
pci_device_id
via_rhine_pci_tbl
[]
__devinitdata
=
{
{
{
0x1106
,
0x3043
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT86C100A
},
{
0x1106
,
0x3043
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT86C100A
},
{
0x1106
,
0x3065
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT6102
},
{
0x1106
,
0x3065
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT6102
},
{
0x1106
,
0x3106
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT6105
},
{
0x1106
,
0x3106
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT6105
},
/* 6105{,L,LOM} */
{
0x1106
,
0x3053
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT6105M
},
{
0x1106
,
0x3053
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
VT6105M
},
{
0
,}
/* terminate list */
{
0
,}
/* terminate list */
};
};
MODULE_DEVICE_TABLE
(
pci
,
via_rhine_pci_tbl
);
MODULE_DEVICE_TABLE
(
pci
,
via_rhine_pci_tbl
);
...
@@ -441,7 +448,7 @@ enum intr_status_bits {
...
@@ -441,7 +448,7 @@ enum intr_status_bits {
IntrRxWakeUp
=
0x8000
,
IntrRxWakeUp
=
0x8000
,
IntrNormalSummary
=
0x0003
,
IntrAbnormalSummary
=
0xC260
,
IntrNormalSummary
=
0x0003
,
IntrAbnormalSummary
=
0xC260
,
IntrTxDescRace
=
0x080000
,
/* mapped from IntrStatus2 */
IntrTxDescRace
=
0x080000
,
/* mapped from IntrStatus2 */
IntrTxErrSummary
=
0x08221
0
,
IntrTxErrSummary
=
0x08221
8
,
};
};
/* The Rx and Tx buffer descriptors. */
/* The Rx and Tx buffer descriptors. */
...
@@ -1655,11 +1662,18 @@ static void via_rhine_error(struct net_device *dev, int intr_status)
...
@@ -1655,11 +1662,18 @@ static void via_rhine_error(struct net_device *dev, int intr_status)
printk
(
KERN_INFO
"%s: Tx descriptor write-back race.
\n
"
,
printk
(
KERN_INFO
"%s: Tx descriptor write-back race.
\n
"
,
dev
->
name
);
dev
->
name
);
}
}
if
(
intr_status
&
(
IntrTxAborted
|
IntrTxUnderrun
|
IntrTxDescRace
))
if
((
intr_status
&
IntrTxError
)
&&
~
(
IntrTxAborted
|
IntrTxUnderrun
|
IntrTxDescRace
))
{
if
(
debug
>
2
)
printk
(
KERN_INFO
"%s: Unspecified error.
\n
"
,
dev
->
name
);
}
if
(
intr_status
&
(
IntrTxAborted
|
IntrTxUnderrun
|
IntrTxDescRace
|
IntrTxError
))
via_rhine_restart_tx
(
dev
);
via_rhine_restart_tx
(
dev
);
if
(
intr_status
&
~
(
IntrLinkChange
|
IntrStatsMax
|
IntrTxUnderrun
|
if
(
intr_status
&
~
(
IntrLinkChange
|
IntrStatsMax
|
IntrTxUnderrun
|
IntrTxError
|
IntrTxAborted
|
IntrNormalSummary
|
IntrTxError
|
IntrTxAborted
|
IntrNormalSummary
|
IntrTxDescRace
))
{
IntrTxDescRace
))
{
if
(
debug
>
1
)
if
(
debug
>
1
)
printk
(
KERN_ERR
"%s: Something Wicked happened! %8.8x.
\n
"
,
printk
(
KERN_ERR
"%s: Something Wicked happened! %8.8x.
\n
"
,
...
...
drivers/serial/core.c
View file @
3a185ec4
...
@@ -1490,8 +1490,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
...
@@ -1490,8 +1490,7 @@ uart_block_til_ready(struct file *filp, struct uart_state *state)
return
-
ERESTARTSYS
;
return
-
ERESTARTSYS
;
if
(
!
info
->
tty
||
tty_hung_up_p
(
filp
))
if
(
!
info
->
tty
||
tty_hung_up_p
(
filp
))
return
(
port
->
flags
&
UPF_HUP_NOTIFY
)
?
return
-
EAGAIN
;
-
EAGAIN
:
-
ERESTARTSYS
;
return
0
;
return
0
;
}
}
...
@@ -1596,8 +1595,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
...
@@ -1596,8 +1595,7 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
* If the port is in the middle of closing, bail out now.
* If the port is in the middle of closing, bail out now.
*/
*/
if
(
tty_hung_up_p
(
filp
))
{
if
(
tty_hung_up_p
(
filp
))
{
retval
=
(
state
->
port
->
flags
&
UPF_HUP_NOTIFY
)
?
retval
=
-
EAGAIN
;
-
EAGAIN
:
-
ERESTARTSYS
;
state
->
count
--
;
state
->
count
--
;
up
(
&
state
->
sem
);
up
(
&
state
->
sem
);
goto
fail
;
goto
fail
;
...
...
include/asm-generic/div64.h
View file @
3a185ec4
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
#include <linux/types.h>
#include <linux/types.h>
#include <linux/compiler.h>
#if BITS_PER_LONG == 64
#if BITS_PER_LONG == 64
...
@@ -31,12 +32,12 @@
...
@@ -31,12 +32,12 @@
#elif BITS_PER_LONG == 32
#elif BITS_PER_LONG == 32
extern
uint32_t
__div64_32
(
uint64_t
*
dividend
,
uint32_t
divisor
);
extern
uint32_t
__div64_32
(
uint64_t
*
dividend
,
uint32_t
divisor
)
__attribute_pure__
;
# define do_div(n,base) ({ \
# define do_div(n,base) ({ \
uint32_t __base = (base); \
uint32_t __base = (base); \
uint32_t __rem; \
uint32_t __rem; \
if (
((n) >> 32) == 0) {
\
if (
likely(((n) >> 32) == 0)) {
\
__rem = (uint32_t)(n) % __base; \
__rem = (uint32_t)(n) % __base; \
(n) = (uint32_t)(n) / __base; \
(n) = (uint32_t)(n) / __base; \
} else \
} else \
...
...
include/linux/compiler.h
View file @
3a185ec4
...
@@ -56,6 +56,24 @@
...
@@ -56,6 +56,24 @@
#define __attribute_used__ __attribute__((__unused__))
#define __attribute_used__ __attribute__((__unused__))
#endif
#endif
/*
* From the GCC manual:
*
* Many functions have no effects except the return value and their
* return value depends only on the parameters and/or global
* variables. Such a function can be subject to common subexpression
* elimination and loop optimization just as an arithmetic operator
* would be.
* [...]
* The attribute `pure' is not implemented in GCC versions earlier
* than 2.96.
*/
#if (__GNUC__ == 2 && __GNUC_MINOR >= 96) || __GNUC__ > 2
#define __attribute_pure__ __attribute__((pure))
#else
#define __attribute_pure__
/* unimplemented */
#endif
/* This macro obfuscates arithmetic on a variable address so that gcc
/* This macro obfuscates arithmetic on a variable address so that gcc
shouldn't recognize the original var, and make assumptions about it */
shouldn't recognize the original var, and make assumptions about it */
#define RELOC_HIDE(ptr, off) \
#define RELOC_HIDE(ptr, off) \
...
...
lib/div64.c
View file @
3a185ec4
...
@@ -12,13 +12,17 @@
...
@@ -12,13 +12,17 @@
* The fast case for (n>>32 == 0) is handled inline by do_div().
* The fast case for (n>>32 == 0) is handled inline by do_div().
*
*
* Code generated for this function might be very inefficient
* Code generated for this function might be very inefficient
* for some CPUs. div64_32() can be overridden by linking arch-specific
* for some CPUs.
__
div64_32() can be overridden by linking arch-specific
* assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S.
* assembly versions such as arch/ppc/lib/div64.S and arch/sh/lib/div64.S.
*/
*/
#include <linux/types.h>
#include <linux/types.h>
#include <linux/module.h>
#include <asm/div64.h>
#include <asm/div64.h>
/* Not needed on 64bit architectures */
#if BITS_PER_LONG == 32
uint32_t
__div64_32
(
uint64_t
*
n
,
uint32_t
base
)
uint32_t
__div64_32
(
uint64_t
*
n
,
uint32_t
base
)
{
{
uint32_t
low
,
low2
,
high
,
rem
;
uint32_t
low
,
low2
,
high
,
rem
;
...
@@ -43,3 +47,6 @@ uint32_t __div64_32(uint64_t *n, uint32_t base)
...
@@ -43,3 +47,6 @@ uint32_t __div64_32(uint64_t *n, uint32_t base)
return
rem
;
return
rem
;
}
}
EXPORT_SYMBOL
(
__div64_32
);
#endif
/* BITS_PER_LONG == 32 */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment