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)
Index: uspace/libc/generic/ipc.c
===================================================================
--- uspace/libc/generic/ipc.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ uspace/libc/generic/ipc.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -52,7 +52,6 @@
 #include <psthread.h>
 
-/** Structure used for keeping track of sent async msgs 
- * and queing unsent msgs
- *
+/** Structure used for keeping track of sent asynchronous calls and queing
+ * unsent calls.
  */
 typedef struct {
@@ -67,21 +66,33 @@
 			int phoneid;
 		} msg;
-	}u;
-	pstid_t ptid;   /**< Thread waiting for sending this msg */
+	} u;
+	pstid_t ptid;	/**< Pseudothread waiting for sending this call. */
 } async_call_t;
 
 LIST_INITIALIZE(dispatched_calls);
 
-/* queued_calls is protcted by async_futex, because if the
- * call cannot be sent into kernel, async framework is used
- * automatically
- */
-LIST_INITIALIZE(queued_calls); /**< List of async calls that were not accepted
-				*   by kernel */
+/** List of asynchronous calls that were not accepted by kernel.
+ *
+ * It is protected by async_futex, because if the call cannot be sent into the
+ * kernel, the async framework is used automatically.
+ */
+LIST_INITIALIZE(queued_calls);
 
 static atomic_t ipc_futex = FUTEX_INITIALIZER;
 
-int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, 
-		  ipcarg_t *result)
+/** Make a fast synchronous call.
+ *
+ * Only one payload argument can be passed using this function. However, this
+ * function is faster than the generic ipc_call_sync_3().
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param method	Requested method.
+ * @param arg1		Service-defined payload argument.
+ * @param result	If non-NULL, the return ARG1 will be stored there.
+ *
+ * @return		Negative values represent errors returned by IPC.
+ *			Otherwise the RETVAL of the answer is returned.
+ */
+int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t *result)
 {
 	ipc_call_t resdata;
@@ -89,5 +100,5 @@
 	
 	callres = __SYSCALL4(SYS_IPC_CALL_SYNC_FAST, phoneid, method, arg1,
-			     (sysarg_t)&resdata);
+	    (sysarg_t) &resdata);
 	if (callres)
 		return callres;
@@ -97,7 +108,20 @@
 }
 
-int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
-		    ipcarg_t arg2, ipcarg_t arg3,
-		    ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3)
+/** Make a synchronous call transmitting 3 arguments of payload.
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param method	Requested method.
+ * @param arg1		Service-defined payload argument.
+ * @param arg2		Service-defined payload argument.
+ * @param arg3		Service-defined payload argument.
+ * @param result1	If non-NULL, storage for the first return argument.
+ * @param result2	If non-NULL, storage for the second return argument.
+ * @param result3	If non-NULL, storage for the third return argument.
+ *
+ * @return		Negative value means IPC error.
+ *			Otherwise the RETVAL of the answer.
+ */
+int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1, ipcarg_t arg2,
+    ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2, ipcarg_t *result3)
 {
 	ipc_call_t data;
@@ -109,6 +133,6 @@
 	IPC_SET_ARG3(data, arg3);
 
-	callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t)&data,
-			     (sysarg_t)&data);
+	callres = __SYSCALL3(SYS_IPC_CALL_SYNC, phoneid, (sysarg_t) &data,
+	    (sysarg_t) &data);
 	if (callres)
 		return callres;
@@ -123,12 +147,25 @@
 }
 
-/** Syscall to send asynchronous message */
-static	ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data)
-{
-	return __SYSCALL2(SYS_IPC_CALL_ASYNC, phoneid, (sysarg_t)data);
-}
-
-/** Prolog to ipc_async_send functions */
-static inline async_call_t *ipc_prepare_async(void *private, ipc_async_callback_t callback)
+/** Syscall to send asynchronous message.
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param data		Call data with the request.
+ *
+ * @return		Hash of the call or an error code.
+ */
+static ipc_callid_t _ipc_call_async(int phoneid, ipc_call_t *data)
+{
+	return __SYSCALL2(SYS_IPC_CALL_ASYNC, phoneid, (sysarg_t) data);
+}
+
+/** Prolog to ipc_call_async_*() functions.
+ *
+ * @param private	Argument for the answer/error callback.
+ * @param callback	Answer/error callback.
+ *
+ * @return		New, partially initialized async_call structure or NULL.
+ */
+static inline async_call_t *ipc_prepare_async(void *private,
+    ipc_async_callback_t callback)
 {
 	async_call_t *call;
@@ -146,7 +183,14 @@
 }
 
