Index: kernel/generic/include/ipc/ipc.h
===================================================================
--- kernel/generic/include/ipc/ipc.h	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ kernel/generic/include/ipc/ipc.h	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -38,11 +38,11 @@
 /* Length of data being transfered with IPC call */
 /* - the uspace may not be able to utilize full length */
-#define IPC_CALL_LEN    4
+#define IPC_CALL_LEN		4
 
 /** Maximum active async calls per thread */
 #ifdef CONFIG_DEBUG
-# define IPC_MAX_ASYNC_CALLS  4
+#define IPC_MAX_ASYNC_CALLS	4
 #else
-# define IPC_MAX_ASYNC_CALLS  4000
+#define IPC_MAX_ASYNC_CALLS	4000
 #endif
 
@@ -62,13 +62,15 @@
 #define IPC_CALL_NOTIF		(1 << 5)
 
-/* Flags of callid (the addresses are aligned at least to 4, 
- * that is why we can use bottom 2 bits of the call address
- */
-/** Type of this msg is 'answer' */
+/*
+ * Bits used in call hashes.
+ * The addresses are aligned at least to 4 that is why we can use the 2 least
+ * significant bits of the call address.
+ */
+/** Type of this call is 'answer' */
 #define IPC_CALLID_ANSWERED	1
-/** Type of this msg is 'notification' */
+/** Type of this call is 'notification' */
 #define IPC_CALLID_NOTIFICATION	2
 
-/* Return values from IPC_ASYNC */
+/* Return values from sys_ipc_call_async(). */
 #define IPC_CALLRET_FATAL	-1
 #define IPC_CALLRET_TEMPORARY	-2
@@ -112,5 +114,5 @@
  *                     - the caller obtains taskid of the called thread
  */
-#define IPC_M_CONNECT_TO_ME     1
+#define IPC_M_CONNECT_TO_ME	1
 /** Protocol for CONNECT - ME - TO
  *
@@ -131,9 +133,9 @@
  *
  */
-#define IPC_M_CONNECT_ME_TO     2
+#define IPC_M_CONNECT_ME_TO	2
 /** This message is sent to answerbox when the phone
  * is hung up
  */
-#define IPC_M_PHONE_HUNGUP      3
+#define IPC_M_PHONE_HUNGUP	3
 
 /** Send as_area over IPC 
@@ -145,5 +147,5 @@
  * - ARG1 - dst as_area base adress
  */
-#define IPC_M_AS_AREA_SEND      5
+#define IPC_M_AS_AREA_SEND	5
 
 /** Get as_area over IPC
@@ -157,12 +159,12 @@
  * - ARG2 - flags that will be used for sharing
  */
-#define IPC_M_AS_AREA_RECV      6
+#define IPC_M_AS_AREA_RECV	6
 
 
 /* Well-known methods */
-#define IPC_M_LAST_SYSTEM     511
-#define IPC_M_PING            512
+#define IPC_M_LAST_SYSTEM	511
+#define IPC_M_PING		512
 /* User methods */
-#define FIRST_USER_METHOD     1024
+#define FIRST_USER_METHOD	1024
 
 #ifdef KERNEL
@@ -204,15 +206,15 @@
 	waitq_t wq;
 
-	/** Phones connected to this answerbox */
+	/** Phones connected to this answerbox. */
 	link_t connected_phones;
-	/** Received calls */
+	/** Received calls. */
 	link_t calls;			
 	link_t dispatched_calls;	/* Should be hash table in the future */
 
-	/** Answered calls */
+	/** Answered calls. */
 	link_t answers;
 
 	SPINLOCK_DECLARE(irq_lock);
-	/** Notifications from IRQ handlers */
+	/** Notifications from IRQ handlers. */
 	link_t irq_notifs;
 	/** IRQs with notifications to this answerbox. */
@@ -230,15 +232,14 @@
 	int flags;
 
-	/* Identification of the caller */
+	/** Identification of the caller. */
 	struct task *sender;
-	/* The caller box is different from sender->answerbox
-	 * for synchronous calls
-	 */
+	/** The caller box is different from sender->answerbox for synchronous
+	 *  calls. */
 	answerbox_t *callerbox;
 
-	/** Private data to internal IPC */
+	/** Private data to internal IPC. */
 	unative_t priv;
 
-	/** Data passed from/to userspace */
+	/** Data passed from/to userspace. */
 	ipc_data_t data;
 } call_t;
Index: kernel/generic/include/ipc/ipcrsc.h
===================================================================
--- kernel/generic/include/ipc/ipcrsc.h	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ kernel/generic/include/ipc/ipcrsc.h	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -36,8 +36,8 @@
 #define KERN_IPCRSC_H_
 
-call_t * get_call(unative_t callid);
-int phone_alloc(void);
-void phone_connect(int phoneid, answerbox_t *box);
-void phone_dealloc(int phoneid);
+extern call_t * get_call(unative_t callid);
+extern int phone_alloc(void);
+extern void phone_connect(int phoneid, answerbox_t *box);
+extern void phone_dealloc(int phoneid);
 
 #endif
