CapROS DevicePrivs Object

CapROS Home > Object Reference > Restricted Objects > DevicePrivs Object

Description

The DevicePrivs key is used by device drivers to reserve IRQs, receive interrupts, and access device memory that is mapped as physical memory.

Many operations have an irq parameter. This is a number identifying a source of interrupts that can be separately identified and enabled/disabled. The precise meaning is platform-dependent.


Operations

Allocate IRQ
IDL C definition: result_t capros_DevPrivs_allocIRQ(cap_t _self, uint32_t irq);

This operation reserves the specified IRQ, so that if another driver attempts to allocate the same IRQ, it will be told that it is not available. (However, only courtesy prevents the other driver from going ahead and using the IRQ.)

Result RC_OK Success. Any pending interrupt is cleared, and interrupts are enabled for the specified IRQ.
RC_capros_key_RequestError The specified irq exceeded the number of IRQs available in the hardware.
RC_capros_DevPrivs_AllocFail The specified irq was already allocated or already has a handler.

Release IRQ
IDL C definition: result_t capros_DevPrivs_releaseIRQ(cap_t _self, uint32_t irq);

This operation releases the specified IRQ so that other drivers may allocate it.

Result RC_OK Success. Any pending interrupt is cleared, and interrupts are disabled for the specified IRQ.
RC_capros_key_RequestError The specified irq exceeded the number of IRQs available in the hardware.
RC_capros_DevPrivs_AllocFail The specified irq was already free.

Enable IRQ
IDL C definition: result_t capros_DevPrivs_enableIRQ(cap_t _self, uint32_t irq);

This operation enables interrupts on the specified IRQ.
Result RC_OK Success.
RC_capros_key_RequestError The specified irq exceeded the number of IRQs available in the hardware.
RC_capros_DevPrivs_AllocFail The specified irq is not allocated.

Disable IRQ
IDL C definition: result_t capros_DevPrivs_disableIRQ(cap_t _self, uint32_t irq);

This operation disables interrupts on the specified IRQ.
Result RC_OK Success.
RC_capros_key_RequestError The specified irq exceeded the number of IRQs available in the hardware.
RC_capros_DevPrivs_AllocFail The specified irq is not allocated.

Wait IRQ
IDL C definition: result_t capros_DevPrivs_waitIRQ(cap_t _self, uint32_t irq);

This operation enables interrupts on the specified IRQ and then waits until an interrupt occurs. If there is a pending interrupt the operation returns immediately.

Result RC_OK Success. The pending interrupt flag for the specified IRQ is cleared.
RC_capros_key_RequestError The specified irq exceeded the number of IRQs available in the hardware.
RC_capros_DevPrivs_AllocFail The specified irq is not allocated.

Publish Memory
IDL C definition: result_t capros_DevPrivs_publishMem(cap_t _self, uint32_t start, uint32_t end, cap_t rangeCap);

This operation instructs the kernel to allow a range of physical addresses to be mapped into virtual memory. The physical pages will be available at OIDs beginning with OID_RESERVED_PHYSRANGE + (start / EROS_PAGE_SIZE) * EROS_OBJECTS_PER_FRAME.

If the kernel can't allocate the data structures to track the memory, the kernel crashes.

start The first physical address of the range. Only 32-bit addresses are supported.
end The last physical address in the range, plus one. Only 32-bit addresses are supported.
Result RC_OK Success.
RC_capros_key_RequestError start or end was not on a page boundary, or end was not greater than start.
RC_capros_key_NoAccess The specified memory region overlaps with a region already known to the kernel. For the overlapping addresses, this operation is unnecessary because the kernel already supports mapping the addresses.

Get Alleged Type Code
IDL C definition: result_t capros_key_getType(cap_t _self, capros_key_type *_retVal);
_retVal The variable at the address in _retVal receives the value IKT_DevicePrivs.
Result RC_OK Success.

SourceForge.net Logo Copyright 2005, 2008, 2010 by Strawberry Development Group. All rights reserved. For terms of redistribution, see the GNU General Public License This material is based upon work supported by the US Defense Advanced Research Projects Agency under Contract No. W31P4Q-07-C-0070. Approved for public release, distribution unlimited.