-/** Epilogue of ipc_async_send functions */
-static inline void ipc_finish_async(ipc_callid_t callid, int phoneid, 
-				    async_call_t *call, int can_preempt)
+/** Epilogue of ipc_call_async_*() functions.
+ *
+ * @param callid	Value returned by the SYS_IPC_CALL_ASYNC_* syscall.
+ * @param phoneid	Phone handle through which the call was made.
+ * @param call		async_call structure returned by ipc_prepare_async().
+ * @param can_preempt	If non-zero, the current pseudo thread can be preempted
+ *			in this call.
+ */
+static inline void ipc_finish_async(ipc_callid_t callid, int phoneid,
+    async_call_t *call, int can_preempt)
 {
 	if (!call) { /* Nothing to do regardless if failed or not */
@@ -183,5 +227,5 @@
 	}
 	call->u.callid = callid;
-	/* Add call to list of dispatched calls */
+	/* Add call to the list of dispatched calls */
 	list_append(&call->list, &dispatched_calls);
 	futex_up(&ipc_futex);
@@ -189,12 +233,27 @@
 }
 
-/** Send asynchronous message
- *
- * - if fatal error, call callback handler with proper error code
- * - if message cannot be temporarily sent, add to queue
+/** Make a fast asynchronous call.
+ *
+ * This function can only handle two arguments of payload. It is, however,
+ * faster than the more generic ipc_call_async_3().
+ *
+ * Note that this function is a void function.
+ * During normal opertation, answering this call will trigger the callback.
+ * In case of fatal error, call the callback handler with the proper error code.
+ * If the call cannot be temporarily made, queue it.
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param method	Requested method.
+ * @param arg1		Service-defined payload argument.
+ * @param arg2		Service-defined payload argument.
+ * @param private	Argument to be passed to the answer/error callback.
+ * @param callback	Answer or error callback.
+ * @param can_preempt	If non-zero, the current pseudo thread will be preempted
+ *			in case the kernel temporarily refuses to accept more
+ *			asynchronous calls.
  */
 void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1,
-		      ipcarg_t arg2, void *private,
-		      ipc_async_callback_t callback, int can_preempt)
+    ipcarg_t arg2, void *private, ipc_async_callback_t callback,
+    int can_preempt)
 {
 	async_call_t *call = NULL;
@@ -207,8 +266,11 @@
 	}
 
-	/* We need to make sure that we get callid before
-	 * another thread accesses the queue again */
+	/*
+	 * We need to make sure that we get callid before another thread
+	 * accesses the queue again.
+	 */
 	futex_down(&ipc_futex);
-	callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1, arg2);
+	callid = __SYSCALL4(SYS_IPC_CALL_ASYNC_FAST, phoneid, method, arg1,
+	    arg2);
 
 	if (callid == IPC_CALLRET_TEMPORARY) {
@@ -225,12 +287,26 @@
 }
 
-/** Send asynchronous message
- *
- * - if fatal error, call callback handler with proper error code
- * - if message cannot be temporarily sent, add to queue
+/** Make an asynchronous call transmitting the entire payload.
+ *
+ * Note that this function is a void function.
+ * During normal opertation, answering this call will trigger the callback.
+ * In case of fatal error, call the callback handler with the proper error code.
+ * If the call cannot be temporarily made, queue it.
+ *
+ * @param phoneid	Phone handle for the call.
+ * @param method	Requested method.
+ * @param arg1		Service-defined payload argument.
+ * @param arg2		Service-defined payload argument.
+ * @param arg3		Service-defined payload argument.
+ * @param private	Argument to be passed to the answer/error callback.
+ * @param callback	Answer or error callback.
+ * @param can_preempt	If non-zero, the current pseudo thread will be preempted
+ *			in case the kernel temporarily refuses to accept more
+ *			asynchronous calls.
+ *
  */
 void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