Index: kernel/generic/include/ipc/irq.h
===================================================================
--- kernel/generic/include/ipc/irq.h	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ kernel/generic/include/ipc/irq.h	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -37,5 +37,5 @@
 
 /** Maximum length of IPC IRQ program */
-#define IRQ_MAX_PROG_SIZE 10
+#define IRQ_MAX_PROG_SIZE	10
 
 #include <ipc/ipc.h>
@@ -47,5 +47,6 @@
     unative_t method, irq_code_t *ucode);
 extern void ipc_irq_send_notif(irq_t *irq);
-extern void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3);
+extern void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2,
+    unative_t a3);
 extern void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno);
 extern void ipc_irq_cleanup(answerbox_t *box);
Index: kernel/generic/src/ipc/ipc.c
===================================================================
--- kernel/generic/src/ipc/ipc.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ kernel/generic/src/ipc/ipc.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -35,5 +35,5 @@
 /* Lock ordering
  *
- * First the answerbox, then the phone
+ * First the answerbox, then the phone.
  */
 
@@ -54,25 +54,31 @@
 #include <ipc/irq.h>
 
-/* Open channel that is assigned automatically to new tasks */
+/** Open channel that is assigned automatically to new tasks */
 answerbox_t *ipc_phone_0 = NULL;
 
 static slab_cache_t *ipc_call_slab;
 
-/* Initialize new call */
+/** Initialize a call structure.
+ *
+ * @param call		Call structure to be initialized.
+ */
 static void _ipc_call_init(call_t *call)
 {
-	memsetb((uintptr_t)call, sizeof(*call), 0);
+	memsetb((uintptr_t) call, sizeof(*call), 0);
 	call->callerbox = &TASK->answerbox;
 	call->sender = TASK;
 }
 
-/** Allocate & initialize call structure
+/** Allocate and initialize a call structure.
  * 
- * The call is initialized, so that the reply will be directed
- * to TASK->answerbox
- *
- * @param flags Parameters for slab_alloc (ATOMIC, etc.)
- */
-call_t * ipc_call_alloc(int flags)
+ * The call is initialized, so that the reply will be directed to
+ * TASK->answerbox.
+ *
+ * @param flags		Parameters for slab_alloc (e.g FRAME_ATOMIC).
+ *
+ * @return		If flags permit it, return NULL, or initialized kernel
+ *			call structure.
+ */
+call_t *ipc_call_alloc(int flags)
 {
 	call_t *call;
@@ -84,5 +90,9 @@
 }
 
-/** Initialize allocated call */
+/** Initialize a statically allocated call structure.
+ *
+ * @param call		Statically allocated kernel call structure to be
+ *			initialized.
+ */
 void ipc_call_static_init(call_t *call)
 {
@@ -91,11 +101,17 @@
 }
 
-/** Deallocate call stracuture */
+/** Deallocate a call stracuture.
+ *
+ * @param call		Call structure to be freed.
+ */
 void ipc_call_free(call_t *call)
 {
+	ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC));
 	slab_free(ipc_call_slab, call);
 }
 
-/** Initialize answerbox structure
+/** Initialize an answerbox structure.
+ *
+ * @param box		Answerbox structure to be initialized.
  */
 void ipc_answerbox_init(answerbox_t *box)
@@ -113,5 +129,9 @@
 }
 
-/** Connect phone to answerbox */
+/** Connect a phone to an answerbox.
+ *
+ * @param phone		Initialized phone structure.
+ * @param box		Initialized answerbox structure.
+ */
 void ipc_phone_connect(phone_t *phone, answerbox_t *box)
 {
@@ -128,5 +148,7 @@
 }
 
-/** Initialize phone structure and connect phone to answerbox
+/** Initialize a phone structure.
+ *
+ * @param phone		Phone structure to be initialized.
  */
 void ipc_phone_init(phone_t *phone)
@@ -138,5 +160,9 @@
 }
 
-/** Helper function to facilitate synchronous calls */
+/** Helper function to facilitate synchronous calls.
+ *
+ * @param phone		Destination kernel phone structure.
+ * @param request	Call structure with request.
+ */
 void ipc_call_sync(phone_t *phone, call_t *request)
 {
@@ -145,5 +171,5 @@
 	ipc_answerbox_init(&sync_box);
 
-	/* We will receive data on special box */
+	/* We will receive data in a special box. */
 	request->callerbox = &sync_box;
 
@@ -152,6 +178,7 @@
 }
 
-/** Answer message that was not dispatched and is not entered in
- * any queue
+/** Answer a message which was not dispatched and is not listed in any queue.
+ *
+ * @param call		Call structure to be answered.
  */
 static void _ipc_answer_free_call(call_t *call)
@@ -167,8 +194,8 @@
 }
 
-/** Answer message, that is in callee queue
- *
- * @param box Answerbox that is answering the message
- * @param call Modified request that is being sent back
+/** Answer a message which is in a callee queue.
+ *
+ * @param box		Answerbox that is answering the message.
+ * @param call		Modified request that is being sent back.
  */
 void ipc_answer(answerbox_t *box, call_t *call)
@@ -182,8 +209,12 @@
 }
 
