1 |
/* |
/* |
2 |
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $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 $ |
29 |
* |
* |
30 |
* 'asc' SCSI controller for some DECstation/DECsystem models, and |
* 'asc' SCSI controller for some DECstation/DECsystem models and PICA-61. |
|
* for PICA-61. |
|
31 |
* |
* |
32 |
* Supposed to support SCSI-1 and SCSI-2. I've not yet found any docs |
* Supposed to support SCSI-1 and SCSI-2. I've not yet found any docs |
33 |
* on NCR53C9X, so I'll try to implement this device from LSI53CF92A docs |
* on NCR53C9X, so I'll try to implement this device from LSI53CF92A docs |
49 |
* TODO: This module needs a clean-up, and some testing to see that |
* TODO: This module needs a clean-up, and some testing to see that |
50 |
* it works will all OSes that might use it (NetBSD, OpenBSD, |
* it works will all OSes that might use it (NetBSD, OpenBSD, |
51 |
* Ultrix, Linux, Mach, OSF/1, Sprite, ...) |
* Ultrix, Linux, Mach, OSF/1, Sprite, ...) |
52 |
|
* |
53 |
|
* Running Linux/DECstation 2.4.26 with no scsi disks attached causes |
54 |
|
* a warning message to be printed by Linux. (Whether this is a bug, |
55 |
|
* is is the way it works on real hardware, I don't know.) |
56 |
*/ |
*/ |
57 |
|
|
58 |
#include <stdio.h> |
#include <stdio.h> |
312 |
fatal("no incoming DMA data?\n"); |
fatal("no incoming DMA data?\n"); |
313 |
res = 0; |
res = 0; |
314 |
} else { |
} else { |
315 |
int len = d->xferp->data_in_len; |
size_t len = d->xferp->data_in_len; |
316 |
int len2 = d->reg_wo[NCR_TCL] + |
size_t len2 = d->reg_wo[NCR_TCL] + |
317 |
d->reg_wo[NCR_TCM] * 256; |
d->reg_wo[NCR_TCM] * 256; |
318 |
if (len2 == 0) |
if (len2 == 0) |
319 |
len2 = 65536; |
len2 = 65536; |
754 |
/* |
/* |
755 |
* dev_asc_address_reg_access(): |
* dev_asc_address_reg_access(): |
756 |
*/ |
*/ |
757 |
int dev_asc_address_reg_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(asc_address_reg) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
758 |
{ |
{ |
759 |
struct asc_data *d = extra; |
struct asc_data *d = extra; |
760 |
|
|
774 |
/* |
/* |
775 |
* dev_asc_dma_access(): |
* dev_asc_dma_access(): |
776 |
*/ |
*/ |
777 |
int dev_asc_dma_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(asc_dma) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
778 |
{ |
{ |
779 |
struct asc_data *d = extra; |
struct asc_data *d = extra; |
780 |
|
|
815 |
/* |
/* |
816 |
* dev_asc_access(): |
* dev_asc_access(): |
817 |
*/ |
*/ |
818 |
int dev_asc_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(asc) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
819 |
{ |
{ |
820 |
int regnr; |
int regnr; |
821 |
struct asc_data *d = extra; |
struct asc_data *d = extra; |
1274 |
d->dma_controller_data = dma_controller_data; |
d->dma_controller_data = dma_controller_data; |
1275 |
|
|
1276 |
memory_device_register(mem, "asc", baseaddr, |
memory_device_register(mem, "asc", baseaddr, |
1277 |
mode == DEV_ASC_PICA? |
mode == DEV_ASC_PICA? DEV_ASC_PICA_LENGTH : DEV_ASC_DEC_LENGTH, |
|
DEV_ASC_PICA_LENGTH : DEV_ASC_DEC_LENGTH, |
|
1278 |
dev_asc_access, d, DM_DEFAULT, NULL); |
dev_asc_access, d, DM_DEFAULT, NULL); |
1279 |
|
|
1280 |
if (mode == DEV_ASC_DEC) { |
if (mode == DEV_ASC_DEC) { |