-		      ipcarg_t arg2, ipcarg_t arg3, void *private,
-		      ipc_async_callback_t callback, int can_preempt)
+    ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback,
+    int can_preempt)
 {
 	async_call_t *call;
@@ -245,6 +321,8 @@
 	IPC_SET_ARG2(call->u.msg.data, arg2);
 	IPC_SET_ARG3(call->u.msg.data, arg3);
-	/* We need to make sure that we get callid before
-	 * another thread accesses the queue again */
+	/*
+	 * We need to make sure that we get callid before another thread accesses
+	 * the queue again.
+	 */
 	futex_down(&ipc_futex);
 	callid = _ipc_call_async(phoneid, &call->u.msg.data);
@@ -254,28 +332,29 @@
 
 
-/** Send a fast answer to a received call.
- *
- * The fast answer makes use of passing retval and first two arguments in registers.
- * If you need to return more, use the ipc_answer() instead.
- *
- * @param callid ID of the call being answered.
- * @param retval Return value.
- * @param arg1 First return argument.
- * @param arg2 Second return argument.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
+/** Answer a received call - fast version.
+ *
+ * The fast answer makes use of passing retval and first two arguments in
+ * registers. If you need to return more, use the ipc_answer() instead.
+ *
+ * @param callid	Hash of the call being answered.
+ * @param retval	Return value.
+ * @param arg1		First return argument.
+ * @param arg2		Second return argument.
+ *
+ * @return		Zero on success or a value from @ref errno.h on failure.
  */
 ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
-		ipcarg_t arg2)
+    ipcarg_t arg2)
 {
 	return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2);
 }
 
-/** Send a full answer to a received call.
- *
- * @param callid ID of the call being answered.
- * @param call Call data. Must be already initialized by the responder.
- *
- * @return Zero on success or a value from @ref errno.h on failure.
+/** Answer a received call - full version.
+ *
+ * @param callid	Hash of the call being answered.
+ * @param call 		Call structure with the answer.
+ *			Must be already initialized by the responder.
+ *
+ * @return		Zero on success or a value from @ref errno.h on failure.
  */
 ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call)
@@ -285,5 +364,5 @@
 
 
-/** Try to dispatch queed calls from async queue */
+/** Try to dispatch queued calls from the async queue. */
 static void try_dispatch_queued_calls(void)
 {
@@ -291,15 +370,12 @@
 	ipc_callid_t callid;
 
-	/* TODO: integrate intelligently ipc_futex, so that it
-	 * is locked during ipc_call_async, until it is added
-	 * to dispatched_calls
+	/** @todo
+	 * Integrate intelligently ipc_futex, so that it is locked during
+	 * ipc_call_async_*(), until it is added to dispatched_calls.
 	 */
 	futex_down(&async_futex);
 	while (!list_empty(&queued_calls)) {
-		call = list_get_instance(queued_calls.next, async_call_t,
-					 list);
-
-		callid = _ipc_call_async(call->u.msg.phoneid,
-					 &call->u.msg.data);
+		call = list_get_instance(queued_calls.next, async_call_t, list);
+		callid = _ipc_call_async(call->u.msg.phoneid, &call->u.msg.data);
 		if (callid == IPC_CALLRET_TEMPORARY) {
 			break;
@@ -326,9 +402,14 @@
 }
 
-/** Handle received answer
- *
- * TODO: Make it use hash table
- *
- * @param callid Callid (with first bit set) of the answered call
+/** Handle a received answer.
+ *
+ * Find the hash of the answer and call the answer callback.
+ *
+ * @todo Make it use hash table.
+ *
+ * @param callid	Hash of the received answer.
+ *			The answer has the same hash as the request OR'ed with
+ *			the IPC_CALLID_ANSWERED bit.
+ * @param data		Call data of the answer.
  */
 static void handle_answer(ipc_callid_t callid, ipc_call_t *data)
@@ -341,5 +422,5 @@
 	futex_down(&ipc_futex);
 	for (item = dispatched_calls.next; item != &dispatched_calls;
-	     item = item->next) {
+	    item = item->next) {
 		call = list_get_instance(item, async_call_t, list);
 		if (call->u.callid == callid) {
@@ -348,6 +429,5 @@
 			if (call->callback)
 				call->callback(call->private, 
-					       IPC_GET_RETVAL(*data),
-					       data);
+				    IPC_GET_RETVAL(*data), data);
 			free(call);
 			return;
@@ -355,15 +435,17 @@
 	}
 	futex_up(&ipc_futex);
-	/* We may get here after async_msg, which doesn't register any callback */
-}
-
-
-/** One cycle of ipc wait for call call
- *
- * - dispatch ASYNC reoutines in the background
- * @param call Space where the message is stored
- * @param usec Timeout in microseconds
- * @param flags Flags passed to SYS_IPC_WAIT (blocking, nonblocking)
- * @return Callid of the answer.
+}
+
+
+/** Wait for a first call to come.
+ *
+ * @param call		Storage where the incoming call data will be stored.
+ * @param usec		Timeout in microseconds
+ * @param flags		Flags passed to SYS_IPC_WAIT (blocking, nonblocking).
+ *
+ * @return		Hash of the call. Note that certain bits have special
+ *			meaning. IPC_CALLID_ANSWERED will be set in an answer
+ *			and IPC_CALLID_NOTIFICATION is used for notifications.
+ *			
  */
 ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags)
