--- trunk/src/devices/dev_asc.c 2007/10/08 16:19:28 21 +++ trunk/src/devices/dev_asc.c 2007/10/08 16:19:37 22 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2005 Anders Gavare. All rights reserved. + * Copyright (C) 2003-2006 Anders Gavare. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -25,10 +25,9 @@ * SUCH DAMAGE. * * - * $Id: dev_asc.c,v 1.76 2005/11/13 00:14:08 debug Exp $ + * $Id: dev_asc.c,v 1.79 2006/01/01 13:17:16 debug Exp $ * - * 'asc' SCSI controller for some DECstation/DECsystem models, and - * for PICA-61. + * 'asc' SCSI controller for some DECstation/DECsystem models and PICA-61. * * Supposed to support SCSI-1 and SCSI-2. I've not yet found any docs * on NCR53C9X, so I'll try to implement this device from LSI53CF92A docs @@ -50,6 +49,10 @@ * TODO: This module needs a clean-up, and some testing to see that * it works will all OSes that might use it (NetBSD, OpenBSD, * Ultrix, Linux, Mach, OSF/1, Sprite, ...) + * + * Running Linux/DECstation 2.4.26 with no scsi disks attached causes + * a warning message to be printed by Linux. (Whether this is a bug, + * is is the way it works on real hardware, I don't know.) */ #include @@ -309,8 +312,8 @@ fatal("no incoming DMA data?\n"); res = 0; } else { - int len = d->xferp->data_in_len; - int len2 = d->reg_wo[NCR_TCL] + + size_t len = d->xferp->data_in_len; + size_t len2 = d->reg_wo[NCR_TCL] + d->reg_wo[NCR_TCM] * 256; if (len2 == 0) len2 = 65536; @@ -751,9 +754,7 @@ /* * dev_asc_address_reg_access(): */ -int dev_asc_address_reg_access(struct cpu *cpu, struct memory *mem, - uint64_t relative_addr, unsigned char *data, size_t len, - int writeflag, void *extra) +DEVICE_ACCESS(asc_address_reg) { struct asc_data *d = extra; @@ -773,9 +774,7 @@ /* * dev_asc_dma_access(): */ -int dev_asc_dma_access(struct cpu *cpu, struct memory *mem, - uint64_t relative_addr, unsigned char *data, size_t len, - int writeflag, void *extra) +DEVICE_ACCESS(asc_dma) { struct asc_data *d = extra; @@ -816,9 +815,7 @@ /* * dev_asc_access(): */ -int dev_asc_access(struct cpu *cpu, struct memory *mem, - uint64_t relative_addr, unsigned char *data, size_t len, - int writeflag, void *extra) +DEVICE_ACCESS(asc) { int regnr; struct asc_data *d = extra; @@ -1277,8 +1274,7 @@ d->dma_controller_data = dma_controller_data; memory_device_register(mem, "asc", baseaddr, - mode == DEV_ASC_PICA? - DEV_ASC_PICA_LENGTH : DEV_ASC_DEC_LENGTH, + mode == DEV_ASC_PICA? DEV_ASC_PICA_LENGTH : DEV_ASC_DEC_LENGTH, dev_asc_access, d, DM_DEFAULT, NULL); if (mode == DEV_ASC_DEC) {