mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Added a new uattr word to capabilities.
The new word is for irq numbers.
This commit is contained in:
@@ -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__ */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) */
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user