1 |
/* |
/* |
2 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-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_pccmos.c,v 1.15 2005/11/21 22:27:18 debug Exp $ |
* $Id: dev_pccmos.c,v 1.22 2006/02/09 20:02:59 debug Exp $ |
29 |
* |
* |
30 |
* PC CMOS/RTC device. |
* PC CMOS/RTC device (ISA ports 0x70 and 0x71). |
31 |
* |
* |
32 |
* The main point of this device is to be a "PC style wrapper" for accessing |
* The main point of this device is to be a "PC style wrapper" for accessing |
33 |
* the MC146818 (the RTC). In most other respects, this device is bogus, and |
* the MC146818 (the RTC). In most other respects, this device is bogus, and |
59 |
/* |
/* |
60 |
* dev_pccmos_access(): |
* dev_pccmos_access(): |
61 |
*/ |
*/ |
62 |
int dev_pccmos_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(pccmos) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
63 |
{ |
{ |
64 |
struct pccmos_data *d = (struct pccmos_data *) extra; |
struct pccmos_data *d = (struct pccmos_data *) extra; |
65 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
114 |
} |
} |
115 |
|
|
116 |
|
|
117 |
/* |
DEVINIT(pccmos) |
|
* devinit_pccmos(): |
|
|
*/ |
|
|
int devinit_pccmos(struct devinit *devinit) |
|
118 |
{ |
{ |
119 |
struct pccmos_data *d = malloc(sizeof(struct pccmos_data)); |
struct pccmos_data *d = malloc(sizeof(struct pccmos_data)); |
120 |
int irq_nr, type = MC146818_PC_CMOS, len = DEV_PCCMOS_LENGTH; |
int irq_nr, type = MC146818_PC_CMOS, len = DEV_PCCMOS_LENGTH; |
140 |
irq_nr = 8 + 8; |
irq_nr = 8 + 8; |
141 |
type = MC146818_ALGOR; |
type = MC146818_ALGOR; |
142 |
break; |
break; |
143 |
|
case MACHINE_ARC: |
144 |
|
fatal("\nARC pccmos: TODO\n\n"); |
145 |
|
irq_nr = 8 + 8; /* TODO */ |
146 |
|
type = MC146818_ALGOR; |
147 |
|
break; |
148 |
case MACHINE_EVBMIPS: |
case MACHINE_EVBMIPS: |
149 |
/* Malta etc. */ |
/* Malta etc. */ |
150 |
irq_nr = 8 + 8; |
irq_nr = 8 + 8; |
155 |
break; |
break; |
156 |
case MACHINE_BEBOX: |
case MACHINE_BEBOX: |
157 |
case MACHINE_PREP: |
case MACHINE_PREP: |
158 |
|
case MACHINE_MVMEPPC: |
159 |
|
irq_nr = 32 + 8; |
160 |
|
break; |
161 |
|
case MACHINE_SHARK: |
162 |
|
case MACHINE_IYONIX: |
163 |
|
/* TODO */ |
164 |
irq_nr = 32 + 8; |
irq_nr = 32 + 8; |
165 |
break; |
break; |
166 |
default:fatal("devinit_pccmos(): unimplemented machine type" |
default:fatal("devinit_pccmos(): unimplemented machine type" |