27 #ifndef _AIC94XX_REG_H_
28 #define _AIC94XX_REG_H_
34 #define AIC9410_DEV_REV_B0 0x8
37 #define REG_BASE_ADDR 0xB8000000
38 #define REG_BASE_ADDR_CSEQCIO 0xB8002000
39 #define REG_BASE_ADDR_EXSI 0xB8042800
41 #define MBAR0_SWA_SIZE 0x58
43 #define MBAR0_SWC_SIZE 0x8
46 #define OCM_BASE_ADDR 0xA0000000
47 #define OCM_MAX_SIZE 0x20000
50 #define ALL_BASE_ADDR OCM_BASE_ADDR
53 #define PCI_IOBAR_OFFSET 4
55 #define PCI_CONF_MBAR1 0x6C
56 #define PCI_CONF_MBAR0_SWA 0x70
57 #define PCI_CONF_MBAR0_SWB 0x74
58 #define PCI_CONF_MBAR0_SWC 0x78
59 #define PCI_CONF_MBAR_KEY 0x7C
60 #define PCI_CONF_FLSH_BAR 0xB8
77 #define ASD_READ_OCM(type, ord, S) \
78 static inline type asd_read_ocm_##ord (struct asd_ha_struct *asd_ha, \
81 struct asd_ha_addrspace *io_handle = &asd_ha->io_handle[1]; \
82 type val = read##S (io_handle->addr + (unsigned long) offs); \
91 #define ASD_WRITE_OCM(type, ord, S) \
92 static inline void asd_write_ocm_##ord (struct asd_ha_struct *asd_ha, \
95 struct asd_ha_addrspace *io_handle = &asd_ha->io_handle[1]; \
96 write##S (val, io_handle->addr + (unsigned long) offs); \
104 #define ASD_DDBSITE_READ(type, ord) \
105 static inline type asd_ddbsite_read_##ord (struct asd_ha_struct *asd_ha, \
109 asd_write_reg_word(asd_ha, ALTCIOADR, MnDDB_SITE + offs); \
110 asd_write_reg_word(asd_ha, ADDBPTR, ddb_site_no); \
111 return asd_read_reg_##ord (asd_ha, CTXACCESS); \
122 return asd_ddbsite_read_word(asd_ha, ddb_site_no,
125 return asd_ddbsite_read_word(asd_ha, ddb_site_no,
130 #define ASD_DDBSITE_WRITE(type, ord) \
131 static inline void asd_ddbsite_write_##ord (struct asd_ha_struct *asd_ha, \
133 u16 offs, type val) \
135 asd_write_reg_word(asd_ha, ALTCIOADR, MnDDB_SITE + offs); \
136 asd_write_reg_word(asd_ha, ADDBPTR, ddb_site_no); \
137 asd_write_reg_##ord (asd_ha, CTXACCESS, val); \
143 static inline void asd_ddbsite_write_byte(
struct asd_ha_struct *asd_ha,
148 u16 rval = asd_ddbsite_read_word(asd_ha, ddb_site_no, base);
150 rval = (val << 8) | (rval & 0xFF);
152 rval = (rval & 0xFF00) | val;
153 asd_ddbsite_write_word(asd_ha, ddb_site_no, base, rval);
157 #define ASD_SCBSITE_READ(type, ord) \
158 static inline type asd_scbsite_read_##ord (struct asd_ha_struct *asd_ha, \
162 asd_write_reg_word(asd_ha, ALTCIOADR, MnSCB_SITE + offs); \
163 asd_write_reg_word(asd_ha, ASCBPTR, scb_site_no); \
164 return asd_read_reg_##ord (asd_ha, CTXACCESS); \
175 return asd_scbsite_read_word(asd_ha, scb_site_no,
178 return asd_scbsite_read_word(asd_ha, scb_site_no,
183 #define ASD_SCBSITE_WRITE(type, ord) \
184 static inline void asd_scbsite_write_##ord (struct asd_ha_struct *asd_ha, \
186 u16 offs, type val) \
188 asd_write_reg_word(asd_ha, ALTCIOADR, MnSCB_SITE + offs); \
189 asd_write_reg_word(asd_ha, ASCBPTR, scb_site_no); \
190 asd_write_reg_##ord (asd_ha, CTXACCESS, val); \
196 static inline void asd_scbsite_write_byte(
struct asd_ha_struct *asd_ha,
200 u16 base = offs & ~1;
201 u16 rval = asd_scbsite_read_word(asd_ha, scb_site_no, base);
203 rval = (val << 8) | (rval & 0xFF);
205 rval = (rval & 0xFF00) | val;
206 asd_scbsite_write_word(asd_ha, scb_site_no, base, rval);
224 static inline int asd_ddbsite_update_word(
struct asd_ha_struct *asd_ha,
225 u16 ddb_site_no,
u16 offs,
229 u16 oval = asd_ddbsite_read_word(asd_ha, ddb_site_no, offs);
245 static inline int asd_ddbsite_update_byte(
struct asd_ha_struct *asd_ha,
246 u16 ddb_site_no,
u16 offs,
247 u8 _oldval,
u8 _newval)
249 u16 base = offs & ~1;
251 u16 nval = asd_ddbsite_read_word(asd_ha, ddb_site_no, base);
253 if ((nval >> 8) != _oldval)
255 nval = (_newval << 8) | (nval & 0xFF);
256 oval = (_oldval << 8) | (nval & 0xFF);
258 if ((nval & 0xFF) != _oldval)
260 nval = (nval & 0xFF00) | _newval;
261 oval = (nval & 0xFF00) | _oldval;
263 return asd_ddbsite_update_word(asd_ha, ddb_site_no, base, oval, nval);
277 return ctxmemsize ? 65536 : 32768;
283 return ctxmemsize ? 8192 : 4096;
286 static inline void asd_disable_ints(
struct asd_ha_struct *asd_ha)
291 static inline void asd_enable_ints(
struct asd_ha_struct *asd_ha)