Added a new uattr word to capabilities.

The new word is for irq numbers.
This commit is contained in:
Bahadir Balban
2009-11-23 14:37:37 +02:00
parent 1f32e0ce0e
commit b994083e27
5 changed files with 15 additions and 13 deletions

View File

@@ -89,8 +89,8 @@ struct capability {
/* Use count of resource */ /* Use count of resource */
unsigned long used; unsigned long used;
/* User-defined attributes on capability (like devtypes) */ /* User attributes on capability such as device type, irqno */
unsigned int uattr; u32 uattr[2];
}; };
#endif /* __API_CAPABILITY_H__ */ #endif /* __API_CAPABILITY_H__ */

View File

@@ -52,16 +52,17 @@
#define CAP_DEVNUM_MASK 0xFFFF0000 #define CAP_DEVNUM_MASK 0xFFFF0000
#define CAP_DEVNUM_SHIFT 16 #define CAP_DEVNUM_SHIFT 16
#define cap_is_devmem(c) (c)->uattr #define cap_is_devmem(c) (c)->uattr[0]
#define cap_set_devtype(c, devtype) \ #define cap_set_devtype(c, devtype) \
{(c)->uattr &= ~CAP_DEVTYPE_MASK; \ {(c)->uattr[0] &= ~CAP_DEVTYPE_MASK; \
(c)->uattr |= CAP_DEVTYPE_MASK & devtype;} (c)->uattr[0] |= CAP_DEVTYPE_MASK & devtype;}
#define cap_set_devnum(c, devnum) \ #define cap_set_devnum(c, devnum) \
{(c)->uattr &= ~CAP_DEVNUM_MASK; \ {(c)->uattr[0] &= ~CAP_DEVNUM_MASK; \
(c)->uattr |= CAP_DEVNUM_MASK & devnum;} (c)->uattr[0] |= CAP_DEVNUM_MASK & devnum;}
#define cap_devnum(c) \ #define cap_devnum(c) \
(((c)->uattr & CAP_DEVNUM_MASK) >> CAP_DEVNUM_SHIFT) (((c)->uattr[0] & CAP_DEVNUM_MASK) >> CAP_DEVNUM_SHIFT)
#define cap_devtype(c) ((c)->uattr & CAP_DEVTYPE_MASK) #define cap_devtype(c) ((c)->uattr[0] & CAP_DEVTYPE_MASK)
#define cap_irqno(c) ((c)->uattr[1])
/* /*
* Access permissions * Access permissions

View File

@@ -60,7 +60,7 @@ struct cap_info {
unsigned long start; unsigned long start;
unsigned long end; unsigned long end;
unsigned long size; unsigned long size;
unsigned int uattr; /* User-level attributes (like device types) */ unsigned int uattr[2]; /* User-level attributes (like device types) */
}; };

View File

@@ -48,6 +48,7 @@ static inline l4id_t tid_to_cid(l4id_t tid)
return (tid & TASK_CID_MASK) >> TASK_CID_SHIFT; return (tid & TASK_CID_MASK) >> TASK_CID_SHIFT;
} }
/* Values that rather have special meaning instead of an id value */
static inline int tid_special_value(l4id_t id) static inline int tid_special_value(l4id_t id)
{ {
/* Special ids have top 2 nibbles all set */ /* Special ids have top 2 nibbles all set */

View File

@@ -336,7 +336,7 @@ int memcap_request_device(struct cap_list *cap_list,
list_foreach_removable_struct(cap, n, &cap_list->caps, list) { list_foreach_removable_struct(cap, n, &cap_list->caps, list) {
if (cap->start == devcap->start && if (cap->start == devcap->start &&
cap->end == devcap->end && cap->end == devcap->end &&
cap->uattr == devcap->uattr) { cap_is_devmem(cap)) {
/* Unlink only. This is boot memory */ /* Unlink only. This is boot memory */
list_remove(&cap->list); list_remove(&cap->list);
return 0; return 0;
@@ -347,7 +347,7 @@ int memcap_request_device(struct cap_list *cap_list,
"capabilities start=0x%lx, end=0x%lx " "capabilities start=0x%lx, end=0x%lx "
"uattr=0x%x\n", __KERNELNAME__, "uattr=0x%x\n", __KERNELNAME__,
__pfn_to_addr(devcap->start), __pfn_to_addr(devcap->start),
__pfn_to_addr(devcap->end), devcap->uattr); __pfn_to_addr(devcap->end), devcap->uattr[0]);
BUG(); BUG();
} }
@@ -849,7 +849,7 @@ int process_cap_info(struct cap_info *cap,
&kres->virtmem_free, &kres->virtmem_free,
cap->start, cap->end); cap->start, cap->end);
} else if (cap_type(cap) == CAP_TYPE_MAP_PHYSMEM) { } else if (cap_type(cap) == CAP_TYPE_MAP_PHYSMEM) {
if (!cap_is_devmem(cap)) if (cap_is_devmem(cap))
memcap_unmap(&kres->physmem_used, memcap_unmap(&kres->physmem_used,
&kres->physmem_free, &kres->physmem_free,
cap->start, cap->end); cap->start, cap->end);