Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 5743
b: refs/heads/master
c: 68e681e
h: refs/heads/master
i:
  5741: 53fe01c
  5739: 7626e07
  5735: fed9795
  5727: f94fc56
v: v3
  • Loading branch information
Linus Torvalds committed Aug 9, 2005
1 parent 51a36d2 commit 3a25018
Show file tree
Hide file tree
Showing 12 changed files with 325 additions and 686 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 38c1844b3120e04b7f5bb9c18ebbc19883d1e1d6
refs/heads/master: 68e681e87faa142bde356aeefe619c42275ac98e
193 changes: 119 additions & 74 deletions trunk/arch/sparc64/solaris/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/net.h>
#include <linux/compat.h>
#include <net/compat.h>
#include <net/sock.h>

#include <asm/uaccess.h>
#include <asm/string.h>
Expand Down Expand Up @@ -297,121 +298,165 @@ asmlinkage int solaris_sendmsg(int fd, struct sol_nmsghdr __user *user_msg, unsi
{
struct socket *sock;
char address[MAX_SOCK_ADDR];
struct iovec iov[UIO_FASTIOV];
struct iovec iovstack[UIO_FASTIOV], *iov = iovstack;
unsigned char ctl[sizeof(struct cmsghdr) + 20];
unsigned char *ctl_buf = ctl;
struct msghdr kern_msg;
int err, total_len;
struct msghdr msg_sys;
int err, ctl_len, iov_size, total_len;

if(msghdr_from_user32_to_kern(&kern_msg, user_msg))
return -EFAULT;
if(kern_msg.msg_iovlen > UIO_MAXIOV)
return -EINVAL;
err = verify_compat_iovec(&kern_msg, iov, address, VERIFY_READ);
if (err < 0)
err = -EFAULT;
if (msghdr_from_user32_to_kern(&msg_sys, user_msg))
goto out;

sock = sockfd_lookup(fd, &err);
if (!sock)
goto out;

/* do not move before msg_sys is valid */
err = -EMSGSIZE;
if (msg_sys.msg_iovlen > UIO_MAXIOV)
goto out_put;

/* Check whether to allocate the iovec area*/
err = -ENOMEM;
iov_size = msg_sys.msg_iovlen * sizeof(struct iovec);
if (msg_sys.msg_iovlen > UIO_FASTIOV) {
iov = sock_kmalloc(sock->sk, iov_size, GFP_KERNEL);
if (!iov)
goto out_put;
}

err = verify_compat_iovec(&msg_sys, iov, address, VERIFY_READ);
if (err < 0)
goto out_freeiov;
total_len = err;

if(kern_msg.msg_controllen) {
struct sol_cmsghdr __user *ucmsg = kern_msg.msg_control;
err = -ENOBUFS;
if (msg_sys.msg_controllen > INT_MAX)
goto out_freeiov;

ctl_len = msg_sys.msg_controllen;
if (ctl_len) {
struct sol_cmsghdr __user *ucmsg = msg_sys.msg_control;
unsigned long *kcmsg;
compat_size_t cmlen;

if (kern_msg.msg_controllen <= sizeof(compat_size_t))
return -EINVAL;
err = -EINVAL;
if (ctl_len <= sizeof(compat_size_t))
goto out_freeiov;

if(kern_msg.msg_controllen > sizeof(ctl)) {
if (ctl_len > sizeof(ctl)) {
err = -ENOBUFS;
ctl_buf = kmalloc(kern_msg.msg_controllen, GFP_KERNEL);
if(!ctl_buf)
ctl_buf = kmalloc(ctl_len, GFP_KERNEL);
if (!ctl_buf)
goto out_freeiov;
}
__get_user(cmlen, &ucmsg->cmsg_len);
kcmsg = (unsigned long *) ctl_buf;
*kcmsg++ = (unsigned long)cmlen;
err = -EFAULT;
if(copy_from_user(kcmsg, &ucmsg->cmsg_level,
kern_msg.msg_controllen - sizeof(compat_size_t)))
if (copy_from_user(kcmsg, &ucmsg->cmsg_level,
ctl_len - sizeof(compat_size_t)))
goto out_freectl;
kern_msg.msg_control = ctl_buf;
msg_sys.msg_control = ctl_buf;
}
kern_msg.msg_flags = solaris_to_linux_msgflags(user_flags);
msg_sys.msg_flags = solaris_to_linux_msgflags(user_flags);

lock_kernel();
sock = sockfd_lookup(fd, &err);
if (sock != NULL) {
if (sock->file->f_flags & O_NONBLOCK)
kern_msg.msg_flags |= MSG_DONTWAIT;
err = sock_sendmsg(sock, &kern_msg, total_len);
sockfd_put(sock);
}
unlock_kernel();
if (sock->file->f_flags & O_NONBLOCK)
msg_sys.msg_flags |= MSG_DONTWAIT;
err = sock_sendmsg(sock, &msg_sys, total_len);

out_freectl:
/* N.B. Use kfree here, as kern_msg.msg_controllen might change? */
if(ctl_buf != ctl)
kfree(ctl_buf);
if (ctl_buf != ctl)
sock_kfree_s(sock->sk, ctl_buf, ctl_len);
out_freeiov:
if(kern_msg.msg_iov != iov)
kfree(kern_msg.msg_iov);
out:
if (iov != iovstack)
sock_kfree_s(sock->sk, iov, iov_size);
out_put:
sockfd_put(sock);
out:
return err;
}

asmlinkage int solaris_recvmsg(int fd, struct sol_nmsghdr __user *user_msg, unsigned int user_flags)
{
struct iovec iovstack[UIO_FASTIOV];
struct msghdr kern_msg;
char addr[MAX_SOCK_ADDR];
struct socket *sock;
struct iovec iovstack[UIO_FASTIOV];
struct iovec *iov = iovstack;
struct msghdr msg_sys;
unsigned long cmsg_ptr;
int err, iov_size, total_len, len;

/* kernel mode address */
char addr[MAX_SOCK_ADDR];

/* user mode address pointers */
struct sockaddr __user *uaddr;
int __user *uaddr_len;
unsigned long cmsg_ptr;
int err, total_len, len = 0;

if(msghdr_from_user32_to_kern(&kern_msg, user_msg))
if (msghdr_from_user32_to_kern(&msg_sys, user_msg))
return -EFAULT;
if(kern_msg.msg_iovlen > UIO_MAXIOV)
return -EINVAL;

uaddr = kern_msg.msg_name;
sock = sockfd_lookup(fd, &err);
if (!sock)
goto out;

err = -EMSGSIZE;
if (msg_sys.msg_iovlen > UIO_MAXIOV)
goto out_put;

/* Check whether to allocate the iovec area*/
err = -ENOMEM;
iov_size = msg_sys.msg_iovlen * sizeof(struct iovec);
if (msg_sys.msg_iovlen > UIO_FASTIOV) {
iov = sock_kmalloc(sock->sk, iov_size, GFP_KERNEL);
if (!iov)
goto out_put;
}

/*
* Save the user-mode address (verify_iovec will change the
* kernel msghdr to use the kernel address space)
*/

uaddr = (void __user *) msg_sys.msg_name;
uaddr_len = &user_msg->msg_namelen;
err = verify_compat_iovec(&kern_msg, iov, addr, VERIFY_WRITE);
err = verify_compat_iovec(&msg_sys, iov, addr, VERIFY_WRITE);
if (err < 0)
goto out;
goto out_freeiov;
total_len = err;

cmsg_ptr = (unsigned long) kern_msg.msg_control;
kern_msg.msg_flags = 0;
cmsg_ptr = (unsigned long) msg_sys.msg_control;
msg_sys.msg_flags = MSG_CMSG_COMPAT;

lock_kernel();
sock = sockfd_lookup(fd, &err);
if (sock != NULL) {
if (sock->file->f_flags & O_NONBLOCK)
user_flags |= MSG_DONTWAIT;
err = sock_recvmsg(sock, &kern_msg, total_len, user_flags);
if(err >= 0)
len = err;
sockfd_put(sock);
}
unlock_kernel();

if(uaddr != NULL && err >= 0)
err = move_addr_to_user(addr, kern_msg.msg_namelen, uaddr, uaddr_len);
if(err >= 0) {
err = __put_user(linux_to_solaris_msgflags(kern_msg.msg_flags), &user_msg->msg_flags);
if(!err) {
/* XXX Convert cmsg back into userspace 32-bit format... */
err = __put_user((unsigned long)kern_msg.msg_control - cmsg_ptr,
&user_msg->msg_controllen);
}
if (sock->file->f_flags & O_NONBLOCK)
user_flags |= MSG_DONTWAIT;

err = sock_recvmsg(sock, &msg_sys, total_len, user_flags);
if(err < 0)
goto out_freeiov;

len = err;

if (uaddr != NULL) {
err = move_addr_to_user(addr, msg_sys.msg_namelen, uaddr, uaddr_len);
if (err < 0)
goto out_freeiov;
}
err = __put_user(linux_to_solaris_msgflags(msg_sys.msg_flags), &user_msg->msg_flags);
if (err)
goto out_freeiov;
err = __put_user((unsigned long)msg_sys.msg_control - cmsg_ptr,
&user_msg->msg_controllen);
if (err)
goto out_freeiov;
err = len;

if(kern_msg.msg_iov != iov)
kfree(kern_msg.msg_iov);
out_freeiov:
if (iov != iovstack)
sock_kfree_s(sock->sk, iov, iov_size);
out_put:
sockfd_put(sock);
out:
if(err < 0)
return err;
return len;
return err;
}
41 changes: 28 additions & 13 deletions trunk/drivers/char/watchdog/i8xx_tco.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* i8xx_tco 0.07: TCO timer driver for i8xx chipsets
* i8xx_tco: TCO timer driver for i8xx chipsets
*
* (c) Copyright 2000 kernel concepts <nils@kernelconcepts.de>, All Rights Reserved.
* http://www.kernelconcepts.de
Expand Down Expand Up @@ -63,6 +63,9 @@
* 20050128 Wim Van Sebroeck <wim@iguana.be>
* 0.07 Added support for the ICH4-M, ICH6, ICH6R, ICH6-M, ICH6W and ICH6RW
* chipsets. Also added support for the "undocumented" ICH7 chipset.
* 20050807 Wim Van Sebroeck <wim@iguana.be>
* 0.08 Make sure that the watchdog is only "armed" when started.
* (Kernel Bug 4251)
*/

/*
Expand All @@ -87,7 +90,7 @@
#include "i8xx_tco.h"

/* Module and version information */
#define TCO_VERSION "0.07"
#define TCO_VERSION "0.08"
#define TCO_MODULE_NAME "i8xx TCO timer"
#define TCO_DRIVER_NAME TCO_MODULE_NAME ", v" TCO_VERSION
#define PFX TCO_MODULE_NAME ": "
Expand Down Expand Up @@ -125,10 +128,18 @@ static int tco_timer_start (void)
unsigned char val;

spin_lock(&tco_lock);

/* disable chipset's NO_REBOOT bit */
pci_read_config_byte (i8xx_tco_pci, 0xd4, &val);
val &= 0xfd;
pci_write_config_byte (i8xx_tco_pci, 0xd4, val);

/* Bit 11: TCO Timer Halt -> 0 = The TCO timer is enabled to count */
val = inb (TCO1_CNT + 1);
val &= 0xf7;
outb (val, TCO1_CNT + 1);
val = inb (TCO1_CNT + 1);

spin_unlock(&tco_lock);

if (val & 0x08)
Expand All @@ -138,13 +149,20 @@ static int tco_timer_start (void)

static int tco_timer_stop (void)
{
unsigned char val;
unsigned char val, val1;

spin_lock(&tco_lock);
/* Bit 11: TCO Timer Halt -> 1 = The TCO timer is disabled */
val = inb (TCO1_CNT + 1);
val |= 0x08;
outb (val, TCO1_CNT + 1);
val = inb (TCO1_CNT + 1);

/* Set the NO_REBOOT bit to prevent later reboots, just for sure */
pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1);
val1 |= 0x02;
pci_write_config_byte (i8xx_tco_pci, 0xd4, val1);

spin_unlock(&tco_lock);

if ((val & 0x08) == 0)
Expand All @@ -155,6 +173,7 @@ static int tco_timer_stop (void)
static int tco_timer_keepalive (void)
{
spin_lock(&tco_lock);
/* Reload the timer by writing to the TCO Timer Reload register */
outb (0x01, TCO1_RLD);
spin_unlock(&tco_lock);
return 0;
Expand Down Expand Up @@ -417,9 +436,8 @@ static unsigned char __init i8xx_tco_getdevice (void)
printk (KERN_ERR PFX "failed to get TCOBASE address\n");
return 0;
}
/*
* Check chipset's NO_REBOOT bit
*/

/* Check chipset's NO_REBOOT bit */
pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1);
if (val1 & 0x02) {
val1 &= 0xfd;
Expand All @@ -430,6 +448,10 @@ static unsigned char __init i8xx_tco_getdevice (void)
return 0; /* Cannot reset NO_REBOOT bit */
}
}
/* Disable reboots untill the watchdog starts */
val1 |= 0x02;
pci_write_config_byte (i8xx_tco_pci, 0xd4, val1);

/* Set the TCO_EN bit in SMI_EN register */
if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) {
printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
Expand Down Expand Up @@ -505,17 +527,10 @@ static int __init watchdog_init (void)

static void __exit watchdog_cleanup (void)
{
u8 val;

/* Stop the timer before we leave */
if (!nowayout)
tco_timer_stop ();

/* Set the NO_REBOOT bit to prevent later reboots, just for sure */
pci_read_config_byte (i8xx_tco_pci, 0xd4, &val);
val |= 0x02;
pci_write_config_byte (i8xx_tco_pci, 0xd4, val);

/* Deregister */
misc_deregister (&i8xx_tco_miscdev);
unregister_reboot_notifier(&i8xx_tco_notifier);
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/i2c/busses/i2c-sibyte.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <asm/sibyte/sb1250_smbus.h>

static struct i2c_algo_sibyte_data sibyte_board_data[2] = {
{ NULL, 0, (void *) (KSEG1+A_SMB_BASE(0)) },
{ NULL, 1, (void *) (KSEG1+A_SMB_BASE(1)) }
{ NULL, 0, (void *) (CKSEG1+A_SMB_BASE(0)) },
{ NULL, 1, (void *) (CKSEG1+A_SMB_BASE(1)) }
};

static struct i2c_adapter sibyte_board_adapter[2] = {
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/message/i2o/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ config I2O_CONFIG
To compile this support as a module, choose M here: the
module will be called i2o_config.

Note: If you want to use the new API you have to download the
i2o_config patch from http://i2o.shadowconnect.com/

config I2O_CONFIG_OLD_IOCTL
bool "Enable ioctls (OBSOLETE)"
depends on I2O_CONFIG
Expand Down
Loading

0 comments on commit 3a25018

Please sign in to comment.