-/** Simulate sending back a message
+/** Simulate sending back a message.
  *
  * Most errors are better handled by forming a normal backward
  * message and sending it as a normal answer.
+ *
+ * @param phone		Phone structure the call should appear to come from.
+ * @param call		Call structure to be answered.
+ * @param err		Return value to be used for the answer.
  */
 void ipc_backsend_err(phone_t *phone, call_t *call, unative_t err)
@@ -195,8 +226,12 @@
 }
 
-/* Unsafe unchecking ipc_call */
+/** Unsafe unchecking version of ipc_call.
+ *
+ * @param phone		Phone structure the call comes from.
+ * @param box		Destination answerbox structure.
+ */
 static void _ipc_call(phone_t *phone, answerbox_t *box, call_t *call)
 {
-	if (! (call->flags & IPC_CALL_FORWARDED)) {
+	if (!(call->flags & IPC_CALL_FORWARDED)) {
 		atomic_inc(&phone->active_calls);
 		call->data.phone = phone;
@@ -209,8 +244,11 @@
 }
 
-/** Send a asynchronous request using phone to answerbox
- *
- * @param phone Phone connected to answerbox.
- * @param call Structure representing the call.
+/** Send an asynchronous request using a phone to an answerbox.
+ *
+ * @param phone		Phone structure the call comes from and which is
+ *			connected to the destination answerbox.
+ * @param call		Call structure with request.
+ *
+ * @return		Return 0 on success, ENOENT on error.
  */
 int ipc_call(phone_t *phone, call_t *call)
@@ -239,12 +277,13 @@
 }
 
-/** Disconnect phone from answerbox
- *
- * This call leaves the phone in HUNGUP state. The change to 'free' is done
+/** Disconnect phone from answerbox.
+ *
+ * This call leaves the phone in the HUNGUP state. The change to 'free' is done
  * lazily later.
  *
- * @param phone Phone to be hung up
+ * @param phone		Phone structure to be hung up.
  *              
- * @return 0 - phone disconnected, -1 - the phone was already disconnected
+ * @return		Return 0 if the phone is disconnected.
+ *			Return -1 if the phone was already disconnected.
  */
 int ipc_phone_hangup(phone_t *phone)
@@ -254,6 +293,6 @@
 	
 	spinlock_lock(&phone->lock);
-	if (phone->state == IPC_PHONE_FREE || phone->state ==IPC_PHONE_HUNGUP \
-	    || phone->state == IPC_PHONE_CONNECTING) {
+	if (phone->state == IPC_PHONE_FREE || phone->state == IPC_PHONE_HUNGUP ||
+	    phone->state == IPC_PHONE_CONNECTING) {
 		spinlock_unlock(&phone->lock);
 		return -1;
@@ -280,13 +319,15 @@
 }
 
-/** Forwards call from one answerbox to a new one
- *
- * @param call Call to be redirected.
- * @param newphone Phone to target answerbox.
- * @param oldbox Old answerbox
- * @return 0 on forward ok, error code, if there was error
+/** Forwards call from one answerbox to another one.
+ *
+ * @param call		Call structure to be redirected.
+ * @param newphone	Phone structure to target answerbox.
+ * @param oldbox	Old answerbox structure.
+ *
+ * @return		Return 0 if forwarding succeeded or an error code if
+ *			there was error.
  * 
- * - the return value serves only as an information for the forwarder,
- *   the original caller is notified automatically with EFORWARD
+ * The return value serves only as an information for the forwarder,
+ * the original caller is notified automatically with EFORWARD.
  */
 int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox)
@@ -300,15 +341,18 @@
 
 
-/** Wait for phone call 
- *
- * @param box Answerbox expecting the call.
- * @param usec Timeout in microseconds. See documentation for waitq_sleep_timeout() for
- *	       decription of its special meaning.
- * @param flags Select mode of sleep operation. See documentation for waitq_sleep_timeout()i
- * 		for description of its special meaning.
- * @return Recived message address
- * - to distinguish between call and answer, look at call->flags
- */
-call_t * ipc_wait_for_call(answerbox_t *box, uint32_t usec, int flags)
+/** Wait for a phone call.
+ *
+ * @param box		Answerbox expecting the call.
+ * @param usec		Timeout in microseconds. See documentation for
+ *			waitq_sleep_timeout() for decription of its special
+ *			meaning.
+ * @param flags		Select mode of sleep operation. See documentation for
+ *			waitq_sleep_timeout() for description of its special
+ *			meaning.
+ * @return 		Recived call structure or NULL.
+ * 
+ * To distinguish between a call and an answer, have a look at call->flags.
+ */
+call_t *ipc_wait_for_call(answerbox_t *box, uint32_t usec, int flags)
 {
 	call_t *request;
@@ -351,5 +395,8 @@
 }
 
-/** Answer all calls from list with EHANGUP msg */
+/** Answer all calls from list with EHANGUP answer.
+ *
+ * @param lst		Head of the list to be cleaned up.
+ */
 static void ipc_cleanup_call_list(link_t *lst)
 {
@@ -365,8 +412,8 @@
 }
 
-/** Cleans up all IPC communication of the current task
+/** Cleans up all IPC communication of the current task.
  *
  * Note: ipc_hangup sets returning answerbox to TASK->answerbox, you
- * have to change it as well if you want to cleanup other current then current.
+ * have to change it as well if you want to cleanup other tasks than TASK.
  */
 void ipc_cleanup(void)
@@ -378,5 +425,5 @@
 
 	/* Disconnect all our phones ('ipc_phone_hangup') */
-	for (i=0;i < IPC_MAX_PHONES; i++)
+	for (i = 0; i < IPC_MAX_PHONES; i++)
 		ipc_phone_hangup(&TASK->phones[i]);
 
@@ -414,6 +461,6 @@
 		/* Locking not needed, no one else should modify
 		 * it, when we are in cleanup */
-		for (i=0;i < IPC_MAX_PHONES; i++) {
-			if (TASK->phones[i].state == IPC_PHONE_HUNGUP && \
+		for (i = 0; i < IPC_MAX_PHONES; i++) {
+			if (TASK->phones[i].state == IPC_PHONE_HUNGUP &&
 			    atomic_get(&TASK->phones[i].active_calls) == 0)
 				TASK->phones[i].state = IPC_PHONE_FREE;
@@ -434,7 +481,9 @@
 			break;
 		
-		call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
-		ASSERT((call->flags & IPC_CALL_ANSWERED) || (call->flags & IPC_CALL_NOTIF));
-		ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
+		call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT,
+		    SYNCH_FLAGS_NONE);
+		ASSERT((call->flags & IPC_CALL_ANSWERED) ||
+		    (call->flags & IPC_CALL_NOTIF));
+		ASSERT(!(call->flags & IPC_CALL_STATIC_ALLOC));
 		
 		atomic_dec(&TASK->active_calls);
@@ -447,9 +496,13 @@
 void ipc_init(void)
 {
-	ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL, NULL, 0);
-}
-
-
-/** Kconsole - list answerbox contents */
+	ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL,
+	    NULL, 0);
+}
+
+
+/** List answerbox contents.
+ *
+ * @param taskid	Task ID.
+ */
 void ipc_print_task(task_id_t taskid)
 {
@@ -469,8 +522,8 @@
 	/* Print opened phones & details */
 	printf("PHONE:\n");
-	for (i=0; i < IPC_MAX_PHONES;i++) {
+	for (i = 0; i < IPC_MAX_PHONES; i++) {
 		spinlock_lock(&task->phones[i].lock);
 		if (task->phones[i].state != IPC_PHONE_FREE) {
-			printf("%d: ",i);
+			printf("%d: ", i);
 			switch (task->phones[i].state) {
 			case IPC_PHONE_CONNECTING:
Index: kernel/generic/src/ipc/ipcrsc.c
===================================================================
--- kernel/generic/src/ipc/ipcrsc.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ kernel/generic/src/ipc/ipcrsc.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -133,10 +133,15 @@
 #include <debug.h>
 
-/** Find call_t * in call table according to callid
- *
- * TODO: Some speedup (hash table?)
- * @return NULL on not found, otherwise pointer to call structure
- */
-call_t * get_call(unative_t callid)
+/** Find call_t * in call table according to callid.
+ *
+ * @todo Some speedup (hash table?)
+ *
+ * @param callid	Userspace hash of the call. Currently it is the call
+ *			structure kernel address.
+ *
+ * @return		NULL on not found, otherwise pointer to the call
+ *			structure.
+ */
+call_t *get_call(unative_t callid)
 {
 	link_t *lst;
@@ -145,7 +150,7 @@
 	spinlock_lock(&TASK->answerbox.lock);
 	for (lst = TASK->answerbox.dispatched_calls.next;
-	     lst != &TASK->answerbox.dispatched_calls; lst = lst->next) {
+	    lst != &TASK->answerbox.dispatched_calls; lst = lst->next) {
 		call = list_get_instance(lst, call_t, link);
-		if ((unative_t)call == callid) {
+		if ((unative_t) call == callid) {
 			result = call;
 			break;
@@ -156,5 +161,9 @@
 }
 
-/** Allocate new phone slot in current TASK structure */
+/** Allocate new phone slot in the current TASK structure.
+ *
+ * @return		New phone handle or -1 if the phone handle limit is
+ *			exceeded.
+ */
 int phone_alloc(void)
 {
@@ -163,6 +172,6 @@
 	spinlock_lock(&TASK->lock);
 	
-	for (i=0; i < IPC_MAX_PHONES; i++) {
-		if (TASK->phones[i].state == IPC_PHONE_HUNGUP && \
+	for (i = 0; i < IPC_MAX_PHONES; i++) {
+		if (TASK->phones[i].state == IPC_PHONE_HUNGUP &&
 		    atomic_get(&TASK->phones[i].active_calls) == 0)
 			TASK->phones[i].state = IPC_PHONE_FREE;
@@ -180,4 +189,8 @@
 }
 
+/** Mark a phone structure free.
+ *
+ * @param phone		Phone structure to be marked free.
+ */
 static void phone_deallocp(phone_t *phone)
 {
@@ -188,7 +201,9 @@
 }
 
-/** Free slot from a disconnected phone
- *
- * All already sent messages will be correctly processed
+/** Free slot from a disconnected phone.
+ *
+ * All already sent messages will be correctly processed.
+ *
+ * @param phoneid	Phone handle of the phone to be freed.
  */
 void phone_dealloc(int phoneid)
@@ -197,7 +212,8 @@
 }
 
-/** Connect phone to a given answerbox
- *
- * @param phoneid The slot that will be connected
+/** Connect phone to a given answerbox.
+ *
+ * @param phoneid 	Phone handle to be connected.
+ * @param box		Answerbox to which to connect the phone handle.
  *
  * The procedure _enforces_ that the user first marks the phone
Index: kernel/generic/src/ipc/irq.c
===================================================================
--- kernel/generic/src/ipc/irq.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ kernel/generic/src/ipc/irq.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -61,6 +61,6 @@
 /** Execute code associated with IRQ notification.
  *
- * @param call Notification call.
- * @param code Top-half pseudocode.
+ * @param call		Notification call.
+ * @param code		Top-half pseudocode.
  */
 static void code_execute(call_t *call, irq_code_t *code)
@@ -72,36 +72,36 @@
 		return;
 	
-	for (i=0; i < code->cmdcount;i++) {
+	for (i = 0; i < code->cmdcount; i++) {
 		switch (code->cmds[i].cmd) {
 		case CMD_MEM_READ_1:
-			dstval = *((uint8_t *)code->cmds[i].addr);
+			dstval = *((uint8_t *) code->cmds[i].addr);
 			break;
 		case CMD_MEM_READ_2:
-			dstval = *((uint16_t *)code->cmds[i].addr);
+			dstval = *((uint16_t *) code->cmds[i].addr);
 			break;
 		case CMD_MEM_READ_4:
-			dstval = *((uint32_t *)code->cmds[i].addr);
+			dstval = *((uint32_t *) code->cmds[i].addr);
 			break;
 		case CMD_MEM_READ_8:
-			dstval = *((uint64_t *)code->cmds[i].addr);
+			dstval = *((uint64_t *) code->cmds[i].addr);
 			break;
 		case CMD_MEM_WRITE_1:
-			*((uint8_t *)code->cmds[i].addr) = code->cmds[i].value;
+			*((uint8_t *) code->cmds[i].addr) = code->cmds[i].value;
 			break;
 		case CMD_MEM_WRITE_2:
-			*((uint16_t *)code->cmds[i].addr) = code->cmds[i].value;
+			*((uint16_t *) code->cmds[i].addr) = code->cmds[i].value;
 			break;
 		case CMD_MEM_WRITE_4:
-			*((uint32_t *)code->cmds[i].addr) = code->cmds[i].value;
+			*((uint32_t *) code->cmds[i].addr) = code->cmds[i].value;
 			break;
 		case CMD_MEM_WRITE_8:
-			*((uint64_t *)code->cmds[i].addr) = code->cmds[i].value;
+			*((uint64_t *) code->cmds[i].addr) = code->cmds[i].value;
 			break;
 #if defined(ia32) || defined(amd64)
 		case CMD_PORT_READ_1:
-			dstval = inb((long)code->cmds[i].addr);
+			dstval = inb((long) code->cmds[i].addr);
 			break;
 		case CMD_PORT_WRITE_1:
-			outb((long)code->cmds[i].addr, code->cmds[i].value);
+			outb((long) code->cmds[i].addr, code->cmds[i].value);
 			break;
 #endif
@@ -125,4 +125,8 @@
 }
 
+/** Free top-half pseudocode.
+ *
+ * @param code		Pointer to the top-half pseudocode.
+ */
 static void code_free(irq_code_t *code)
 {
@@ -133,5 +137,11 @@
 }
 
-static irq_code_t * code_from_uspace(irq_code_t *ucode)
+/** Copy top-half pseudocode from userspace into the kernel.
+ *
+ * @param ucode		Userspace address of the top-half pseudocode.
+ *
+ * @return		Kernel address of the copied pseudocode.
+ */
+static irq_code_t *code_from_uspace(irq_code_t *ucode)
 {
 	irq_code_t *code;
@@ -151,6 +161,7 @@
 	}
 	ucmds = code->cmds;
-	code->cmds = malloc(sizeof(code->cmds[0]) * (code->cmdcount), 0);
-	rc = copy_from_uspace(code->cmds, ucmds, sizeof(code->cmds[0]) * (code->cmdcount));
+	code->cmds = malloc(sizeof(code->cmds[0]) * code->cmdcount, 0);
+	rc = copy_from_uspace(code->cmds, ucmds,
+	    sizeof(code->cmds[0]) * code->cmdcount);
 	if (rc != 0) {
 		free(code->cmds);
@@ -164,7 +175,7 @@
 /** Unregister task from IRQ notification.
  *
- * @param box Answerbox associated with the notification.
- * @param inr IRQ numbe.
- * @param devno Device number.
+ * @param box		Answerbox associated with the notification.
+ * @param inr		IRQ number.
+ * @param devno		Device number.
  */
 void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno)
@@ -196,13 +207,14 @@
 /** Register an answerbox as a receiving end for IRQ notifications.
  *
- * @param box Receiving answerbox.
- * @param inr IRQ number.
- * @param devno Device number.
- * @param method Method to be associated with the notification.
- * @param ucode Uspace pointer to top-half pseudocode.
- *
- * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
- */
-int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode)
+ * @param box		Receiving answerbox.
+ * @param inr		IRQ number.
+ * @param devno		Device number.
+ * @param method	Method to be associated with the notification.
+ * @param ucode		Uspace pointer to top-half pseudocode.
+ *
+ * @return 		EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
+ */
+int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno,
+    unative_t method, irq_code_t *ucode)
 {
 	ipl_t ipl;
@@ -214,6 +226,7 @@
 		if (!code)
 			return EBADMEM;
-	} else
+	} else {
 		code = NULL;
+	}
 
 	ipl = interrupts_disable();
@@ -248,8 +261,10 @@
 }
 
-/** Add call to proper answerbox queue.
+/** Add a call to the proper answerbox queue.
  *
  * Assume irq->lock is locked.
  *
+ * @param irq		IRQ structure referencing the target answerbox.
+ * @param call		IRQ notification call.
  */
 static void send_call(irq_t *irq, call_t *call)
@@ -262,6 +277,10 @@
 }
 
-/** Send notification message
- *
+/** Send notification message.
+ *
+ * @param irq		IRQ structure.
+ * @param a1		Driver-specific payload argument.
+ * @param a2		Driver-specific payload argument.
+ * @param a3		Driver-specific payload argument.
  */
 void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3)
@@ -290,7 +309,9 @@
 }
 
-/** Notify task that an irq had occurred.
+/** Notify a task that an IRQ had occurred.
  *
  * We expect interrupts to be disabled and the irq->lock already held.
+ *
+ * @param irq		IRQ structure.
  */
 void ipc_irq_send_notif(irq_t *irq)
@@ -324,5 +345,5 @@
  * send notifications to it.
  *
- * @param box Answerbox for which we want to carry out the cleanup.
+ * @param box		Answerbox for which we want to carry out the cleanup.
  */
 void ipc_irq_cleanup(answerbox_t *box)
Index: kernel/generic/src/ipc/sysipc.c
===================================================================
--- kernel/generic/src/ipc/sysipc.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ kernel/generic/src/ipc/sysipc.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -50,12 +50,21 @@
 #include <print.h>
 
-#define GET_CHECK_PHONE(phone, phoneid, err) { \
-      if (phoneid > IPC_MAX_PHONES) { err; } \
-      phone = &TASK->phones[phoneid]; \
-}
-
-#define STRUCT_TO_USPACE(dst, src) copy_to_uspace(dst, src, sizeof(*(src)))
-
-/** Return true if the method is a system method */
+#define GET_CHECK_PHONE(phone, phoneid, err) \
+{ \
+	if (phoneid > IPC_MAX_PHONES) { \
+		err; \
+	} \
+	phone = &TASK->phones[phoneid]; \
+}
+
+#define STRUCT_TO_USPACE(dst, src)	copy_to_uspace(dst, src, sizeof(*(src)))
+
+/** Decide if the method is a system method.
+ *
+ * @param method	Method to be decided.
+ *
+ * @return		Return 1 if the method is a system method.
+ *			Otherwise return 0.
+ */
 static inline int is_system_method(unative_t method)
 {
@@ -65,8 +74,13 @@
 }
 
-/** Return true if the message with this method is forwardable
+/** Decide if the message with this method is forwardable.
  *
  * - some system messages may be forwarded, for some of them
  *   it is useless
+ *
+ * @param method	Method to be decided.
+ *
+ * @return		Return 1 if the method is forwardable.
+ *			Otherwise return 0.
  */
 static inline int is_forwardable(unative_t method)
@@ -78,11 +92,16 @@
 }
 
-/****************************************************/
-/* Functions that preprocess answer before sending 
- * it to the recepient
- */
-
-/** Return true if the caller (ipc_answer) should save
- * the old call contents for answer_preprocess
+
+/***********************************************************************
+ * Functions that preprocess answer before sending it to the recepient.
+ ***********************************************************************/
+
+/** Decide if the caller (e.g. ipc_answer()) should save the old call contents
+ * for answer_preprocess().
+ *
+ * @param call		Call structure to be decided.
+ *
+ * @return		Return 1 if the old call contents should be saved.
+ *			Return 0 otherwise.
  */
 static inline int answer_need_old(call_t *call)
@@ -99,7 +118,12 @@
 }
 
-/** Interpret process answer as control information
- *
- * This function is called directly after sys_ipc_answer 
+/** Interpret process answer as control information.
+ *
+ * This function is called directly after sys_ipc_answer().
+ *
+ * @param answer	Call structure with the answer.
+ * @param olddata	Saved data of the request.
+ *
+ * @return		Return 0 on success or an error code. 
  */
 static inline int answer_preprocess(call_t *answer, ipc_data_t *olddata)
@@ -132,5 +156,5 @@
 			/* The connection was accepted */
 			phone_connect(phoneid, &answer->sender->answerbox);
-			/* Set 'phone identification' as arg3 of response */
+			/* Set 'phone hash' as arg3 of response */
 			IPC_SET_ARG3(answer->data,
 			    (unative_t) &TASK->phones[phoneid]);
@@ -182,7 +206,9 @@
 }
 
-/** Called before the request is sent
- *
- * @return 0 - no error, -1 - report error to user
+/** Called before the request is sent.
+ *
+ * @param call		Call structure with the request.
+ *
+ * @return 		Return 0 on success, ELIMIT or EPERM on error.
  */
 static int request_preprocess(call_t *call)
@@ -203,7 +229,6 @@
 	case IPC_M_AS_AREA_SEND:
 		size = as_get_size(IPC_GET_ARG1(call->data));
-		if (!size) {
+		if (!size)
 			return EPERM;
-		}
 		IPC_SET_ARG2(call->data, size);
 		break;
@@ -214,10 +239,12 @@
 }
 
