diff options
Diffstat (limited to 'arch/ia64/hp/sim')
-rw-r--r-- | arch/ia64/hp/sim/boot/boot_head.S | 1 | ||||
-rw-r--r-- | arch/ia64/hp/sim/hpsim_console.c | 16 | ||||
-rw-r--r-- | arch/ia64/hp/sim/hpsim_setup.c | 9 | ||||
-rw-r--r-- | arch/ia64/hp/sim/simeth.c | 15 | ||||
-rw-r--r-- | arch/ia64/hp/sim/simscsi.c | 71 |
5 files changed, 40 insertions, 72 deletions
diff --git a/arch/ia64/hp/sim/boot/boot_head.S b/arch/ia64/hp/sim/boot/boot_head.S index a9bd71ac78e2..8808565491fb 100644 --- a/arch/ia64/hp/sim/boot/boot_head.S +++ b/arch/ia64/hp/sim/boot/boot_head.S @@ -26,6 +26,7 @@ GLOBAL_ENTRY(_start) movl sp = stack_mem+16384-16 bsw.1 br.call.sptk.many rp=start_bootloader +0: nop 0 /* dummy nop to make unwinding work */ END(_start) /* diff --git a/arch/ia64/hp/sim/hpsim_console.c b/arch/ia64/hp/sim/hpsim_console.c index 6e149c8ab835..01663bc42b1a 100644 --- a/arch/ia64/hp/sim/hpsim_console.c +++ b/arch/ia64/hp/sim/hpsim_console.c @@ -21,6 +21,7 @@ #include <asm/machvec.h> #include <asm/pgtable.h> #include <asm/sal.h> +#include <asm/hpsim.h> #include "hpsim_ssc.h" @@ -28,7 +29,7 @@ static int simcons_init (struct console *, char *); static void simcons_write (struct console *, const char *, unsigned); static struct tty_driver *simcons_console_device (struct console *, int *); -struct console hpsim_cons = { +static struct console hpsim_cons = { .name = "simcons", .write = simcons_write, .device = simcons_console_device, @@ -58,7 +59,18 @@ simcons_write (struct console *cons, const char *buf, unsigned count) static struct tty_driver *simcons_console_device (struct console *c, int *index) { - extern struct tty_driver *hp_simserial_driver; *index = c->index; return hp_simserial_driver; } + +int simcons_register(void) +{ + if (!ia64_platform_is("hpsim")) + return 1; + + if (hpsim_cons.flags & CON_ENABLED) + return 1; + + register_console(&hpsim_cons); + return 0; +} diff --git a/arch/ia64/hp/sim/hpsim_setup.c b/arch/ia64/hp/sim/hpsim_setup.c index f2297192a582..f629e903ebc7 100644 --- a/arch/ia64/hp/sim/hpsim_setup.c +++ b/arch/ia64/hp/sim/hpsim_setup.c @@ -21,6 +21,7 @@ #include <asm/machvec.h> #include <asm/pgtable.h> #include <asm/sal.h> +#include <asm/hpsim.h> #include "hpsim_ssc.h" @@ -41,11 +42,5 @@ hpsim_setup (char **cmdline_p) { ROOT_DEV = Root_SDA1; /* default to first SCSI drive */ -#ifdef CONFIG_HP_SIMSERIAL_CONSOLE - { - extern struct console hpsim_cons; - if (ia64_platform_is("hpsim")) - register_console(&hpsim_cons); - } -#endif + simcons_register(); } diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c index f26077a773d5..08b117e2c54b 100644 --- a/arch/ia64/hp/sim/simeth.c +++ b/arch/ia64/hp/sim/simeth.c @@ -22,6 +22,9 @@ #include <linux/bitops.h> #include <asm/system.h> #include <asm/irq.h> +#include <asm/hpsim.h> + +#include "hpsim_ssc.h" #define SIMETH_RECV_MAX 10 @@ -35,12 +38,6 @@ #define SIMETH_FRAME_SIZE ETH_FRAME_LEN -#define SSC_NETDEV_PROBE 100 -#define SSC_NETDEV_SEND 101 -#define SSC_NETDEV_RECV 102 -#define SSC_NETDEV_ATTACH 103 -#define SSC_NETDEV_DETACH 104 - #define NETWORK_INTR 8 struct simeth_local { @@ -124,9 +121,6 @@ simeth_probe (void) return r; } -extern long ia64_ssc (long, long, long, long, int); -extern void ia64_ssc_connect_irq (long intr, long irq); - static inline int netdev_probe(char *name, unsigned char *ether) { @@ -300,6 +294,9 @@ simeth_device_event(struct notifier_block *this,unsigned long event, void *ptr) return NOTIFY_DONE; } + if (dev->nd_net != &init_net) + return NOTIFY_DONE; + if ( event != NETDEV_UP && event != NETDEV_DOWN ) return NOTIFY_DONE; /* diff --git a/arch/ia64/hp/sim/simscsi.c b/arch/ia64/hp/sim/simscsi.c index bb87682bbb1b..4552a1cf5b33 100644 --- a/arch/ia64/hp/sim/simscsi.c +++ b/arch/ia64/hp/sim/simscsi.c @@ -14,6 +14,7 @@ #include <linux/kernel.h> #include <linux/timer.h> #include <asm/irq.h> +#include "hpsim_ssc.h" #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> @@ -59,8 +60,6 @@ struct disk_stat { unsigned count; }; -extern long ia64_ssc (long arg0, long arg1, long arg2, long arg3, int nr); - static int desc[16] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; @@ -101,7 +100,7 @@ simscsi_interrupt (unsigned long val) { struct scsi_cmnd *sc; - while ((sc = queue[rd].sc) != 0) { + while ((sc = queue[rd].sc) != NULL) { atomic_dec(&num_reqs); queue[rd].sc = NULL; if (DBG) @@ -122,48 +121,22 @@ simscsi_biosparam (struct scsi_device *sdev, struct block_device *n, } static void -simscsi_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset, unsigned long len) -{ - struct disk_stat stat; - struct disk_req req; - - req.addr = __pa(sc->request_buffer); - req.len = len; /* # of bytes to transfer */ - - if (sc->request_bufflen < req.len) - return; - - stat.fd = desc[sc->device->id]; - if (DBG) - printk("simscsi_%s @ %lx (off %lx)\n", - mode == SSC_READ ? "read":"write", req.addr, offset); - ia64_ssc(stat.fd, 1, __pa(&req), offset, mode); - ia64_ssc(__pa(&stat), 0, 0, 0, SSC_WAIT_COMPLETION); - - if (stat.count == req.len) { - sc->result = GOOD; - } else { - sc->result = DID_ERROR << 16; - } -} - -static void simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset) { - int list_len = sc->use_sg; - struct scatterlist *sl = (struct scatterlist *)sc->request_buffer; + int i; + struct scatterlist *sl; struct disk_stat stat; struct disk_req req; stat.fd = desc[sc->device->id]; - while (list_len) { + scsi_for_each_sg(sc, sl, scsi_sg_count(sc), i) { req.addr = __pa(page_address(sl->page) + sl->offset); req.len = sl->length; if (DBG) printk("simscsi_sg_%s @ %lx (off %lx) use_sg=%d len=%d\n", mode == SSC_READ ? "read":"write", req.addr, offset, - list_len, sl->length); + scsi_sg_count(sc) - i, sl->length); ia64_ssc(stat.fd, 1, __pa(&req), offset, mode); ia64_ssc(__pa(&stat), 0, 0, 0, SSC_WAIT_COMPLETION); @@ -173,8 +146,6 @@ simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset) return; } offset += sl->length; - sl++; - list_len--; } sc->result = GOOD; } @@ -190,10 +161,7 @@ simscsi_readwrite6 (struct scsi_cmnd *sc, int mode) unsigned long offset; offset = (((sc->cmnd[1] & 0x1f) << 16) | (sc->cmnd[2] << 8) | sc->cmnd[3])*512; - if (sc->use_sg > 0) - simscsi_sg_readwrite(sc, mode, offset); - else - simscsi_readwrite(sc, mode, offset, sc->cmnd[4]*512); + simscsi_sg_readwrite(sc, mode, offset); } static size_t @@ -230,26 +198,21 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode) | ((unsigned long)sc->cmnd[3] << 16) | ((unsigned long)sc->cmnd[4] << 8) | ((unsigned long)sc->cmnd[5] << 0))*512UL; - if (sc->use_sg > 0) - simscsi_sg_readwrite(sc, mode, offset); - else - simscsi_readwrite(sc, mode, offset, ((sc->cmnd[7] << 8) | sc->cmnd[8])*512); + simscsi_sg_readwrite(sc, mode, offset); } static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len) { - int scatterlen = sc->use_sg; + int i; + unsigned thislen; struct scatterlist *slp; - if (scatterlen == 0) - memcpy(sc->request_buffer, buf, len); - else for (slp = (struct scatterlist *)sc->request_buffer; - scatterlen-- > 0 && len > 0; slp++) { - unsigned thislen = min(len, slp->length); - + scsi_for_each_sg(sc, slp, scsi_sg_count(sc), i) { + if (!len) + break; + thislen = min(len, slp->length); memcpy(page_address(slp->page) + slp->offset, buf, thislen); - slp++; len -= thislen; } } @@ -275,7 +238,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) if (target_id <= 15 && sc->device->lun == 0) { switch (sc->cmnd[0]) { case INQUIRY: - if (sc->request_bufflen < 35) { + if (scsi_bufflen(sc) < 35) { break; } sprintf (fname, "%s%c", simscsi_root, 'a' + target_id); @@ -328,7 +291,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) break; case READ_CAPACITY: - if (desc[target_id] < 0 || sc->request_bufflen < 8) { + if (desc[target_id] < 0 || scsi_bufflen(sc) < 8) { break; } buf = localbuf; @@ -350,7 +313,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *)) case MODE_SENSE: case MODE_SENSE_10: /* sd.c uses this to determine whether disk does write-caching. */ - simscsi_fillresult(sc, (char *)empty_zero_page, sc->request_bufflen); + simscsi_fillresult(sc, (char *)empty_zero_page, scsi_bufflen(sc)); sc->result = GOOD; break; |