@@ -383,9 +465,10 @@
 /** Wait some time for an IPC call.
  *
- * - dispatch ASYNC reoutines in the background
- *
- * @param call Space where the message is stored
- * @param usec Timeout in microseconds.
- * @return Callid of the answer.
+ * The call will return after an answer is received.
+ *
+ * @param call		Storage where the incoming call data will be stored.
+ * @param usec		Timeout in microseconds.
+ *
+ * @return		Hash of the answer.
  */
 ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *call, uint32_t usec)
@@ -402,8 +485,6 @@
 /** Check if there is an IPC call waiting to be picked up.
  *
- * - dispatch ASYNC reoutines in the background
- *
- * @param call Space where the message is stored
- * @return Callid of the answer.
+ * @param call		Storage where the incoming call will be stored.
+ * @return		Hash of the answer.
  */
 ipc_callid_t ipc_trywait_for_call(ipc_call_t *call)
@@ -412,5 +493,6 @@
 
 	do {
-		callid = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING);
+		callid = ipc_wait_cycle(call, SYNCH_NO_TIMEOUT,
+		    SYNCH_FLAGS_NON_BLOCKING);
 	} while (callid & IPC_CALLID_ANSWERED);
 
@@ -420,25 +502,27 @@
 /** Ask destination to do a callback connection.
  *
- * @param phoneid	Phone ID used for contacting the other side.
+ * @param phoneid	Phone handle used for contacting the other side.
+ * @param arg1		Service-defined argument.
+ * @param arg2		Service-defined argument.
+ * @param phonehash	Storage where the library will store an opaque
+ *			identifier of the phone that will be used for incoming
+ *			calls. This identifier can be used for connection
+ *			tracking.
+ *
+ * @return		Zero on success or a negative error code.
+ */
+int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phonehash)
+{
+	return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, 0, 0, 0,
+	    phonehash);
+}
+
+/** Ask through phone for a new connection to some service.
+ *
+ * @param phoneid	Phone handle used for contacting the other side.
  * @param arg1		User defined argument.
  * @param arg2		User defined argument.
- * @param phonehash	Pointer to a place where the library will store an opaque
- *			identifier of the phone that will be used for incoming
- *			calls.
- * @return Zero on success or a negative error code.
- */
-int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phonehash)
-{
-	return ipc_call_sync_3(phoneid, IPC_M_CONNECT_TO_ME, arg1, arg2, 0, 0, 0,
-	    phonehash);
-}
-
-/** Ask through phone for a new connection to some service.
- *
- * @param phoneid	Phone ID used for contacting the other side.
- * @param arg1		User defined argument.
- * @param arg2		User defined argument.
- *
- * @return New phone ID on success or a negative error code.
+ *
+ * @return		New phone handle on success or a negative error code.
  */
 int ipc_connect_me_to(int phoneid, int arg1, int arg2)