-/****************************************************/
-/* Functions called to process received call/answer 
- * before passing to uspace
- */
-
-/** Do basic kernel processing of received call answer */
+/*******************************************************************************
+ * Functions called to process received call/answer before passing it to uspace.
+ *******************************************************************************/
+
+/** Do basic kernel processing of received call answer.
+ *
+ * @param call		Call structure with the answer.
+ */
 static void process_answer(call_t *call)
 {
@@ -234,7 +261,11 @@
 }
 
-/** Do basic kernel processing of received call request
- *
- * @return 0 - the call should be passed to userspace, 1 - ignore call
+/** Do basic kernel processing of received call request.
+ *
+ * @param box		Destination answerbox structure.
+ * @param call		Call structure with the request.
+ *
+ * @return 		Return 0 if the call should be passed to userspace.
+ *			Return -1 if the call should be ignored.
  */
 static int process_request(answerbox_t *box, call_t *call)
@@ -246,5 +277,5 @@
 		if (phoneid < 0) { /* Failed to allocate phone */
 			IPC_SET_RETVAL(call->data, ELIMIT);
-			ipc_answer(box,call);
+			ipc_answer(box, call);
 			return -1;
 		}
@@ -254,8 +285,17 @@
 }
 
-/** Send a call over IPC, wait for reply, return to user
- *
- * @return Call identification, returns -1 on fatal error, 
-           -2 on 'Too many async request, handle answers first
+/** Make a fast call over IPC, wait for reply and return to user.
+ *
+ * This function can handle only one argument of payload, but is faster than
+ * the generic function (i.e. sys_ipc_call_sync()).
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param method	Method of the call.
+ * @param arg1		Service-defined payload argument.
+ * @param data		Address of userspace structure where the reply call will
+ *			be stored.
+ *
+ * @return		Returns 0 on success.
+ *			Return ENOENT if there is no such phone handle.
  */
 unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method,
