Commit 61f80950 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/set_pte-2.6

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents aa02c666 c59c28f7
...@@ -97,6 +97,11 @@ EXPORT_SYMBOL(__get_user_1); ...@@ -97,6 +97,11 @@ EXPORT_SYMBOL(__get_user_1);
EXPORT_SYMBOL(__get_user_2); EXPORT_SYMBOL(__get_user_2);
EXPORT_SYMBOL(__get_user_4); EXPORT_SYMBOL(__get_user_4);
EXPORT_SYMBOL(__put_user_1);
EXPORT_SYMBOL(__put_user_2);
EXPORT_SYMBOL(__put_user_4);
EXPORT_SYMBOL(__put_user_8);
EXPORT_SYMBOL(strpbrk); EXPORT_SYMBOL(strpbrk);
EXPORT_SYMBOL(strstr); EXPORT_SYMBOL(strstr);
......
...@@ -277,6 +277,18 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate, ...@@ -277,6 +277,18 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate,
{ {
int tmp, err = 0; int tmp, err = 0;
/*
* If TF is set due to a debugger (PT_DTRACE), clear the TF
* flag so that register information in the sigcontext is
* correct.
*/
if (unlikely(regs->eflags & TF_MASK)) {
if (likely(current->ptrace & PT_DTRACE)) {
current->ptrace &= ~PT_DTRACE;
regs->eflags &= ~TF_MASK;
}
}
tmp = 0; tmp = 0;
__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
err |= __put_user(tmp, (unsigned int __user *)&sc->gs); err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
lib-y = checksum.o delay.o usercopy.o getuser.o memcpy.o strstr.o \ lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \
bitops.o bitops.o
lib-$(CONFIG_X86_USE_3DNOW) += mmx.o lib-$(CONFIG_X86_USE_3DNOW) += mmx.o
......
/*
* __put_user functions.
*
* (C) Copyright 2005 Linus Torvalds
*
* These functions have a non-standard call interface
* to make them more efficient, especially as they
* return an error value in addition to the "real"
* return value.
*/
#include <asm/thread_info.h>
/*
* __put_user_X
*
* Inputs: %eax[:%edx] contains the data
* %ecx contains the address
*
* Outputs: %eax is error code (0 or -EFAULT)
*
* These functions should not modify any other registers,
* as they get called from within inline assembly.
*/
#define ENTER pushl %ebx ; GET_THREAD_INFO(%ebx)
#define EXIT popl %ebx ; ret
.text
.align 4
.globl __put_user_1
__put_user_1:
ENTER
cmpl TI_addr_limit(%ebx),%ecx
jae bad_put_user
1: movb %al,(%ecx)
xorl %eax,%eax
EXIT
.align 4
.globl __put_user_2
__put_user_2:
ENTER
movl TI_addr_limit(%ebx),%ebx
subl $1,%ebx
cmpl %ebx,%ecx
jae bad_put_user
2: movw %ax,(%ecx)
xorl %eax,%eax
EXIT
.align 4
.globl __put_user_4
__put_user_4:
ENTER
movl TI_addr_limit(%ebx),%ebx
subl $3,%ebx
cmpl %ebx,%ecx
jae bad_put_user
3: movl %eax,(%ecx)
xorl %eax,%eax
EXIT
.align 4
.globl __put_user_8
__put_user_8:
ENTER
movl TI_addr_limit(%ebx),%ebx
subl $7,%ebx
cmpl %ebx,%ecx
jae bad_put_user
4: movl %eax,(%ecx)
5: movl %edx,4(%ecx)
xorl %eax,%eax
EXIT
bad_put_user:
movl $-14,%eax
EXIT
.section __ex_table,"a"
.long 1b,bad_put_user
.long 2b,bad_put_user
.long 3b,bad_put_user
.long 4b,bad_put_user
.long 5b,bad_put_user
.previous
...@@ -326,9 +326,9 @@ static int __init schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino) ...@@ -326,9 +326,9 @@ static int __init schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino)
return ret; return ret;
} }
static unsigned int __init schizo_irq_build(struct pci_pbm_info *pbm, static unsigned int schizo_irq_build(struct pci_pbm_info *pbm,
struct pci_dev *pdev, struct pci_dev *pdev,
unsigned int ino) unsigned int ino)
{ {
struct ino_bucket *bucket; struct ino_bucket *bucket;
unsigned long imap, iclr; unsigned long imap, iclr;
...@@ -382,19 +382,57 @@ static unsigned long stc_error_buf[128]; ...@@ -382,19 +382,57 @@ static unsigned long stc_error_buf[128];
static unsigned long stc_tag_buf[16]; static unsigned long stc_tag_buf[16];
static unsigned long stc_line_buf[16]; static unsigned long stc_line_buf[16];
/* These offsets look weird because I keep in pbm->controller_regs #define SCHIZO_UE_INO 0x30 /* Uncorrectable ECC error */
* the second PROM register property minus 0x10000 which is the #define SCHIZO_CE_INO 0x31 /* Correctable ECC error */
* base of the Safari and UPA64S registers of SCHIZO. #define SCHIZO_PCIERR_A_INO 0x32 /* PBM A PCI bus error */
*/ #define SCHIZO_PCIERR_B_INO 0x33 /* PBM B PCI bus error */
#define SCHIZO_PBM_A_REGS_OFF (0x600000UL - 0x400000UL) #define SCHIZO_SERR_INO 0x34 /* Safari interface error */
#define SCHIZO_PBM_B_REGS_OFF (0x700000UL - 0x400000UL)
struct pci_pbm_info *pbm_for_ino(struct pci_controller_info *p, u32 ino)
{
ino &= IMAP_INO;
if (p->pbm_A.ino_bitmap & (1UL << ino))
return &p->pbm_A;
if (p->pbm_B.ino_bitmap & (1UL << ino))
return &p->pbm_B;
printk("PCI%d: No ino_bitmap entry for ino[%x], bitmaps "
"PBM_A[%016lx] PBM_B[%016lx]",
p->index, ino,
p->pbm_A.ino_bitmap,
p->pbm_B.ino_bitmap);
printk("PCI%d: Using PBM_A, report this problem immediately.\n",
p->index);
return &p->pbm_A;
}
static void schizo_clear_other_err_intr(int irq) static void schizo_clear_other_err_intr(struct pci_controller_info *p, int irq)
{ {
struct ino_bucket *bucket = __bucket(irq); struct pci_pbm_info *pbm;
unsigned long iclr = bucket->iclr; struct ino_bucket *bucket;
unsigned long iclr;
/* Do not clear the interrupt for the other PCI bus.
*
* This "ACK both PBM IRQs" only needs to be performed
* for chip-wide error interrupts.
*/
if ((irq & IMAP_INO) == SCHIZO_PCIERR_A_INO ||
(irq & IMAP_INO) == SCHIZO_PCIERR_B_INO)
return;
pbm = pbm_for_ino(p, irq);
if (pbm == &p->pbm_A)
pbm = &p->pbm_B;
else
pbm = &p->pbm_A;
irq = schizo_irq_build(pbm, NULL,
(pbm->portid << 6) | (irq & IMAP_INO));
bucket = __bucket(irq);
iclr = bucket->iclr;
iclr += (SCHIZO_PBM_B_REGS_OFF - SCHIZO_PBM_A_REGS_OFF);
upa_writel(ICLR_IDLE, iclr); upa_writel(ICLR_IDLE, iclr);
} }
...@@ -728,7 +766,7 @@ static irqreturn_t schizo_ue_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -728,7 +766,7 @@ static irqreturn_t schizo_ue_intr(int irq, void *dev_id, struct pt_regs *regs)
/* Interrogate IOMMU for error status. */ /* Interrogate IOMMU for error status. */
schizo_check_iommu_error(p, UE_ERR); schizo_check_iommu_error(p, UE_ERR);
schizo_clear_other_err_intr(irq); schizo_clear_other_err_intr(p, irq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -819,7 +857,7 @@ static irqreturn_t schizo_ce_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -819,7 +857,7 @@ static irqreturn_t schizo_ce_intr(int irq, void *dev_id, struct pt_regs *regs)
printk("(none)"); printk("(none)");
printk("]\n"); printk("]\n");
schizo_clear_other_err_intr(irq); schizo_clear_other_err_intr(p, irq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -856,9 +894,9 @@ static irqreturn_t schizo_ce_intr(int irq, void *dev_id, struct pt_regs *regs) ...@@ -856,9 +894,9 @@ static irqreturn_t schizo_ce_intr(int irq, void *dev_id, struct pt_regs *regs)
#define SCHIZO_PCICTRL_SBH_ERR (1UL << 35UL) /* Safari */ #define SCHIZO_PCICTRL_SBH_ERR (1UL << 35UL) /* Safari */
#define SCHIZO_PCICTRL_SERR (1UL << 34UL) /* Safari/Tomatillo */ #define SCHIZO_PCICTRL_SERR (1UL << 34UL) /* Safari/Tomatillo */
#define SCHIZO_PCICTRL_PCISPD (1UL << 33UL) /* Safari */ #define SCHIZO_PCICTRL_PCISPD (1UL << 33UL) /* Safari */
#define SCHIZO_PCICTRL_MRM_PREF (1UL << 28UL) /* Tomatillo */ #define SCHIZO_PCICTRL_MRM_PREF (1UL << 30UL) /* Tomatillo */
#define SCHIZO_PCICTRL_RDO_PREF (1UL << 27UL) /* Tomatillo */ #define SCHIZO_PCICTRL_RDO_PREF (1UL << 29UL) /* Tomatillo */
#define SCHIZO_PCICTRL_RDL_PREF (1UL << 26UL) /* Tomatillo */ #define SCHIZO_PCICTRL_RDL_PREF (1UL << 28UL) /* Tomatillo */
#define SCHIZO_PCICTRL_PTO (3UL << 24UL) /* Safari/Tomatillo */ #define SCHIZO_PCICTRL_PTO (3UL << 24UL) /* Safari/Tomatillo */
#define SCHIZO_PCICTRL_PTO_SHIFT 24UL #define SCHIZO_PCICTRL_PTO_SHIFT 24UL
#define SCHIZO_PCICTRL_TRWSW (7UL << 21UL) /* Tomatillo */ #define SCHIZO_PCICTRL_TRWSW (7UL << 21UL) /* Tomatillo */
...@@ -1040,7 +1078,7 @@ static irqreturn_t schizo_pcierr_intr(int irq, void *dev_id, struct pt_regs *reg ...@@ -1040,7 +1078,7 @@ static irqreturn_t schizo_pcierr_intr(int irq, void *dev_id, struct pt_regs *reg
if (error_bits & (SCHIZO_PCIAFSR_PPERR | SCHIZO_PCIAFSR_SPERR)) if (error_bits & (SCHIZO_PCIAFSR_PPERR | SCHIZO_PCIAFSR_SPERR))
pci_scan_for_parity_error(p, pbm, pbm->pci_bus); pci_scan_for_parity_error(p, pbm, pbm->pci_bus);
schizo_clear_other_err_intr(irq); schizo_clear_other_err_intr(p, irq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1097,7 +1135,7 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs * ...@@ -1097,7 +1135,7 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs *
printk("PCI%d: Unexpected Safari/JBUS error interrupt, errlog[%016lx]\n", printk("PCI%d: Unexpected Safari/JBUS error interrupt, errlog[%016lx]\n",
p->index, errlog); p->index, errlog);
schizo_clear_other_err_intr(irq); schizo_clear_other_err_intr(p, irq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1105,7 +1143,7 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs * ...@@ -1105,7 +1143,7 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs *
p->index); p->index);
schizo_check_iommu_error(p, SAFARI_ERR); schizo_check_iommu_error(p, SAFARI_ERR);
schizo_clear_other_err_intr(irq); schizo_clear_other_err_intr(p, irq);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1120,26 +1158,6 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs * ...@@ -1120,26 +1158,6 @@ static irqreturn_t schizo_safarierr_intr(int irq, void *dev_id, struct pt_regs *
#define SCHIZO_SAFARI_IRQCTRL 0x10010UL #define SCHIZO_SAFARI_IRQCTRL 0x10010UL
#define SCHIZO_SAFIRQCTRL_EN 0x8000000000000000UL #define SCHIZO_SAFIRQCTRL_EN 0x8000000000000000UL
#define SCHIZO_UE_INO 0x30 /* Uncorrectable ECC error */
#define SCHIZO_CE_INO 0x31 /* Correctable ECC error */
#define SCHIZO_PCIERR_A_INO 0x32 /* PBM A PCI bus error */
#define SCHIZO_PCIERR_B_INO 0x33 /* PBM B PCI bus error */
#define SCHIZO_SERR_INO 0x34 /* Safari interface error */
struct pci_pbm_info *pbm_for_ino(struct pci_controller_info *p, u32 ino)
{
ino &= IMAP_INO;
if (p->pbm_A.ino_bitmap & (1UL << ino))
return &p->pbm_A;
if (p->pbm_B.ino_bitmap & (1UL << ino))
return &p->pbm_B;
prom_printf("TOMATILLO%d: No entry in ino bitmap for %d\n",
p->index, ino);
prom_halt();
/* NOTREACHED */
return NULL;
}
/* How the Tomatillo IRQs are routed around is pure guesswork here. /* How the Tomatillo IRQs are routed around is pure guesswork here.
* *
* All the Tomatillo devices I see in prtconf dumps seem to have only * All the Tomatillo devices I see in prtconf dumps seem to have only
...@@ -1887,7 +1905,7 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm) ...@@ -1887,7 +1905,7 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm)
tmp &= ~SCHIZO_PCICTRL_PTO; tmp &= ~SCHIZO_PCICTRL_PTO;
if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
pbm->chip_version == 0x2) pbm->chip_version >= 0x2)
tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT; tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT;
else else
tmp |= 0x1UL << SCHIZO_PCICTRL_PTO_SHIFT; tmp |= 0x1UL << SCHIZO_PCICTRL_PTO_SHIFT;
...@@ -1895,8 +1913,16 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm) ...@@ -1895,8 +1913,16 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm)
if (!prom_getbool(pbm->prom_node, "no-bus-parking")) if (!prom_getbool(pbm->prom_node, "no-bus-parking"))
tmp |= SCHIZO_PCICTRL_PARK; tmp |= SCHIZO_PCICTRL_PARK;
if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
pbm->chip_version <= 0x1)
tmp |= (1UL << 61);
else
tmp &= ~(1UL << 61);
if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO)
tmp |= SCHIZO_PCICTRL_MRM_PREF; tmp |= (SCHIZO_PCICTRL_MRM_PREF |
SCHIZO_PCICTRL_RDO_PREF |
SCHIZO_PCICTRL_RDL_PREF);
schizo_write(pbm->pbm_regs + SCHIZO_PCI_CTRL, tmp); schizo_write(pbm->pbm_regs + SCHIZO_PCI_CTRL, tmp);
......
...@@ -60,8 +60,8 @@ ...@@ -60,8 +60,8 @@
#define DRV_MODULE_NAME "tg3" #define DRV_MODULE_NAME "tg3"
#define PFX DRV_MODULE_NAME ": " #define PFX DRV_MODULE_NAME ": "
#define DRV_MODULE_VERSION "3.23" #define DRV_MODULE_VERSION "3.24"
#define DRV_MODULE_RELDATE "February 15, 2005" #define DRV_MODULE_RELDATE "March 4, 2005"
#define TG3_DEF_MAC_MODE 0 #define TG3_DEF_MAC_MODE 0
#define TG3_DEF_RX_MODE 0 #define TG3_DEF_RX_MODE 0
...@@ -3697,8 +3697,9 @@ static void tg3_nvram_unlock(struct tg3 *tp) ...@@ -3697,8 +3697,9 @@ static void tg3_nvram_unlock(struct tg3 *tp)
/* tp->lock is held. */ /* tp->lock is held. */
static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind) static void tg3_write_sig_pre_reset(struct tg3 *tp, int kind)
{ {
tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX, if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X))
NIC_SRAM_FIRMWARE_MBOX_MAGIC1); tg3_write_mem(tp, NIC_SRAM_FIRMWARE_MBOX,
NIC_SRAM_FIRMWARE_MBOX_MAGIC1);
if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) { if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) {
switch (kind) { switch (kind) {
...@@ -3902,19 +3903,20 @@ static int tg3_chip_reset(struct tg3 *tp) ...@@ -3902,19 +3903,20 @@ static int tg3_chip_reset(struct tg3 *tp)
tw32_f(MAC_MODE, 0); tw32_f(MAC_MODE, 0);
udelay(40); udelay(40);
/* Wait for firmware initialization to complete. */ if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) {
for (i = 0; i < 100000; i++) { /* Wait for firmware initialization to complete. */
tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val); for (i = 0; i < 100000; i++) {
if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1) tg3_read_mem(tp, NIC_SRAM_FIRMWARE_MBOX, &val);
break; if (val == ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
udelay(10); break;
} udelay(10);
if (i >= 100000 && }
!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) { if (i >= 100000) {
printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, " printk(KERN_ERR PFX "tg3_reset_hw timed out for %s, "
"firmware will not restart magic=%08x\n", "firmware will not restart magic=%08x\n",
tp->dev->name, val); tp->dev->name, val);
return -ENODEV; return -ENODEV;
}
} }
if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) && if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
......
...@@ -185,6 +185,21 @@ extern void __get_user_4(void); ...@@ -185,6 +185,21 @@ extern void __get_user_4(void);
extern void __put_user_bad(void); extern void __put_user_bad(void);
/*
* Strange magic calling convention: pointer in %ecx,
* value in %eax(:%edx), return value in %eax, no clobbers.
*/
extern void __put_user_1(void);
extern void __put_user_2(void);
extern void __put_user_4(void);
extern void __put_user_8(void);
#define __put_user_1(x, ptr) __asm__ __volatile__("call __put_user_1":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))
#define __put_user_2(x, ptr) __asm__ __volatile__("call __put_user_2":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))
#define __put_user_4(x, ptr) __asm__ __volatile__("call __put_user_4":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))
#define __put_user_8(x, ptr) __asm__ __volatile__("call __put_user_8":"=a" (__ret_pu):"A" ((typeof(*(ptr)))(x)), "c" (ptr))
#define __put_user_X(x, ptr) __asm__ __volatile__("call __put_user_X":"=a" (__ret_pu):"c" (ptr))
/** /**
* put_user: - Write a simple value into user space. * put_user: - Write a simple value into user space.
* @x: Value to copy to user space. * @x: Value to copy to user space.
...@@ -201,9 +216,18 @@ extern void __put_user_bad(void); ...@@ -201,9 +216,18 @@ extern void __put_user_bad(void);
* *
* Returns zero on success, or -EFAULT on error. * Returns zero on success, or -EFAULT on error.
*/ */
#define put_user(x,ptr) \ #define put_user(x,ptr) \
__put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr))) ({ int __ret_pu; \
__chk_user_ptr(ptr); \
switch(sizeof(*(ptr))) { \
case 1: __put_user_1(x, ptr); break; \
case 2: __put_user_2(x, ptr); break; \
case 4: __put_user_4(x, ptr); break; \
case 8: __put_user_8(x, ptr); break; \
default:__put_user_X(x, ptr); break; \
} \
__ret_pu; \
})
/** /**
* __get_user: - Get a simple variable from user space, with less checking. * __get_user: - Get a simple variable from user space, with less checking.
...@@ -259,16 +283,6 @@ extern void __put_user_bad(void); ...@@ -259,16 +283,6 @@ extern void __put_user_bad(void);
}) })
#define __put_user_check(x,ptr,size) \
({ \
long __pu_err = -EFAULT; \
__typeof__(*(ptr)) __user *__pu_addr = (ptr); \
might_sleep(); \
if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
__put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT); \
__pu_err; \
})
#define __put_user_u64(x, addr, err) \ #define __put_user_u64(x, addr, err) \
__asm__ __volatile__( \ __asm__ __volatile__( \
"1: movl %%eax,0(%2)\n" \ "1: movl %%eax,0(%2)\n" \
......
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