@@ -454,5 +538,10 @@
 }
 
-/* Hang up specified phone */
+/** Hang up a phone.
+ *
+ * @param phoneid	Handle of the phone to be hung up.
+ *
+ * @return		Zero on success or a negative error code.
+ */
 int ipc_hangup(int phoneid)
 {
@@ -462,22 +551,23 @@
 /** Register IRQ notification.
  *
- * @param inr IRQ number.
- * @param devno Device number of the device generating inr.
- * @param method Use this method for notifying me.
- * @param ucode Top-half pseudocode handler.
- *
- * @return Value returned by the kernel.
+ * @param inr		IRQ number.
+ * @param devno		Device number of the device generating inr.
+ * @param method	Use this method for notifying me.
+ * @param ucode		Top-half pseudocode handler.
+ *
+ * @return		Value returned by the kernel.
  */
 int ipc_register_irq(int inr, int devno, int method, irq_code_t *ucode)
 {
-	return __SYSCALL4(SYS_IPC_REGISTER_IRQ, inr, devno, method, (sysarg_t) ucode);
+	return __SYSCALL4(SYS_IPC_REGISTER_IRQ, inr, devno, method,
+	    (sysarg_t) ucode);
 }
 
 /** Unregister IRQ notification.
  *
- * @param inr IRQ number.
- * @param devno Device number of the device generating inr.
- *
- * @return Value returned by the kernel.
+ * @param inr		IRQ number.
+ * @param devno		Device number of the device generating inr.
+ *
+ * @return		Value returned by the kernel.
  */
 int ipc_unregister_irq(int inr, int devno)
@@ -486,4 +576,17 @@
 }
 
+/** 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 for the forwarded call.
+ * @param arg1		New value of the first argument for the forwarded call.
+ *
+ * @return		Zero on success or an error code.
+ *
+ * For non-system methods, the old method and arg1 are rewritten by the new
+ * values. For system methods, the new method and arg1 are written to the old
+ * arg1 and arg2, respectivelly.
+ */
 int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1)
 {
Index: uspace/libc/include/ipc/ipc.h
===================================================================
--- uspace/libc/include/ipc/ipc.h	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ uspace/libc/include/ipc/ipc.h	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -50,15 +50,16 @@
 
 typedef void (* ipc_async_callback_t)(void *private, int retval,
-				      ipc_call_t *data);
+    ipc_call_t *data);
 
-#define ipc_call_sync_2(phoneid, method, arg1, arg2, res1, res2) ipc_call_sync_3((phoneid), (method), (arg1), (arg2), 0, (res1), (res2), 0)
+#define ipc_call_sync_2(phoneid, method, arg1, arg2, res1, res2) \
+	ipc_call_sync_3((phoneid), (method), (arg1), (arg2), 0, (res1), (res2), \
+	    0)
 extern int ipc_call_sync_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
-			   ipcarg_t arg2, ipcarg_t arg3,
-			   ipcarg_t *result1, ipcarg_t *result2, 
-			   ipcarg_t *result3);
-
+    ipcarg_t arg2, ipcarg_t arg3, ipcarg_t *result1, ipcarg_t *result2,
+    ipcarg_t *result3);
 
 extern int ipc_call_sync(int phoneid, ipcarg_t method, ipcarg_t arg1,
-			 ipcarg_t *result);
+    ipcarg_t *result);
+
 extern ipc_callid_t ipc_wait_cycle(ipc_call_t *call, uint32_t usec, int flags);
 extern ipc_callid_t ipc_wait_for_call_timeout(ipc_call_t *data, uint32_t usec);
@@ -69,15 +70,17 @@
 extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data);
 
-extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1,
-			   ipcarg_t arg2);
+extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval,
+    ipcarg_t arg1, ipcarg_t arg2);
 extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call);
 
