25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_turbochannel.c,v 1.48 2006/12/30 13:30:59 debug Exp $ |
* $Id: dev_turbochannel.c,v 1.50 2007/06/15 19:57:34 debug Exp $ |
29 |
* |
* |
30 |
* Generic framework for TURBOchannel devices, used in DECstation machines. |
* COMMENT: TURBOchannel bus framework, used in DECstation machines |
31 |
*/ |
*/ |
32 |
|
|
33 |
#include <stdio.h> |
#include <stdio.h> |
41 |
#include "sfbreg.h" |
#include "sfbreg.h" |
42 |
|
|
43 |
|
|
44 |
#define DEVICE_NAME_BUFLEN 9 |
#define DEVICE_MAX_NAMELEN 9 |
45 |
#define CARD_NAME_BUFLEN 9 |
#define CARD_NAME_BUFLEN 9 |
46 |
#define CARD_FIRMWARE_BUFLEN 5 |
#define CARD_FIRMWARE_BUFLEN 5 |
47 |
|
|
52 |
|
|
53 |
int rom_skip; |
int rom_skip; |
54 |
|
|
55 |
char device_name[DEVICE_NAME_BUFLEN]; /* NUL-terminated */ |
char device_name[DEVICE_MAX_NAMELEN]; /* NUL-terminated */ |
56 |
|
|
57 |
/* These should be terminated with spaces */ |
/* These should be terminated with spaces */ |
58 |
char card_firmware_version[CARD_NAME_BUFLEN]; |
char card_firmware_version[CARD_NAME_BUFLEN]; |
62 |
}; |
}; |
63 |
|
|
64 |
|
|
|
/* |
|
|
* dev_turbochannel_access(): |
|
|
*/ |
|
65 |
DEVICE_ACCESS(turbochannel) |
DEVICE_ACCESS(turbochannel) |
66 |
{ |
{ |
67 |
struct turbochannel_data *d = extra; |
struct turbochannel_data *d = extra; |
190 |
exit(1); |
exit(1); |
191 |
} |
} |
192 |
|
|
193 |
d = malloc(sizeof(struct turbochannel_data)); |
CHECK_ALLOCATION(d = malloc(sizeof(struct turbochannel_data))); |
|
if (d == NULL) { |
|
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
194 |
memset(d, 0, sizeof(struct turbochannel_data)); |
memset(d, 0, sizeof(struct turbochannel_data)); |
195 |
|
|
196 |
d->slot_nr = slot_nr; |
d->slot_nr = slot_nr; |
197 |
d->baseaddr = baseaddr; |
d->baseaddr = baseaddr; |
198 |
d->endaddr = endaddr; |
d->endaddr = endaddr; |
199 |
|
|
200 |
strlcpy(d->device_name, device_name, DEVICE_NAME_BUFLEN); |
strlcpy(d->device_name, device_name, DEVICE_MAX_NAMELEN); |
201 |
|
|
202 |
strncpy(d->card_firmware_version, "V5.3a ", CARD_NAME_BUFLEN); |
strncpy(d->card_firmware_version, "V5.3a ", CARD_NAME_BUFLEN); |
203 |
strncpy(d->card_vendor_name, "DEC ", CARD_NAME_BUFLEN); |
strncpy(d->card_vendor_name, "DEC ", CARD_NAME_BUFLEN); |
316 |
d->rom_skip = rom_skip; |
d->rom_skip = rom_skip; |
317 |
|
|
318 |
nlen = strlen(device_name) + 30; |
nlen = strlen(device_name) + 30; |
319 |
name2 = malloc(nlen); |
CHECK_ALLOCATION(name2 = malloc(nlen)); |
320 |
if (name2 == NULL) { |
|
|
fprintf(stderr, "out of memory in dev_turbochannel_init()\n"); |
|
|
exit(1); |
|
|
} |
|
321 |
if (*device_name) |
if (*device_name) |
322 |
snprintf(name2, nlen, "turbochannel [%s]", device_name); |
snprintf(name2, nlen, "turbochannel [%s]", device_name); |
323 |
else |
else |