@@ -272,9 +312,10 @@
 	IPC_SET_ARG1(call.data, arg1);
 
-	if (!(res=request_preprocess(&call))) {
+	if (!(res = request_preprocess(&call))) {
 		ipc_call_sync(phone, &call);
 		process_answer(&call);
-	} else 
+	} else {
 		IPC_SET_RETVAL(call.data, res);
+	}
 	STRUCT_TO_USPACE(&data->args, &call.data.args);
 
@@ -282,5 +323,12 @@
 }
 
-/** Synchronous IPC call allowing to send whole message */
+/** Make a synchronous IPC call allowing to transmit the entire payload.
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param question	Userspace address of call data with the request.
+ * @param reply		Userspace address of call data where to store the answer.
+ *
+ * @return		Zero on success or an error code.
+ */
 unative_t sys_ipc_call_sync(unative_t phoneid, ipc_data_t *question,
     ipc_data_t *reply)
@@ -299,5 +347,5 @@
 	GET_CHECK_PHONE(phone, phoneid, return ENOENT);
 
-	if (!(res=request_preprocess(&call))) {
+	if (!(res = request_preprocess(&call))) {
 		ipc_call_sync(phone, &call);
 		process_answer(&call);
@@ -312,7 +360,7 @@
 }
 
-/** Check that the task did not exceed allowed limit
- *
- * @return 0 - Limit OK,   -1 - limit exceeded
+/** Check that the task did not exceed the allowed limit of asynchronous calls.
+ *
+ * @return 		Return 0 if limit not reached or -1 if limit exceeded.
  */
 static int check_call_limit(void)
@@ -325,8 +373,18 @@
 }
 
-/** Send an asynchronous call over ipc
- *
- * @return Call identification, returns -1 on fatal error, 
-           -2 on 'Too many async request, handle answers first
+/** Make a fast asynchronous call over IPC.
+ *
+ * This function can only handle two arguments of payload, but is faster than
+ * the generic function sys_ipc_call_async().
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param method	Method of the call.
+ * @param arg1		Service-defined payload argument.
+ * @param arg2		Service-defined payload argument.
+ *
+ * @return 		Return call hash on success.
+ *			Return IPC_CALLRET_FATAL in case of a fatal error and 
+ *			IPC_CALLRET_TEMPORARY if there are too many pending
+ *			asynchronous requests; answers should be handled first.
  */
 unative_t sys_ipc_call_async_fast(unative_t phoneid, unative_t method,
@@ -356,7 +414,10 @@
 }
 
-/** Synchronous IPC call allowing to send whole message
- *
- * @return The same as sys_ipc_call_async
+/** Make an asynchronous IPC call allowing to transmit the entire payload.
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param data		Userspace address of call data with the request.
+ *
+ * @return		See sys_ipc_call_async_fast(). 
  */
 unative_t sys_ipc_call_async(unative_t phoneid, ipc_data_t *data)
@@ -387,10 +448,20 @@
 }
 
-/** Forward received call to another destination
- *
- * The arg1 and arg2 are changed in the forwarded message
+/** Forward a received call to another destination.
+ *
+ * @param callid	Hash of the call to forward.
+ * @param phoneid	Phone handle to use for forwarding.
+ * @param method	New method to use for the forwarded call.
+ * @param arg1		New value of the first argument for the forwarded call.
+ *
+ * @return		Return 0 on succes, otherwise return an error code.
+ *
+ * In case the original method is a system method, ARG1 and ARG2 are overwritten
+ * in the forwarded message with the new method and the new arg1, respectively.
+ * Otherwise the METHOD and ARG1 are rewritten with the new method and arg1,
+ * respectively.
  *
  * Warning: If implementing non-fast version, make sure that
- *          arg3 is not rewritten for certain system IPC
+ *          ARG3 is not rewritten for certain system IPC
  */
 unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid,
@@ -435,5 +506,16 @@
 }
 
-/** Send IPC answer */
+/** Answer an IPC call - fast version.
+ *
+ * This function can handle only two return arguments of payload, but is faster
+ * than the generic sys_ipc_answer().
+ *
+ * @param callid	Hash of the call to be answered.
+ * @param retval	Return value of the answer.
+ * @param arg1		Service-defined return value.
+ * @param arg2		Service-defined return value.
+ *
+ * @return		Return 0 on success, otherwise return an error code.	
+ */
 unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval,
     unative_t arg1, unative_t arg2)
@@ -466,5 +548,11 @@
 }
 
-/** Send IPC answer */
+/** Answer an IPC call.
+ *
+ * @param callid	Hash of the call to be answered.
+ * @param data		Userspace address of call data with the answer.
+ *
+ * @return		Return 0 on success, otherwise return an error code.
+ */
 unative_t sys_ipc_answer(unative_t callid, ipc_data_t *data)
 {
@@ -498,6 +586,9 @@
 }
 
-/** Hang up the phone
- *
+/** Hang up a phone.
+ *
+ * @param		Phone handle of the phone to be hung up.
+ *
+ * @return		Return 0 on success or an error code.
  */
 unative_t sys_ipc_hangup(int phoneid)
@@ -513,5 +604,5 @@
 }
 
-/** Wait for incoming ipc call or answer
+/** Wait for an incoming IPC call or an answer.
  *
  * @param calldata	Pointer to buffer where the call/answer data is stored.
@@ -520,5 +611,8 @@
  *			for explanation.
  *
- * @return Callid, if callid & 1, then the call is answer
+ * @return 		Hash of the call.
+ *			If IPC_CALLID_NOTIFICATION bit is set in the hash, the
+ *			call is a notification. IPC_CALLID_ANSWERED denotes an
+ *			answer.
  */
 unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, int flags)
@@ -542,5 +636,5 @@
 		ipc_call_free(call);
 		
-		return ((unative_t)call) | IPC_CALLID_NOTIFICATION;
+		return ((unative_t) call) | IPC_CALLID_NOTIFICATION;
 	}
 
@@ -560,5 +654,5 @@
 		ipc_call_free(call);
 
-		return ((unative_t)call) | IPC_CALLID_ANSWERED;
+		return ((unative_t) call) | IPC_CALLID_ANSWERED;
 	}
 
@@ -574,12 +668,12 @@
 }
 
-/** Connect irq handler to task.
- *
- * @param inr IRQ number.
- * @param devno Device number.
- * @param method Method to be associated with the notification.
- * @param ucode Uspace pointer to the top-half pseudocode.
- *
- * @return EPERM or a return code returned by ipc_irq_register().
+/** Connect an IRQ handler to a task.
+ *
+ * @param inr		IRQ number.
+ * @param devno		Device number.
+ * @param method	Method to be associated with the notification.
+ * @param ucode		Uspace pointer to the top-half pseudocode.
+ *
+ * @return		EPERM or a return code returned by ipc_irq_register().
  */
 unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method,
@@ -592,8 +686,10 @@
 }
 
-/** Disconnect irq handler from task.
- *
- * @param inr IRQ number.
- * @param devno Device number.
+/** Disconnect an IRQ handler from a task.
+ *
+ * @param inr		IRQ number.
+ * @param devno		Device number.
+ *
+ * @return		Zero on success or EPERM on error..
  */
 unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