-#define ipc_call_async(phoneid,method,arg1,private, callback,can_preempt) (ipc_call_async_2(phoneid, method, arg1, 0, private, callback, can_preempt))
+#define ipc_call_async(phoneid, method, arg1, private, callback, can_preempt) \
+	(ipc_call_async_2(phoneid, method, arg1, 0, private, callback, \
+	    can_preempt))
 extern void ipc_call_async_2(int phoneid, ipcarg_t method, ipcarg_t arg1,
-		      ipcarg_t arg2, void *private,
-		      ipc_async_callback_t callback, int can_preempt);
+    ipcarg_t arg2, void *private, ipc_async_callback_t callback,
+    int can_preempt);
 extern void ipc_call_async_3(int phoneid, ipcarg_t method, ipcarg_t arg1,
-			     ipcarg_t arg2, ipcarg_t arg3, void *private,
-			     ipc_async_callback_t callback, int can_preempt);
+    ipcarg_t arg2, ipcarg_t arg3, void *private, ipc_async_callback_t callback,
+    int can_preempt);
 
 extern int ipc_connect_to_me(int phoneid, int arg1, int arg2, ipcarg_t *phone);
@@ -86,5 +89,6 @@
 extern int ipc_register_irq(int inr, int devno, int method, irq_code_t *code);
 extern int ipc_unregister_irq(int inr, int devno);
-extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1);
+extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method,
+    ipcarg_t arg1);
 
 #endif
Index: uspace/ns/ns.c
===================================================================
--- uspace/ns/ns.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ uspace/ns/ns.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -156,5 +156,5 @@
  *
  * @param service Service to be registered.
- * @param phone phone Phone to be used for connections to the service.
+ * @param phone Phone to be used for connections to the service.
  * @param call Pointer to call structure.
  *
Index: uspace/pci/pci.c
===================================================================
--- uspace/pci/pci.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ uspace/pci/pci.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -2,8 +2,6 @@
  * HelenOS PCI driver.
  *
- * Copyright (c) 1997-2003 Martin Mares
+ * (Based on public domain libpci example.c written by Martin Mares.)
  * Copyright (c) 2006 Jakub Jermar
- *
- * (Based on libpci example.c written by Martin Mares.)
  *
  * Can be freely distributed and used under the terms of the GNU GPL.
Index: uspace/rd/rd.c
===================================================================
--- uspace/rd/rd.c	(revision 4680ef5eeda9925a3978a4a02f31a915dbdabe5f)
+++ uspace/rd/rd.c	(revision 8b243f295e54de841c17a2606bdc9a2fe484dbbb)
@@ -67,20 +67,20 @@
 		callid = async_get_call(&call);
 		switch (IPC_GET_METHOD(call)) {
-			case IPC_M_PHONE_HUNGUP:
-				ipc_answer_fast(callid, 0,0,0);
-				return;
-			case IPC_M_AS_AREA_SEND:
-				ipc_answer_fast(callid, 0, (uintptr_t)fs_addr, 0);
-				continue;
-			case RD_READ_BLOCK:			
-				offset = IPC_GET_ARG1(call);
-				memcpy((void *)fs_addr, rd_addr+offset, BLOCK_SIZE);
-				retval = EOK;
-				break;
-			default:
-				retval = EINVAL;
+		case IPC_M_PHONE_HUNGUP:
+			ipc_answer_fast(callid, 0, 0, 0);
+			return;
+		case IPC_M_AS_AREA_SEND:
+			ipc_answer_fast(callid, 0, (uintptr_t) fs_addr, 0);
+			continue;
+		case RD_READ_BLOCK:			
+			offset = IPC_GET_ARG1(call);
+			memcpy((void *) fs_addr, rd_addr + offset, BLOCK_SIZE);
+			retval = EOK;
+			break;
+		default:
+			retval = EINVAL;
 		}
 		ipc_answer_fast(callid, retval, 0, 0);
-	}	
+	}
 }
 
@@ -91,5 +91,5 @@
 
 	size_t rd_size = sysinfo_value("rd.size");
-	void * rd_ph_addr = (void *) sysinfo_value("rd.address.physical");
+	void *rd_ph_addr = (void *) sysinfo_value("rd.address.physical");
 	
 	if (rd_size == 0)
@@ -99,5 +99,6 @@
 	
 	flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE;
-	retval = physmem_map(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags);
+	retval = physmem_map(rd_ph_addr, rd_addr,
+	    ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags);
 
 	if (retval < 0)
