Commit 313ef38b authored by David S. Miller's avatar David S. Miller

Merge nuts.davemloft.net:/disk1/BK/sparcwork-2.6

into nuts.davemloft.net:/disk1/BK/sparc-2.6
parents eeca3f34 8bf95585
...@@ -119,15 +119,15 @@ If a caller requires memory barrier semantics around an atomic_t ...@@ -119,15 +119,15 @@ If a caller requires memory barrier semantics around an atomic_t
operation which does not return a value, a set of interfaces are operation which does not return a value, a set of interfaces are
defined which accomplish this: defined which accomplish this:
void smb_mb__before_atomic_dec(void); void smp_mb__before_atomic_dec(void);
void smb_mb__after_atomic_dec(void); void smp_mb__after_atomic_dec(void);
void smb_mb__before_atomic_inc(void); void smp_mb__before_atomic_inc(void);
void smb_mb__after_atomic_dec(void); void smp_mb__after_atomic_dec(void);
For example, smb_mb__before_atomic_dec() can be used like so: For example, smp_mb__before_atomic_dec() can be used like so:
obj->dead = 1; obj->dead = 1;
smb_mb__before_atomic_dec(); smp_mb__before_atomic_dec();
atomic_dec(&obj->ref_count); atomic_dec(&obj->ref_count);
It makes sure that all memory operations preceeding the atomic_dec() It makes sure that all memory operations preceeding the atomic_dec()
...@@ -136,14 +136,14 @@ operation. In the above example, it guarentees that the assignment of ...@@ -136,14 +136,14 @@ operation. In the above example, it guarentees that the assignment of
"1" to obj->dead will be globally visible to other cpus before the "1" to obj->dead will be globally visible to other cpus before the
atomic counter decrement. atomic counter decrement.
Without the explicitl smb_mb__before_atomic_dec() call, the Without the explicitl smp_mb__before_atomic_dec() call, the
implementation could legally allow the atomic counter update visible implementation could legally allow the atomic counter update visible
to other cpus before the "obj->dead = 1;" assignment. to other cpus before the "obj->dead = 1;" assignment.
The other three interfaces listed are used to provide explicit The other three interfaces listed are used to provide explicit
ordering with respect to memory operations after an atomic_dec() call ordering with respect to memory operations after an atomic_dec() call
(smb_mb__after_atomic_dec()) and around atomic_inc() calls (smp_mb__after_atomic_dec()) and around atomic_inc() calls
(smb_mb__{before,after}_atomic_inc()). (smp_mb__{before,after}_atomic_inc()).
A missing memory barrier in the cases where they are required by the A missing memory barrier in the cases where they are required by the
atomic_t implementation above can have disasterous results. Here is atomic_t implementation above can have disasterous results. Here is
......
...@@ -975,60 +975,66 @@ int pcibios_assign_resource(struct pci_dev *pdev, int resource) ...@@ -975,60 +975,66 @@ int pcibios_assign_resource(struct pci_dev *pdev, int resource)
* We do not use horroble macroses here because we want to * We do not use horroble macroses here because we want to
* advance pointer by sizeof(size). * advance pointer by sizeof(size).
*/ */
void outsb(void * __iomem addr, const void *src, unsigned long count) { void outsb(unsigned long addr, const void *src, unsigned long count)
{
while (count) { while (count) {
count -= 1; count -= 1;
writeb(*(const char *)src, addr); outb(*(const char *)src, addr);
src += 1; src += 1;
addr += 1; /* addr += 1; */
} }
} }
void outsw(void * __iomem addr, const void *src, unsigned long count) { void outsw(unsigned long addr, const void *src, unsigned long count)
{
while (count) { while (count) {
count -= 2; count -= 2;
writew(*(const short *)src, addr); outw(*(const short *)src, addr);
src += 2; src += 2;
addr += 2; /* addr += 2; */
} }
} }
void outsl(void * __iomem addr, const void *src, unsigned long count) { void outsl(unsigned long addr, const void *src, unsigned long count)
{
while (count) { while (count) {
count -= 4; count -= 4;
writel(*(const long *)src, addr); outl(*(const long *)src, addr);
src += 4; src += 4;
addr += 4; /* addr += 4; */
} }
} }
void insb(void * __iomem addr, void *dst, unsigned long count) { void insb(unsigned long addr, void *dst, unsigned long count)
{
while (count) { while (count) {
count -= 1; count -= 1;
*(unsigned char *)dst = readb(addr); *(unsigned char *)dst = inb(addr);
dst += 1; dst += 1;
addr += 1; /* addr += 1; */
} }
} }
void insw(void * __iomem addr, void *dst, unsigned long count) { void insw(unsigned long addr, void *dst, unsigned long count)
{
while (count) { while (count) {
count -= 2; count -= 2;
*(unsigned short *)dst = readw(addr); *(unsigned short *)dst = inw(addr);
dst += 2; dst += 2;
addr += 2; /* addr += 2; */
} }
} }
void insl(void * __iomem addr, void *dst, unsigned long count) { void insl(unsigned long addr, void *dst, unsigned long count)
{
while (count) { while (count) {
count -= 4; count -= 4;
/* /*
* XXX I am sure we are in for an unaligned trap here. * XXX I am sure we are in for an unaligned trap here.
*/ */
*(unsigned long *)dst = readl(addr); *(unsigned long *)dst = inl(addr);
dst += 4; dst += 4;
addr += 4; /* addr += 4; */
} }
} }
......
...@@ -48,9 +48,9 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value) ...@@ -48,9 +48,9 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value)
} }
static void static void
pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long __user *addr)
{ {
if (put_user(value, (long __user *) addr)) { if (put_user(value, addr)) {
pt_error_return(regs, EFAULT); pt_error_return(regs, EFAULT);
return; return;
} }
...@@ -61,7 +61,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) ...@@ -61,7 +61,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
} }
static void static void
pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr) pt_os_succ_return (struct pt_regs *regs, unsigned long val, long __user *addr)
{ {
if (current->personality == PER_SUNOS) if (current->personality == PER_SUNOS)
pt_succ_return (regs, val); pt_succ_return (regs, val);
...@@ -71,7 +71,7 @@ pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr) ...@@ -71,7 +71,7 @@ pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr)
/* Fuck me gently with a chainsaw... */ /* Fuck me gently with a chainsaw... */
static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset, static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset,
struct task_struct *tsk, long *addr) struct task_struct *tsk, long __user *addr)
{ {
struct pt_regs *cregs = tsk->thread.kregs; struct pt_regs *cregs = tsk->thread.kregs;
struct thread_info *t = tsk->thread_info; struct thread_info *t = tsk->thread_info;
...@@ -345,14 +345,14 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -345,14 +345,14 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
if (access_process_vm(child, addr, if (access_process_vm(child, addr,
&tmp, sizeof(tmp), 0) == sizeof(tmp)) &tmp, sizeof(tmp), 0) == sizeof(tmp))
pt_os_succ_return(regs, tmp, (long *)data); pt_os_succ_return(regs, tmp, (long __user *)data);
else else
pt_error_return(regs, EIO); pt_error_return(regs, EIO);
goto out_tsk; goto out_tsk;
} }
case PTRACE_PEEKUSR: case PTRACE_PEEKUSR:
read_sunos_user(regs, addr, child, (long *) data); read_sunos_user(regs, addr, child, (long __user *) data);
goto out_tsk; goto out_tsk;
case PTRACE_POKEUSR: case PTRACE_POKEUSR:
......
...@@ -535,7 +535,7 @@ setup_frame(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *old ...@@ -535,7 +535,7 @@ setup_frame(struct sigaction *sa, struct pt_regs *regs, int signr, sigset_t *old
sig_address = NULL; sig_address = NULL;
} }
} }
err |= __put_user((long)sig_address, &sframep->sig_address); err |= __put_user((unsigned long)sig_address, &sframep->sig_address);
err |= __put_user(sig_code, &sframep->sig_code); err |= __put_user(sig_code, &sframep->sig_code);
err |= __put_user(sc, &sframep->sig_scptr); err |= __put_user(sc, &sframep->sig_scptr);
if (err) if (err)
...@@ -832,7 +832,7 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc, ...@@ -832,7 +832,7 @@ setup_svr4_frame(struct sigaction *sa, unsigned long pc, unsigned long npc,
* to flush the user windows. * to flush the user windows.
*/ */
for (window = 0; window < tp->w_saved; window++) { for (window = 0; window < tp->w_saved; window++) {
err |= __put_user((int *) &(gw->win[window]), &gw->winptr[window]); err |= __put_user((int __user *) &(gw->win[window]), &gw->winptr[window]);
err |= __copy_to_user(&gw->win[window], err |= __copy_to_user(&gw->win[window],
&tp->reg_window[window], &tp->reg_window[window],
sizeof(svr4_rwindow_t)); sizeof(svr4_rwindow_t));
......
...@@ -202,6 +202,10 @@ EXPORT_SYMBOL(sbus_ioremap); ...@@ -202,6 +202,10 @@ EXPORT_SYMBOL(sbus_ioremap);
#endif #endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
EXPORT_SYMBOL(ebus_chain); EXPORT_SYMBOL(ebus_chain);
EXPORT_SYMBOL(insb);
EXPORT_SYMBOL(outsb);
EXPORT_SYMBOL(insw);
EXPORT_SYMBOL(outsw);
EXPORT_SYMBOL(insl); EXPORT_SYMBOL(insl);
EXPORT_SYMBOL(outsl); EXPORT_SYMBOL(outsl);
EXPORT_SYMBOL(pci_alloc_consistent); EXPORT_SYMBOL(pci_alloc_consistent);
......
...@@ -197,8 +197,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user ...@@ -197,8 +197,7 @@ asmlinkage int sys_ipc (uint call, int first, int second, int third, void __user
goto out; goto out;
} }
case 1: /* iBCS2 emulator entry point */ case 1: /* iBCS2 emulator entry point */
err = do_shmat (first, (char __user *) ptr, err = -EINVAL;
second, (ulong *) third);
goto out; goto out;
} }
case SHMDT: case SHMDT:
......
...@@ -20,8 +20,9 @@ spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = { ...@@ -20,8 +20,9 @@ spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = {
#else /* SMP */ #else /* SMP */
static spinlock_t dummy = SPIN_LOCK_UNLOCKED;
#define ATOMIC_HASH_SIZE 1 #define ATOMIC_HASH_SIZE 1
#define ATOMIC_HASH(a) 0 #define ATOMIC_HASH(a) (&dummy)
#endif /* SMP */ #endif /* SMP */
......
...@@ -50,7 +50,7 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value) ...@@ -50,7 +50,7 @@ static inline void pt_succ_return(struct pt_regs *regs, unsigned long value)
} }
static inline void static inline void
pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) pt_succ_return_linux(struct pt_regs *regs, unsigned long value, void __user *addr)
{ {
if (test_thread_flag(TIF_32BIT)) { if (test_thread_flag(TIF_32BIT)) {
if (put_user(value, (unsigned int __user *) addr)) { if (put_user(value, (unsigned int __user *) addr)) {
...@@ -70,7 +70,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr) ...@@ -70,7 +70,7 @@ pt_succ_return_linux(struct pt_regs *regs, unsigned long value, long *addr)
} }
static void static void
pt_os_succ_return (struct pt_regs *regs, unsigned long val, long *addr) pt_os_succ_return (struct pt_regs *regs, unsigned long val, void __user *addr)
{ {
if (current->personality == PER_SUNOS) if (current->personality == PER_SUNOS)
pt_succ_return (regs, val); pt_succ_return (regs, val);
...@@ -226,7 +226,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) ...@@ -226,7 +226,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
if (res < 0) if (res < 0)
pt_error_return(regs, -res); pt_error_return(regs, -res);
else else
pt_os_succ_return(regs, tmp64, (long *) data); pt_os_succ_return(regs, tmp64, (void __user *) data);
goto flush_and_out; goto flush_and_out;
} }
......
...@@ -45,9 +45,9 @@ prom_sortmemlist(struct linux_mlist_p1275 *thislist) ...@@ -45,9 +45,9 @@ prom_sortmemlist(struct linux_mlist_p1275 *thislist)
unsigned long tmpaddr, tmpsize; unsigned long tmpaddr, tmpsize;
unsigned long lowest; unsigned long lowest;
for(i=0; thislist[i].theres_more != 0; i++) { for(i=0; thislist[i].theres_more; i++) {
lowest = thislist[i].start_adr; lowest = thislist[i].start_adr;
for(mitr = i+1; thislist[mitr-1].theres_more != 0; mitr++) for(mitr = i+1; thislist[mitr-1].theres_more; mitr++)
if(thislist[mitr].start_adr < lowest) { if(thislist[mitr].start_adr < lowest) {
lowest = thislist[mitr].start_adr; lowest = thislist[mitr].start_adr;
swapi = mitr; swapi = mitr;
...@@ -83,7 +83,7 @@ void __init prom_meminit(void) ...@@ -83,7 +83,7 @@ void __init prom_meminit(void)
prom_phys_avail[iter].theres_more = prom_phys_avail[iter].theres_more =
&prom_phys_avail[iter+1]; &prom_phys_avail[iter+1];
} }
prom_phys_avail[iter-1].theres_more = 0x0; prom_phys_avail[iter-1].theres_more = NULL;
num_regs = prom_getproperty(node, "reg", num_regs = prom_getproperty(node, "reg",
(char *) prom_reg_memlist, (char *) prom_reg_memlist,
...@@ -97,7 +97,7 @@ void __init prom_meminit(void) ...@@ -97,7 +97,7 @@ void __init prom_meminit(void)
prom_phys_total[iter].theres_more = prom_phys_total[iter].theres_more =
&prom_phys_total[iter+1]; &prom_phys_total[iter+1];
} }
prom_phys_total[iter-1].theres_more = 0x0; prom_phys_total[iter-1].theres_more = NULL;
node = prom_finddevice("/virtual-memory"); node = prom_finddevice("/virtual-memory");
num_regs = prom_getproperty(node, "available", num_regs = prom_getproperty(node, "available",
...@@ -116,7 +116,7 @@ void __init prom_meminit(void) ...@@ -116,7 +116,7 @@ void __init prom_meminit(void)
prom_prom_taken[iter].theres_more = prom_prom_taken[iter].theres_more =
&prom_prom_taken[iter+1]; &prom_prom_taken[iter+1];
} }
prom_prom_taken[iter-1].theres_more = 0x0; prom_prom_taken[iter-1].theres_more = NULL;
prom_sortmemlist(prom_prom_taken); prom_sortmemlist(prom_prom_taken);
......
...@@ -232,7 +232,8 @@ struct lance_init_block { ...@@ -232,7 +232,8 @@ struct lance_init_block {
struct lance_private { struct lance_private {
void __iomem *lregs; /* Lance RAP/RDP regs. */ void __iomem *lregs; /* Lance RAP/RDP regs. */
void __iomem *dregs; /* DMA controller regs. */ void __iomem *dregs; /* DMA controller regs. */
struct lance_init_block *init_block; struct lance_init_block __iomem *init_block_iomem;
struct lance_init_block *init_block_mem;
spinlock_t lock; spinlock_t lock;
...@@ -314,7 +315,7 @@ static void load_csrs(struct lance_private *lp) ...@@ -314,7 +315,7 @@ static void load_csrs(struct lance_private *lp)
static void lance_init_ring_dvma(struct net_device *dev) static void lance_init_ring_dvma(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block; struct lance_init_block *ib = lp->init_block_mem;
dma_addr_t aib = lp->init_block_dvma; dma_addr_t aib = lp->init_block_dvma;
__u32 leptr; __u32 leptr;
int i; int i;
...@@ -371,7 +372,7 @@ static void lance_init_ring_dvma(struct net_device *dev) ...@@ -371,7 +372,7 @@ static void lance_init_ring_dvma(struct net_device *dev)
static void lance_init_ring_pio(struct net_device *dev) static void lance_init_ring_pio(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block; struct lance_init_block __iomem *ib = lp->init_block_iomem;
u32 leptr; u32 leptr;
int i; int i;
...@@ -501,7 +502,7 @@ static int init_restart_lance(struct lance_private *lp) ...@@ -501,7 +502,7 @@ static int init_restart_lance(struct lance_private *lp)
static void lance_rx_dvma(struct net_device *dev) static void lance_rx_dvma(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block; struct lance_init_block *ib = lp->init_block_mem;
struct lance_rx_desc *rd; struct lance_rx_desc *rd;
u8 bits; u8 bits;
int len, entry = lp->rx_new; int len, entry = lp->rx_new;
...@@ -564,7 +565,7 @@ static void lance_rx_dvma(struct net_device *dev) ...@@ -564,7 +565,7 @@ static void lance_rx_dvma(struct net_device *dev)
static void lance_tx_dvma(struct net_device *dev) static void lance_tx_dvma(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block; struct lance_init_block *ib = lp->init_block_mem;
int i, j; int i, j;
spin_lock(&lp->lock); spin_lock(&lp->lock);
...@@ -674,8 +675,8 @@ static void lance_piocopy_to_skb(struct sk_buff *skb, void __iomem *piobuf, int ...@@ -674,8 +675,8 @@ static void lance_piocopy_to_skb(struct sk_buff *skb, void __iomem *piobuf, int
static void lance_rx_pio(struct net_device *dev) static void lance_rx_pio(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block; struct lance_init_block __iomem *ib = lp->init_block_iomem;
struct lance_rx_desc *rd; struct lance_rx_desc __iomem *rd;
unsigned char bits; unsigned char bits;
int len, entry; int len, entry;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -736,14 +737,14 @@ static void lance_rx_pio(struct net_device *dev) ...@@ -736,14 +737,14 @@ static void lance_rx_pio(struct net_device *dev)
static void lance_tx_pio(struct net_device *dev) static void lance_tx_pio(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block; struct lance_init_block __iomem *ib = lp->init_block_iomem;
int i, j; int i, j;
spin_lock(&lp->lock); spin_lock(&lp->lock);
j = lp->tx_old; j = lp->tx_old;
for (i = j; i != lp->tx_new; i = j) { for (i = j; i != lp->tx_new; i = j) {
struct lance_tx_desc *td = &ib->btx_ring [i]; struct lance_tx_desc __iomem *td = &ib->btx_ring [i];
u8 bits = sbus_readb(&td->tmd1_bits); u8 bits = sbus_readb(&td->tmd1_bits);
/* If we hit a packet not owned by us, stop */ /* If we hit a packet not owned by us, stop */
...@@ -880,15 +881,13 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -880,15 +881,13 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static void build_fake_packet(struct lance_private *lp) static void build_fake_packet(struct lance_private *lp)
{ {
struct net_device *dev = lp->dev; struct net_device *dev = lp->dev;
struct lance_init_block *ib = lp->init_block;
u16 *packet;
struct ethhdr *eth;
int i, entry; int i, entry;
entry = lp->tx_new & TX_RING_MOD_MASK; entry = lp->tx_new & TX_RING_MOD_MASK;
packet = (u16 *) &(ib->tx_buf[entry][0]);
eth = (struct ethhdr *) packet;
if (lp->pio_buffer) { if (lp->pio_buffer) {
struct lance_init_block __iomem *ib = lp->init_block_iomem;
u16 __iomem *packet = (u16 __iomem *) &(ib->tx_buf[entry][0]);
struct ethhdr __iomem *eth = (struct ethhdr __iomem *) packet;
for (i = 0; i < (ETH_ZLEN / sizeof(u16)); i++) for (i = 0; i < (ETH_ZLEN / sizeof(u16)); i++)
sbus_writew(0, &packet[i]); sbus_writew(0, &packet[i]);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
...@@ -899,6 +898,9 @@ static void build_fake_packet(struct lance_private *lp) ...@@ -899,6 +898,9 @@ static void build_fake_packet(struct lance_private *lp)
sbus_writew(0, &ib->btx_ring[entry].misc); sbus_writew(0, &ib->btx_ring[entry].misc);
sbus_writeb(LE_T1_POK|LE_T1_OWN, &ib->btx_ring[entry].tmd1_bits); sbus_writeb(LE_T1_POK|LE_T1_OWN, &ib->btx_ring[entry].tmd1_bits);
} else { } else {
struct lance_init_block *ib = lp->init_block_mem;
u16 *packet = (u16 *) &(ib->tx_buf[entry][0]);
struct ethhdr *eth = (struct ethhdr *) packet;
memset(packet, 0, ETH_ZLEN); memset(packet, 0, ETH_ZLEN);
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
eth->h_dest[i] = dev->dev_addr[i]; eth->h_dest[i] = dev->dev_addr[i];
...@@ -916,7 +918,6 @@ struct net_device *last_dev; ...@@ -916,7 +918,6 @@ struct net_device *last_dev;
static int lance_open(struct net_device *dev) static int lance_open(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block;
int status = 0; int status = 0;
last_dev = dev; last_dev = dev;
...@@ -943,10 +944,12 @@ static int lance_open(struct net_device *dev) ...@@ -943,10 +944,12 @@ static int lance_open(struct net_device *dev)
* BTW it is common bug in all lance drivers! --ANK * BTW it is common bug in all lance drivers! --ANK
*/ */
if (lp->pio_buffer) { if (lp->pio_buffer) {
struct lance_init_block __iomem *ib = lp->init_block_iomem;
sbus_writew(0, &ib->mode); sbus_writew(0, &ib->mode);
sbus_writel(0, &ib->filter[0]); sbus_writel(0, &ib->filter[0]);
sbus_writel(0, &ib->filter[1]); sbus_writel(0, &ib->filter[1]);
} else { } else {
struct lance_init_block *ib = lp->init_block_mem;
ib->mode = 0; ib->mode = 0;
ib->filter [0] = 0; ib->filter [0] = 0;
ib->filter [1] = 0; ib->filter [1] = 0;
...@@ -1113,7 +1116,6 @@ static void lance_tx_timeout(struct net_device *dev) ...@@ -1113,7 +1116,6 @@ static void lance_tx_timeout(struct net_device *dev)
static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block;
int entry, skblen, len; int entry, skblen, len;
skblen = skb->len; skblen = skb->len;
...@@ -1126,6 +1128,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1126,6 +1128,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
entry = lp->tx_new & TX_RING_MOD_MASK; entry = lp->tx_new & TX_RING_MOD_MASK;
if (lp->pio_buffer) { if (lp->pio_buffer) {
struct lance_init_block __iomem *ib = lp->init_block_iomem;
sbus_writew((-len) | 0xf000, &ib->btx_ring[entry].length); sbus_writew((-len) | 0xf000, &ib->btx_ring[entry].length);
sbus_writew(0, &ib->btx_ring[entry].misc); sbus_writew(0, &ib->btx_ring[entry].misc);
lance_piocopy_from_skb(&ib->tx_buf[entry][0], skb->data, skblen); lance_piocopy_from_skb(&ib->tx_buf[entry][0], skb->data, skblen);
...@@ -1133,6 +1136,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1133,6 +1136,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
lance_piozero(&ib->tx_buf[entry][skblen], len - skblen); lance_piozero(&ib->tx_buf[entry][skblen], len - skblen);
sbus_writeb(LE_T1_POK | LE_T1_OWN, &ib->btx_ring[entry].tmd1_bits); sbus_writeb(LE_T1_POK | LE_T1_OWN, &ib->btx_ring[entry].tmd1_bits);
} else { } else {
struct lance_init_block *ib = lp->init_block_mem;
ib->btx_ring [entry].length = (-len) | 0xf000; ib->btx_ring [entry].length = (-len) | 0xf000;
ib->btx_ring [entry].misc = 0; ib->btx_ring [entry].misc = 0;
memcpy((char *)&ib->tx_buf [entry][0], skb->data, skblen); memcpy((char *)&ib->tx_buf [entry][0], skb->data, skblen);
...@@ -1174,33 +1178,31 @@ static struct net_device_stats *lance_get_stats(struct net_device *dev) ...@@ -1174,33 +1178,31 @@ static struct net_device_stats *lance_get_stats(struct net_device *dev)
static void lance_load_multicast(struct net_device *dev) static void lance_load_multicast(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block;
u16 *mcast_table = (u16 *) &ib->filter;
struct dev_mc_list *dmi = dev->mc_list; struct dev_mc_list *dmi = dev->mc_list;
char *addrs; char *addrs;
int i; int i;
u32 crc; u32 crc;
u32 val;
/* set all multicast bits */ /* set all multicast bits */
if (dev->flags & IFF_ALLMULTI) { if (dev->flags & IFF_ALLMULTI)
if (lp->pio_buffer) { val = ~0;
sbus_writel(0xffffffff, &ib->filter[0]); else
sbus_writel(0xffffffff, &ib->filter[1]); val = 0;
} else {
ib->filter [0] = 0xffffffff;
ib->filter [1] = 0xffffffff;
}
return;
}
/* clear the multicast filter */
if (lp->pio_buffer) { if (lp->pio_buffer) {
sbus_writel(0, &ib->filter[0]); struct lance_init_block __iomem *ib = lp->init_block_iomem;
sbus_writel(0, &ib->filter[1]); sbus_writel(val, &ib->filter[0]);
sbus_writel(val, &ib->filter[1]);
} else { } else {
ib->filter [0] = 0; struct lance_init_block *ib = lp->init_block_mem;
ib->filter [1] = 0; ib->filter [0] = val;
ib->filter [1] = val;
} }
if (dev->flags & IFF_ALLMULTI)
return;
/* Add addresses */ /* Add addresses */
for (i = 0; i < dev->mc_count; i++) { for (i = 0; i < dev->mc_count; i++) {
addrs = dmi->dmi_addr; addrs = dmi->dmi_addr;
...@@ -1212,10 +1214,14 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -1212,10 +1214,14 @@ static void lance_load_multicast(struct net_device *dev)
crc = ether_crc_le(6, addrs); crc = ether_crc_le(6, addrs);
crc = crc >> 26; crc = crc >> 26;
if (lp->pio_buffer) { if (lp->pio_buffer) {
struct lance_init_block __iomem *ib = lp->init_block_iomem;
u16 __iomem *mcast_table = (u16 __iomem *) &ib->filter;
u16 tmp = sbus_readw(&mcast_table[crc>>4]); u16 tmp = sbus_readw(&mcast_table[crc>>4]);
tmp |= 1 << (crc & 0xf); tmp |= 1 << (crc & 0xf);
sbus_writew(tmp, &mcast_table[crc>>4]); sbus_writew(tmp, &mcast_table[crc>>4]);
} else { } else {
struct lance_init_block *ib = lp->init_block_mem;
u16 *mcast_table = (u16 *) &ib->filter;
mcast_table [crc >> 4] |= 1 << (crc & 0xf); mcast_table [crc >> 4] |= 1 << (crc & 0xf);
} }
} }
...@@ -1224,7 +1230,8 @@ static void lance_load_multicast(struct net_device *dev) ...@@ -1224,7 +1230,8 @@ static void lance_load_multicast(struct net_device *dev)
static void lance_set_multicast(struct net_device *dev) static void lance_set_multicast(struct net_device *dev)
{ {
struct lance_private *lp = netdev_priv(dev); struct lance_private *lp = netdev_priv(dev);
struct lance_init_block *ib = lp->init_block; struct lance_init_block *ib_mem = lp->init_block_mem;
struct lance_init_block __iomem *ib_iomem = lp->init_block_iomem;
u16 mode; u16 mode;
if (!netif_running(dev)) if (!netif_running(dev))
...@@ -1242,21 +1249,21 @@ static void lance_set_multicast(struct net_device *dev) ...@@ -1242,21 +1249,21 @@ static void lance_set_multicast(struct net_device *dev)
lp->init_ring(dev); lp->init_ring(dev);
if (lp->pio_buffer) if (lp->pio_buffer)
mode = sbus_readw(&ib->mode); mode = sbus_readw(&ib_iomem->mode);
else else
mode = ib->mode; mode = ib_mem->mode;
if (dev->flags & IFF_PROMISC) { if (dev->flags & IFF_PROMISC) {
mode |= LE_MO_PROM; mode |= LE_MO_PROM;
if (lp->pio_buffer) if (lp->pio_buffer)
sbus_writew(mode, &ib->mode); sbus_writew(mode, &ib_iomem->mode);
else else
ib->mode = mode; ib_mem->mode = mode;
} else { } else {
mode &= ~LE_MO_PROM; mode &= ~LE_MO_PROM;
if (lp->pio_buffer) if (lp->pio_buffer)
sbus_writew(mode, &ib->mode); sbus_writew(mode, &ib_iomem->mode);
else else
ib->mode = mode; ib_mem->mode = mode;
lance_load_multicast(dev); lance_load_multicast(dev);
} }
load_csrs(lp); load_csrs(lp);
...@@ -1275,16 +1282,14 @@ static void lance_free_hwresources(struct lance_private *lp) ...@@ -1275,16 +1282,14 @@ static void lance_free_hwresources(struct lance_private *lp)
{ {
if (lp->lregs) if (lp->lregs)
sbus_iounmap(lp->lregs, LANCE_REG_SIZE); sbus_iounmap(lp->lregs, LANCE_REG_SIZE);
if (lp->init_block != NULL) { if (lp->init_block_iomem) {
if (lp->pio_buffer) { sbus_iounmap(lp->init_block_iomem,
sbus_iounmap(lp->init_block, sizeof(struct lance_init_block));
sizeof(struct lance_init_block)); } else if (lp->init_block_mem) {
} else { sbus_free_consistent(lp->sdev,
sbus_free_consistent(lp->sdev, sizeof(struct lance_init_block),
sizeof(struct lance_init_block), lp->init_block_mem,
lp->init_block, lp->init_block_dvma);
lp->init_block_dvma);
}
} }
} }
...@@ -1326,6 +1331,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev, ...@@ -1326,6 +1331,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
return -ENOMEM; return -ENOMEM;
lp = netdev_priv(dev); lp = netdev_priv(dev);
memset(lp, 0, sizeof(*lp));
if (sparc_lance_debug && version_printed++ == 0) if (sparc_lance_debug && version_printed++ == 0)
printk (KERN_INFO "%s", version); printk (KERN_INFO "%s", version);
...@@ -1342,17 +1348,22 @@ static int __init sparc_lance_init(struct sbus_dev *sdev, ...@@ -1342,17 +1348,22 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
/* Get the IO region */ /* Get the IO region */
lp->lregs = sbus_ioremap(&sdev->resource[0], 0, lp->lregs = sbus_ioremap(&sdev->resource[0], 0,
LANCE_REG_SIZE, lancestr); LANCE_REG_SIZE, lancestr);
if (lp->lregs == 0UL) { if (!lp->lregs) {
printk(KERN_ERR "SunLance: Cannot map registers.\n"); printk(KERN_ERR "SunLance: Cannot map registers.\n");
goto fail; goto fail;
} }
lp->sdev = sdev; lp->sdev = sdev;
if (lebuffer) { if (lebuffer) {
lp->init_block = /* sanity check */
if (lebuffer->resource[0].start & 7) {
printk(KERN_ERR "SunLance: ERROR: Rx and Tx rings not on even boundary.\n");
goto fail;
}
lp->init_block_iomem =
sbus_ioremap(&lebuffer->resource[0], 0, sbus_ioremap(&lebuffer->resource[0], 0,
sizeof(struct lance_init_block), "lebuffer"); sizeof(struct lance_init_block), "lebuffer");
if (lp->init_block == NULL) { if (!lp->init_block_iomem) {
printk(KERN_ERR "SunLance: Cannot map PIO buffer.\n"); printk(KERN_ERR "SunLance: Cannot map PIO buffer.\n");
goto fail; goto fail;
} }
...@@ -1362,11 +1373,10 @@ static int __init sparc_lance_init(struct sbus_dev *sdev, ...@@ -1362,11 +1373,10 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
lp->rx = lance_rx_pio; lp->rx = lance_rx_pio;
lp->tx = lance_tx_pio; lp->tx = lance_tx_pio;
} else { } else {
lp->init_block = lp->init_block_mem =
sbus_alloc_consistent(sdev, sizeof(struct lance_init_block), sbus_alloc_consistent(sdev, sizeof(struct lance_init_block),
&lp->init_block_dvma); &lp->init_block_dvma);
if (lp->init_block == NULL || if (!lp->init_block_mem || lp->init_block_dvma == 0) {
lp->init_block_dvma == 0) {
printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n"); printk(KERN_ERR "SunLance: Cannot allocate consistent DMA memory.\n");
goto fail; goto fail;
} }
...@@ -1449,13 +1459,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev, ...@@ -1449,13 +1459,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
udelay(200); udelay(200);
sbus_writel(csr & ~DMA_RST_ENET, lp->dregs + DMA_CSR); sbus_writel(csr & ~DMA_RST_ENET, lp->dregs + DMA_CSR);
} else } else
lp->dregs = 0; lp->dregs = NULL;
/* This should never happen. */
if ((unsigned long)(lp->init_block->brx_ring) & 0x07) {
printk(KERN_ERR "SunLance: ERROR: Rx and Tx rings not on even boundary.\n");
goto fail;
}
lp->dev = dev; lp->dev = dev;
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
...@@ -1499,8 +1503,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev, ...@@ -1499,8 +1503,7 @@ static int __init sparc_lance_init(struct sbus_dev *sdev,
return 0; return 0;
fail: fail:
if (lp != NULL) lance_free_hwresources(lp);
lance_free_hwresources(lp);
free_netdev(dev); free_netdev(dev);
return -ENODEV; return -ENODEV;
} }
...@@ -1539,7 +1542,7 @@ static int __init sparc_lance_probe(void) ...@@ -1539,7 +1542,7 @@ static int __init sparc_lance_probe(void)
memset(&sdev, 0, sizeof(sdev)); memset(&sdev, 0, sizeof(sdev));
sdev.reg_addrs[0].phys_addr = sun4_eth_physaddr; sdev.reg_addrs[0].phys_addr = sun4_eth_physaddr;
sdev.irqs[0] = 6; sdev.irqs[0] = 6;
return sparc_lance_init(&sdev, 0, 0); return sparc_lance_init(&sdev, NULL, NULL);
} }
return -ENODEV; return -ENODEV;
} }
......
...@@ -61,7 +61,7 @@ csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len ...@@ -61,7 +61,7 @@ csum_partial_copy_nocheck (const unsigned char *src, unsigned char *dst, int len
} }
static inline unsigned int static inline unsigned int
csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int len, csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst, int len,
unsigned int sum, int *err) unsigned int sum, int *err)
{ {
if (!access_ok (VERIFY_READ, src, len)) { if (!access_ok (VERIFY_READ, src, len)) {
...@@ -69,7 +69,7 @@ csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int le ...@@ -69,7 +69,7 @@ csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, int le
memset (dst, 0, len); memset (dst, 0, len);
return sum; return sum;
} else { } else {
register unsigned int ret asm("o0") = (unsigned int)src; register unsigned long ret asm("o0") = (unsigned long)src;
register char *d asm("o1") = dst; register char *d asm("o1") = dst;
register int l asm("g1") = len; register int l asm("g1") = len;
register unsigned int s asm("g7") = sum; register unsigned int s asm("g7") = sum;
...@@ -98,8 +98,8 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i ...@@ -98,8 +98,8 @@ csum_partial_copy_to_user(const unsigned char *src, unsigned char __user *dst, i
*err = -EFAULT; *err = -EFAULT;
return sum; return sum;
} else { } else {
register unsigned int ret asm("o0") = (unsigned int)src; register unsigned long ret asm("o0") = (unsigned long)src;
register char *d asm("o1") = dst; register char __user *d asm("o1") = dst;
register int l asm("g1") = len; register int l asm("g1") = len;
register unsigned int s asm("g7") = sum; register unsigned int s asm("g7") = sum;
......
...@@ -88,11 +88,11 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ...@@ -88,11 +88,11 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
#define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \ #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \
do { unsigned long *dest = &(__elf_regs[0]); \ do { unsigned long *dest = &(__elf_regs[0]); \
struct pt_regs *src = (__pt_regs); \ struct pt_regs *src = (__pt_regs); \
unsigned long *sp; \ unsigned long __user *sp; \
memcpy(&dest[0], &src->u_regs[0], \ memcpy(&dest[0], &src->u_regs[0], \
sizeof(unsigned long) * 16); \ sizeof(unsigned long) * 16); \
/* Don't try this at home kids... */ \ /* Don't try this at home kids... */ \
sp = (unsigned long *) src->u_regs[14]; \ sp = (unsigned long __user *) src->u_regs[14]; \
copy_from_user(&dest[16], sp, \ copy_from_user(&dest[16], sp, \
sizeof(unsigned long) * 16); \ sizeof(unsigned long) * 16); \
dest[32] = src->psr; \ dest[32] = src->psr; \
......
...@@ -213,7 +213,7 @@ unsigned long pdma_size; ...@@ -213,7 +213,7 @@ unsigned long pdma_size;
volatile int doing_pdma = 0; volatile int doing_pdma = 0;
/* This is software state */ /* This is software state */
char *pdma_base = 0; char *pdma_base = NULL;
unsigned long pdma_areasize; unsigned long pdma_areasize;
/* Common routines to all controller types on the Sparc. */ /* Common routines to all controller types on the Sparc. */
......
...@@ -134,12 +134,12 @@ static inline void __writel(u32 l, volatile void __iomem *addr) ...@@ -134,12 +134,12 @@ static inline void __writel(u32 l, volatile void __iomem *addr)
#define inl_p(__addr) inl(__addr) #define inl_p(__addr) inl(__addr)
#define outl_p(__l, __addr) outl(__l, __addr) #define outl_p(__l, __addr) outl(__l, __addr)
void outsb(void * __iomem addr, const void *src, unsigned long cnt); void outsb(unsigned long addr, const void *src, unsigned long cnt);
void outsw(void * __iomem addr, const void *src, unsigned long cnt); void outsw(unsigned long addr, const void *src, unsigned long cnt);
void outsl(void * __iomem addr, const void *src, unsigned long cnt); void outsl(unsigned long addr, const void *src, unsigned long cnt);
void insb(void * __iomem addr, void *dst, unsigned long count); void insb(unsigned long addr, void *dst, unsigned long count);
void insw(void * __iomem addr, void *dst, unsigned long count); void insw(unsigned long addr, void *dst, unsigned long count);
void insl(void * __iomem addr, void *dst, unsigned long count); void insl(unsigned long addr, void *dst, unsigned long count);
#define IO_SPACE_LIMIT 0xffffffff #define IO_SPACE_LIMIT 0xffffffff
......
...@@ -49,7 +49,7 @@ typedef struct { ...@@ -49,7 +49,7 @@ typedef struct {
typedef struct { typedef struct {
int count; int count;
int *winptr [SVR4_MAXWIN]; /* pointer to the windows */ int __user *winptr [SVR4_MAXWIN]; /* pointer to the windows */
svr4_rwindow_t win[SVR4_MAXWIN]; /* the windows */ svr4_rwindow_t win[SVR4_MAXWIN]; /* the windows */
} svr4_gwindows_t; } svr4_gwindows_t;
...@@ -72,7 +72,7 @@ typedef struct { ...@@ -72,7 +72,7 @@ typedef struct {
/* Machine dependent context */ /* Machine dependent context */
typedef struct { typedef struct {
svr4_gregset_t greg; /* registers 0..19 (see top) */ svr4_gregset_t greg; /* registers 0..19 (see top) */
svr4_gwindows_t *gwin; /* may point to register windows */ svr4_gwindows_t __user *gwin; /* may point to register windows */
svr4_fregset_t freg; /* floating point registers */ svr4_fregset_t freg; /* floating point registers */
svr4_xrs_t xrs; /* mhm? */ svr4_xrs_t xrs; /* mhm? */
long pad[19]; long pad[19];
...@@ -86,7 +86,7 @@ enum svr4_stack_flags { ...@@ -86,7 +86,7 @@ enum svr4_stack_flags {
/* signal stack exection place, unsupported */ /* signal stack exection place, unsupported */
typedef struct svr4_stack_t { typedef struct svr4_stack_t {
char *sp; char __user *sp;
int size; int size;
int flags; int flags;
} svr4_stack_t; } svr4_stack_t;
......
...@@ -200,7 +200,7 @@ static inline unsigned long getipl(void) ...@@ -200,7 +200,7 @@ static inline unsigned long getipl(void)
#define smp_wmb() __asm__ __volatile__("":::"memory") #define smp_wmb() __asm__ __volatile__("":::"memory")
#define smp_read_barrier_depends() do { } while(0) #define smp_read_barrier_depends() do { } while(0)
#define nop() __asm__ __volatile__ ("nop"); #define nop() __asm__ __volatile__ ("nop")
/* This has special calling conventions */ /* This has special calling conventions */
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
......
...@@ -102,8 +102,8 @@ struct fbcursor { ...@@ -102,8 +102,8 @@ struct fbcursor {
struct fbcurpos hot; /* cursor hot spot */ struct fbcurpos hot; /* cursor hot spot */
struct fbcmap cmap; /* color map info */ struct fbcmap cmap; /* color map info */
struct fbcurpos size; /* cursor bit map size */ struct fbcurpos size; /* cursor bit map size */
char *image; /* cursor image bits */ char __user *image; /* cursor image bits */
char *mask; /* cursor mask bits */ char __user *mask; /* cursor mask bits */
}; };
/* set/get cursor attributes/shape */ /* set/get cursor attributes/shape */
......
...@@ -417,13 +417,13 @@ _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n) ...@@ -417,13 +417,13 @@ _memcpy_toio(volatile void __iomem *dst, const void *src, __kernel_size_t n)
#define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz) #define memcpy_toio(d,s,sz) _memcpy_toio(d,s,sz)
static inline int check_signature(unsigned long io_addr, static inline int check_signature(void __iomem *io_addr,
const unsigned char *signature, const unsigned char *signature,
int length) int length)
{ {
int retval = 0; int retval = 0;
do { do {
if (readb((void __iomem *)io_addr) != *signature++) if (readb(io_addr) != *signature++)
goto out; goto out;
io_addr++; io_addr++;
} while (--length); } while (--length);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment