38 #define AMBAPP_FLAG_FFACT_DIR 0x100 39 #define AMBAPP_FLAG_FFACT 0x0f0 40 #define AMBAPP_FLAG_MBUS 0x00c 41 #define AMBAPP_FLAG_SBUS 0x003 44 #define DEV_TO_APB(adev) ((struct ambapp_apb_info *)((adev)->devinfo)) 45 #define DEV_TO_AHB(adev) ((struct ambapp_ahb_info *)((adev)->devinfo)) 46 #define DEV_TO_COMMON(adev) (((adev)->devinfo)) 66 unsigned int start[4];
70 unsigned int custom[3];
79 unsigned char dev_type;
81 unsigned short device;
91 unsigned short device;
100 unsigned int freq_hz;
107 unsigned int local_adr;
108 unsigned int remote_adr;
123 typedef int (*ambapp_func_t)(
struct ambapp_dev *dev,
int index,
void *arg);
125 #define DEV_IS_FREE(dev) (dev->owner == NULL) 126 #define DEV_IS_ALLOCATED(dev) (dev->owner != NULL) 129 #define OPTIONS_AHB_MSTS 0x00000001 130 #define OPTIONS_AHB_SLVS 0x00000002 131 #define OPTIONS_APB_SLVS 0x00000004 132 #define OPTIONS_ALL_DEVS (OPTIONS_AHB_MSTS|OPTIONS_AHB_SLVS|OPTIONS_APB_SLVS) 134 #define OPTIONS_FREE 0x00000010 135 #define OPTIONS_ALLOCATED 0x00000020 136 #define OPTIONS_ALL (OPTIONS_FREE|OPTIONS_ALLOCATED) 139 #define OPTIONS_DEPTH_FIRST 0x00000100 141 #define DEV_AHB_NONE 0 142 #define DEV_AHB_MST 1 143 #define DEV_AHB_SLV 2 144 #define DEV_APB_SLV 3 148 const unsigned int id;
149 const unsigned int custom[3];
150 const unsigned int mbar[4];
154 const unsigned int id;
155 const unsigned int iobar;
158 #define ambapp_pnp_vendor(id) (((id) >> 24) & 0xff) 159 #define ambapp_pnp_device(id) (((id) >> 12) & 0xfff) 160 #define ambapp_pnp_ver(id) (((id)>>5) & 0x1f) 161 #define ambapp_pnp_irq(id) ((id) & 0x1f) 163 #define ambapp_pnp_start(mbar) (((mbar) & 0xfff00000) & (((mbar) & 0xfff0) << 16)) 164 #define ambapp_pnp_mbar_mask(mbar) (((mbar)>>4) & 0xfff) 165 #define ambapp_pnp_mbar_type(mbar) ((mbar) & 0xf) 167 #define ambapp_pnp_apb_start(iobar, base) ((base) | ((((iobar) & 0xfff00000)>>12) & (((iobar) & 0xfff0)<<4)) ) 168 #define ambapp_pnp_apb_mask(iobar) ((~(ambapp_pnp_mbar_mask(iobar)<<8) & 0x000fffff) + 1) 170 #define AMBA_TYPE_AHBIO_ADDR(addr,base_ioarea) ((unsigned int)(base_ioarea) | ((addr) >> 12)) 172 #define AMBA_TYPE_APBIO 0x1 173 #define AMBA_TYPE_MEM 0x2 174 #define AMBA_TYPE_AHBIO 0x3 177 typedef void *(*ambapp_memcpy_t)(
197 extern int ambapp_scan(
200 ambapp_memcpy_t memfunc,
207 extern void ambapp_freq_init(
213 extern unsigned int ambapp_freq_get(
243 extern int ambapp_for_each(
245 unsigned int options,
260 extern int ambapp_find_by_idx(
struct ambapp_dev *dev,
int index,
void *pcount);
265 extern int ambapp_dev_count(
struct ambapp_bus *abus,
unsigned int options,
266 int vendor,
int device);
269 extern void ambapp_print(
struct ambapp_bus *abus,
int show_depth);
274 extern int ambapp_alloc_dev(
struct ambapp_dev *dev,
void *owner);
277 extern void ambapp_free_dev(
struct ambapp_dev *dev);
283 extern int ambapp_depth(
struct ambapp_dev *dev);
286 extern char *ambapp_device_id2str(
int vendor,
int id);
289 extern char *ambapp_vendor_id2str(
int vendor);
294 extern int ambapp_vendev_id2str(
int vendor,
int id,
char *buf);
298 extern int ambapp_find_apbslv(
304 extern int ambapp_find_apbslv_next(
311 extern int ambapp_find_apbslvs_next(
319 extern int ambapp_find_apbslvs(
326 extern int ambapp_find_ahbslv(
332 extern int ambapp_find_ahbslv_next(
339 extern int ambapp_find_ahbslvs_next(
347 extern int ambapp_find_ahbslvs(
355 extern int ambapp_get_number_ahbslv_devices(
360 extern int ambapp_get_number_apbslv_devices(
AMBA Plug & Play Bus Vendor and Device IDs.