diff --git a/include/l4/api/capability.h b/include/l4/api/capability.h index 72ecc80..4b58399 100644 --- a/include/l4/api/capability.h +++ b/include/l4/api/capability.h @@ -89,8 +89,8 @@ struct capability { /* Use count of resource */ unsigned long used; - /* User-defined attributes on capability (like devtypes) */ - unsigned int uattr; + /* User attributes on capability such as device type, irqno */ + u32 uattr[2]; }; #endif /* __API_CAPABILITY_H__ */ diff --git a/include/l4/generic/cap-types.h b/include/l4/generic/cap-types.h index 657cc58..118f9b3 100644 --- a/include/l4/generic/cap-types.h +++ b/include/l4/generic/cap-types.h @@ -52,16 +52,17 @@ #define CAP_DEVNUM_MASK 0xFFFF0000 #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) \ - {(c)->uattr &= ~CAP_DEVTYPE_MASK; \ - (c)->uattr |= CAP_DEVTYPE_MASK & devtype;} + {(c)->uattr[0] &= ~CAP_DEVTYPE_MASK; \ + (c)->uattr[0] |= CAP_DEVTYPE_MASK & devtype;} #define cap_set_devnum(c, devnum) \ - {(c)->uattr &= ~CAP_DEVNUM_MASK; \ - (c)->uattr |= CAP_DEVNUM_MASK & devnum;} + {(c)->uattr[0] &= ~CAP_DEVNUM_MASK; \ + (c)->uattr[0] |= CAP_DEVNUM_MASK & devnum;} #define cap_devnum(c) \ - (((c)->uattr & CAP_DEVNUM_MASK) >> CAP_DEVNUM_SHIFT) -#define cap_devtype(c) ((c)->uattr & CAP_DEVTYPE_MASK) + (((c)->uattr[0] & CAP_DEVNUM_MASK) >> CAP_DEVNUM_SHIFT) +#define cap_devtype(c) ((c)->uattr[0] & CAP_DEVTYPE_MASK) +#define cap_irqno(c) ((c)->uattr[1]) /* * Access permissions diff --git a/include/l4/generic/container.h b/include/l4/generic/container.h index 09c59ad..08e837b 100644 --- a/include/l4/generic/container.h +++ b/include/l4/generic/container.h @@ -60,7 +60,7 @@ struct cap_info { unsigned long start; unsigned long end; unsigned long size; - unsigned int uattr; /* User-level attributes (like device types) */ + unsigned int uattr[2]; /* User-level attributes (like device types) */ }; diff --git a/include/l4/generic/tcb.h b/include/l4/generic/tcb.h index 799ec77..b160d75 100644 --- a/include/l4/generic/tcb.h +++ b/include/l4/generic/tcb.h @@ -48,6 +48,7 @@ static inline l4id_t tid_to_cid(l4id_t tid) 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) { /* Special ids have top 2 nibbles all set */ diff --git a/src/generic/resource.c b/src/generic/resource.c index 3992102..d65114d 100644 --- a/src/generic/resource.c +++ b/src/generic/resource.c @@ -336,7 +336,7 @@ int memcap_request_device(struct cap_list *cap_list, list_foreach_removable_struct(cap, n, &cap_list->caps, list) { if (cap->start == devcap->start && cap->end == devcap->end && - cap->uattr == devcap->uattr) { + cap_is_devmem(cap)) { /* Unlink only. This is boot memory */ list_remove(&cap->list); return 0; @@ -347,7 +347,7 @@ int memcap_request_device(struct cap_list *cap_list, "capabilities start=0x%lx, end=0x%lx " "uattr=0x%x\n", __KERNELNAME__, __pfn_to_addr(devcap->start), - __pfn_to_addr(devcap->end), devcap->uattr); + __pfn_to_addr(devcap->end), devcap->uattr[0]); BUG(); } @@ -849,7 +849,7 @@ int process_cap_info(struct cap_info *cap, &kres->virtmem_free, cap->start, cap->end); } else if (cap_type(cap) == CAP_TYPE_MAP_PHYSMEM) { - if (!cap_is_devmem(cap)) + if (cap_is_devmem(cap)) memcap_unmap(&kres->physmem_used, &kres->physmem_free, cap->start, cap->end);