Commit dee12d4f authored by David S. Miller's avatar David S. Miller

[SPARC]: Fix build breakage.

- Update for PCI config space access api changes
- Handle new do_fork args
- Delete SET/CLEAR TID handling from copy_thread
- Update arch/sparc64/defconfig
parent 117efdbb
......@@ -193,39 +193,34 @@ static void pci_do_settimeofday(struct timeval *tv);
#define CONFIG_CMD(bus, device_fn, where) (0x80000000 | (((unsigned int)bus) << 16) | (((unsigned int)device_fn) << 8) | (where & ~3))
static int pcic_read_config_dword(struct pci_dev *dev, int where, u32 *value);
static int pcic_write_config_dword(struct pci_dev *dev, int where, u32 value);
static int pcic_read_config_byte(struct pci_dev *dev, int where, u8 *value)
{
unsigned int v;
pcic_read_config_dword(dev, where&~3, &v);
*value = 0xff & (v >> (8*(where & 3)));
return PCIBIOS_SUCCESSFUL;
}
static int pcic_read_config_word(struct pci_dev *dev, int where, u16 *value)
static int pcic_read_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 *value)
{
unsigned int v;
if (where&1) return PCIBIOS_BAD_REGISTER_NUMBER;
unsigned char busnum = bus->number;
struct linux_pcic *pcic;
unsigned long flags;
/* unsigned char where; */
pcic_read_config_dword(dev, where&~3, &v);
*value = 0xffff & (v >> (8*(where & 3)));
return PCIBIOS_SUCCESSFUL;
}
switch (size) {
case 1:
pcic_read_config(bus, devfn, where&~3, 4, &v);
*value = 0xff & (v >> (8*(where & 3)));
return PCIBIOS_SUCCESSFUL;
break;
static int pcic_read_config_dword(struct pci_dev *dev, int where, u32 *value)
{
unsigned char bus = dev->bus->number;
unsigned char device_fn = dev->devfn;
/* unsigned char where; */
case 2:
if (where&1) return PCIBIOS_BAD_REGISTER_NUMBER;
struct linux_pcic *pcic;
unsigned long flags;
pcic_read_config(bus, devfn, where&~3, 4, &v);
*value = 0xffff & (v >> (8*(where & 3)));
return PCIBIOS_SUCCESSFUL;
break;
}
/* size == 4, i.e. dword */
if (where&3) return PCIBIOS_BAD_REGISTER_NUMBER;
if (bus != 0) return PCIBIOS_DEVICE_NOT_FOUND;
if (busnum != 0) return PCIBIOS_DEVICE_NOT_FOUND;
pcic = &pcic0;
save_and_cli(flags);
......@@ -233,7 +228,7 @@ static int pcic_read_config_dword(struct pci_dev *dev, int where, u32 *value)
pcic_speculative = 1;
pcic_trapped = 0;
#endif
writel(CONFIG_CMD(bus,device_fn,where), pcic->pcic_config_space_addr);
writel(CONFIG_CMD(busnum,devfn,where), pcic->pcic_config_space_addr);
#if 0 /* does not fail here */
nop();
if (pcic_trapped) {
......@@ -257,52 +252,46 @@ static int pcic_read_config_dword(struct pci_dev *dev, int where, u32 *value)
return PCIBIOS_SUCCESSFUL;
}
static int pcic_write_config_byte(struct pci_dev *dev, int where, u8 value)
static int pcic_write_config(struct pci_bus *bus, unsigned int devfn,
int where, int size, u32 value)
{
unsigned int v;
pcic_read_config_dword(dev, where&~3, &v);
v = (v & ~(0xff << (8*(where&3)))) |
((0xff&(unsigned)value) << (8*(where&3)));
return pcic_write_config_dword(dev, where&~3, v);
}
static int pcic_write_config_word(struct pci_dev *dev, int where, u16 value)
{
unsigned int v;
if (where&1) return PCIBIOS_BAD_REGISTER_NUMBER;
pcic_read_config_dword(dev, where&~3, &v);
v = (v & ~(0xffff << (8*(where&3)))) |
((0xffff&(unsigned)value) << (8*(where&3)));
return pcic_write_config_dword(dev, where&~3, v);
}
static int pcic_write_config_dword(struct pci_dev *dev, int where, u32 value)
{
unsigned char bus = dev->bus->number;
unsigned char devfn = dev->devfn;
unsigned char busnum = bus->number;
struct linux_pcic *pcic;
unsigned long flags;
switch (size) {
case 1:
pcic_read_config(bus, devfn, where&~3, 4, &v);
v = (v & ~(0xff << (8*(where&3)))) |
((0xff&(unsigned)value) << (8*(where&3)));
return pcic_write_config(bus, devfn, where&~3, 4, v);
break;
case 2:
if (where&1) return PCIBIOS_BAD_REGISTER_NUMBER;
pcic_read_config(bus, devfn, where&~3, 4, &v);
v = (v & ~(0xffff << (8*(where&3)))) |
((0xffff&(unsigned)value) << (8*(where&3)));
return pcic_write_config(bus, devfn, where&~3, 4, v);
break;
}
/* size == 4, i.e. dword */
if (where&3) return PCIBIOS_BAD_REGISTER_NUMBER;
if (bus != 0) return PCIBIOS_DEVICE_NOT_FOUND;
if (busnum != 0) return PCIBIOS_DEVICE_NOT_FOUND;
pcic = &pcic0;
save_and_cli(flags);
writel(CONFIG_CMD(bus,devfn,where), pcic->pcic_config_space_addr);
writel(CONFIG_CMD(busnum,devfn,where), pcic->pcic_config_space_addr);
writel(value, pcic->pcic_config_space_data + (where&4));
restore_flags(flags);
return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops pcic_ops = {
pcic_read_config_byte,
pcic_read_config_word,
pcic_read_config_dword,
pcic_write_config_byte,
pcic_write_config_word,
pcic_write_config_dword,
.read = pcic_read_config,
.write = pcic_write_config,
};
/*
......
......@@ -459,15 +459,16 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
struct pt_regs *regs,
unsigned long stack_size)
{
unsigned long tid_ptr = 0;
struct task_struct *p;
/* XXX This was spelled in DaveM's will and testament. Why? */
if (clone_flags & CLONE_IDLETASK) {
printk(KERN_DEBUG "Userland clone with CLONE_IDLETASK\n");
clone_flags &= ~CLONE_IDLETASK;
}
clone_flags &= ~CLONE_IDLETASK;
if (clone_flags & (CLONE_SETTID | CLONE_CLEARTID))
tid_ptr = regs->u_regs[UREG_G2];
p = do_fork(clone_flags, stack_start, regs, stack_size);
p = do_fork(clone_flags, stack_start,
regs, stack_size, (int *) tid_ptr);
return IS_ERR(p) ? PTR_ERR(p) : p->pid;
}
......
......@@ -388,6 +388,15 @@ CONFIG_ARPD=y
CONFIG_INET_ECN=y
# CONFIG_SYN_COOKIES is not set
CONFIG_IPV6=m
#
# SCTP Configuration (EXPERIMENTAL)
#
CONFIG_IPV6_SCTP__=m
CONFIG_IP_SCTP=m
# CONFIG_SCTP_ADLER32 is not set
# CONFIG_SCTP_DBG_MSG is not set
# CONFIG_SCTP_DBG_OBJCNT is not set
# CONFIG_ATM is not set
CONFIG_VLAN_8021Q=m
CONFIG_LLC=m
......@@ -613,9 +622,6 @@ CONFIG_SOUND_GAMEPORT=y
# CONFIG_GAMEPORT_CS461x is not set
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
CONFIG_I8042_REG_BASE=60
CONFIG_I8042_KBD_IRQ=1
CONFIG_I8042_AUX_IRQ=12
# CONFIG_SERIO_SERPORT is not set
# CONFIG_SERIO_CT82C710 is not set
# CONFIG_SERIO_PARKBD is not set
......
......@@ -669,10 +669,10 @@ static int bond_ioctl(unsigned long fd, unsigned int cmd, unsigned long arg)
static __inline__ void *alloc_user_space(long len)
{
struct pt_regs *regs = current->thread.kregs;
struct pt_regs *regs = current_thread_info()->kregs;
unsigned long usp = regs->u_regs[UREG_I6];
if (!(current->thread.flags & SPARC_FLAG_32BIT))
if (!(test_thread_flag(TIF_32BIT)))
usp += STACK_BIAS;
return (void *) (usp - len);
......
......@@ -107,119 +107,66 @@ static int psycho_out_of_range(struct pci_pbm_info *pbm,
/* PSYCHO PCI configuration space accessors. */
static int psycho_read_byte(struct pci_dev *dev, int where, u8 *value)
static int psycho_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
int where, int size, u32 *value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u8 *addr;
*value = 0xff;
addr = psycho_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (psycho_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
pci_config_read8(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int psycho_read_word(struct pci_dev *dev, int where, u16 *value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u16 *addr;
*value = 0xffff;
addr = psycho_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (psycho_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x01) {
printk("pcibios_read_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_read16(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int psycho_read_dword(struct pci_dev *dev, int where, u32 *value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
struct pci_pbm_info *pbm = pci_bus2pbm[bus_dev->number];
unsigned char bus = bus_dev->number;
u32 *addr;
*value = 0xffffffff;
addr = psycho_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (psycho_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x03) {
printk("pcibios_read_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
u16 tmp16;
u8 tmp8;
switch (size) {
case 1:
*value = 0xff;
break;
case 2:
*value = 0xffff;
break;
case 4:
*value = 0xffffffff;
break;
}
pci_config_read32(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int psycho_write_byte(struct pci_dev *dev, int where, u8 value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u8 *addr;
addr = psycho_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (psycho_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
pci_config_write8(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int psycho_write_word(struct pci_dev *dev, int where, u16 value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u16 *addr;
addr = psycho_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (psycho_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x01) {
printk("pcibios_write_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
switch (size) {
case 1:
pci_config_read8((u8 *)addr, &tmp8);
*value = (u32) tmp8;
break;
case 2:
if (where & 0x01) {
printk("pci_read_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_read16((u16 *)addr, &tmp16);
*value = (u32) tmp16;
break;
case 4:
if (where & 0x03) {
printk("pci_read_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_read32(addr, value);
break;
}
pci_config_write16(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int psycho_write_dword(struct pci_dev *dev, int where, u32 value)
static int psycho_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
int where, int size, u32 value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
struct pci_pbm_info *pbm = pci_bus2pbm[bus_dev->number];
unsigned char bus = bus_dev->number;
u32 *addr;
addr = psycho_pci_config_mkaddr(pbm, bus, devfn, where);
......@@ -229,22 +176,34 @@ static int psycho_write_dword(struct pci_dev *dev, int where, u32 value)
if (psycho_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x03) {
printk("pcibios_write_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
switch (size) {
case 1:
pci_config_write8((u8 *)addr, value);
break;
case 2:
if (where & 0x01) {
printk("pci_write_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_write16((u16 *)addr, value);
break;
case 4:
if (where & 0x03) {
printk("pci_write_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_write32(addr, value);
}
pci_config_write32(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops psycho_ops = {
psycho_read_byte,
psycho_read_word,
psycho_read_dword,
psycho_write_byte,
psycho_write_word,
psycho_write_dword
.read = psycho_read_pci_cfg,
.write = psycho_write_pci_cfg,
};
/* PSYCHO interrupt mapping support. */
......
This diff is collapsed.
......@@ -124,119 +124,66 @@ static int schizo_out_of_range(struct pci_pbm_info *pbm,
/* SCHIZO PCI configuration space accessors. */
static int schizo_read_byte(struct pci_dev *dev, int where, u8 *value)
static int schizo_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
int where, int size, u32 *value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u8 *addr;
*value = 0xff;
addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (schizo_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
pci_config_read8(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int schizo_read_word(struct pci_dev *dev, int where, u16 *value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u16 *addr;
*value = 0xffff;
addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (schizo_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x01) {
printk("pcibios_read_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_read16(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int schizo_read_dword(struct pci_dev *dev, int where, u32 *value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
struct pci_pbm_info *pbm = pci_bus2pbm[bus_dev->number];
unsigned char bus = bus_dev->number;
u32 *addr;
*value = 0xffffffff;
addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (schizo_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x03) {
printk("pcibios_read_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
u16 tmp16;
u8 tmp8;
switch (size) {
case 1:
*value = 0xff;
break;
case 2:
*value = 0xffff;
break;
case 4:
*value = 0xffffffff;
break;
}
pci_config_read32(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int schizo_write_byte(struct pci_dev *dev, int where, u8 value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u8 *addr;
addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (schizo_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
pci_config_write8(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int schizo_write_word(struct pci_dev *dev, int where, u16 value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
u16 *addr;
addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
if (!addr)
return PCIBIOS_SUCCESSFUL;
if (schizo_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x01) {
printk("pcibios_write_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
switch (size) {
case 1:
pci_config_read8((u8 *)addr, &tmp8);
*value = tmp8;
break;
case 2:
if (where & 0x01) {
printk("pci_read_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_read16((u16 *)addr, &tmp16);
*value = tmp16;
break;
case 4:
if (where & 0x03) {
printk("pci_read_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_read32(addr, value);
break;
}
pci_config_write16(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static int schizo_write_dword(struct pci_dev *dev, int where, u32 value)
static int schizo_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
int where, int size, u32 value)
{
struct pci_pbm_info *pbm = pci_bus2pbm[dev->bus->number];
unsigned char bus = dev->bus->number;
unsigned int devfn = dev->devfn;
struct pci_pbm_info *pbm = pci_bus2pbm[bus_dev->number];
unsigned char bus = bus_dev->number;
u32 *addr;
addr = schizo_pci_config_mkaddr(pbm, bus, devfn, where);
......@@ -246,22 +193,34 @@ static int schizo_write_dword(struct pci_dev *dev, int where, u32 value)
if (schizo_out_of_range(pbm, bus, devfn))
return PCIBIOS_SUCCESSFUL;
if (where & 0x03) {
printk("pcibios_write_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
switch (size) {
case 1:
pci_config_write8((u8 *)addr, value);
break;
case 2:
if (where & 0x01) {
printk("pci_write_config_word: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_write16((u16 *)addr, value);
break;
case 4:
if (where & 0x03) {
printk("pci_write_config_dword: misaligned reg [%x]\n",
where);
return PCIBIOS_SUCCESSFUL;
}
pci_config_write32(addr, value);
}
pci_config_write32(addr, value);
return PCIBIOS_SUCCESSFUL;
}
static struct pci_ops schizo_ops = {
schizo_read_byte,
schizo_read_word,
schizo_read_dword,
schizo_write_byte,
schizo_write_word,
schizo_write_dword
.read = schizo_read_pci_cfg,
.write = schizo_write_pci_cfg,
};
/* SCHIZO interrupt mapping support. Unlike Psycho, for this controller the
......
......@@ -568,8 +568,19 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags,
struct pt_regs *regs,
unsigned long stack_size)
{
struct task_struct *p = do_fork(clone_flags, stack_start,
regs, stack_size);
struct task_struct *p;
unsigned long tid_ptr = 0;
clone_flags &= ~CLONE_IDLETASK;
if (clone_flags & (CLONE_SETTID | CLONE_CLEARTID)) {
tid_ptr = regs->u_regs[UREG_G2];
if (test_thread_flag(TIF_32BIT))
tid_ptr &= 0xffffffff;
}
p = do_fork(clone_flags, stack_start,
regs, stack_size, (int *) tid_ptr);
return IS_ERR(p) ? PTR_ERR(p) : p->pid;
}
......@@ -649,19 +660,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
/* Set the second return value for the parent. */
regs->u_regs[UREG_I1] = 0;
if (!(clone_flags & (CLONE_SETTID | CLONE_CLEARTID)))
return 0;
if (t->flags & _TIF_32BIT)
t->kregs->u_regs[UREG_G2] &= 0xffffffff;
if (clone_flags & CLONE_SETTID)
if (put_user(p->pid, (int *)t->kregs->u_regs[UREG_G2]))
return -EFAULT;
if (clone_flags & CLONE_CLEARTID)
p->user_tid = (int *) t->kregs->u_regs[UREG_G2];
return 0;
}
......
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