summaryrefslogtreecommitdiff
path: root/arch/x86/machine
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-02-24 06:45:44 +0100
committerRichard Braun <rbraun@sceen.net>2018-02-24 06:48:21 +0100
commit7dcf6715ffb3cc2f00f6327b896d16f173a1b082 (patch)
tree210570e98e074d7abade0d22c64e05b9c02435ba /arch/x86/machine
parentbe5b9d6ab9f7e7a81c367e4bb0823ba11f85940f (diff)
New errno.h standard header
Use standard errno codes. This change also adds strerror to string.h.
Diffstat (limited to 'arch/x86/machine')
-rw-r--r--arch/x86/machine/atcons.c7
-rw-r--r--arch/x86/machine/atkbd.c18
-rw-r--r--arch/x86/machine/cga.c4
-rw-r--r--arch/x86/machine/ioapic.c2
-rw-r--r--arch/x86/machine/pic.c1
-rw-r--r--arch/x86/machine/pmap.c10
-rw-r--r--arch/x86/machine/uart.c10
7 files changed, 27 insertions, 25 deletions
diff --git a/arch/x86/machine/atcons.c b/arch/x86/machine/atcons.c
index 0c35266..a94ae91 100644
--- a/arch/x86/machine/atcons.c
+++ b/arch/x86/machine/atcons.c
@@ -15,6 +15,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <errno.h>
#include <stdbool.h>
#include <string.h>
@@ -76,12 +77,12 @@ atcons_esc_seq_lookup(const struct atcons_esc_seq **seqp)
*seqp = seq;
return 0;
} else {
- return ERROR_AGAIN;
+ return EAGAIN;
}
}
}
- return ERROR_SRCH;
+ return ESRCH;
}
static void
@@ -101,7 +102,7 @@ atcons_process_esc_seq(char c)
error = atcons_esc_seq_lookup(&seq);
if (error) {
- if (error != ERROR_AGAIN) {
+ if (error != EAGAIN) {
atcons_reset_esc_seq();
}
} else {
diff --git a/arch/x86/machine/atkbd.c b/arch/x86/machine/atkbd.c
index 59f8d68..6b530e7 100644
--- a/arch/x86/machine/atkbd.c
+++ b/arch/x86/machine/atkbd.c
@@ -21,12 +21,12 @@
* supported. This includes any communication with the keyboard itself.
*/
+#include <errno.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <kern/console.h>
-#include <kern/error.h>
#include <kern/init.h>
#include <kern/intr.h>
#include <kern/log.h>
@@ -501,19 +501,19 @@ atkbd_read_status(bool check_out)
*/
if (status == 0xff) {
log_info("atkbd: no keyboard controller");
- return ERROR_NODEV;
+ return ENODEV;
} else if (status & ATKBD_STATUS_PARITY_ERROR) {
log_err("atkbd: parity error");
- return ERROR_IO;
+ return EIO;
} else if (status & ATKBD_STATUS_TIMEOUT_ERROR) {
log_err("atkbd: timeout error");
- return ERROR_TIMEDOUT;
+ return ETIMEDOUT;
}
if (check_out) {
- return (status & ATKBD_STATUS_OUT_FULL) ? 0 : ERROR_AGAIN;
+ return (status & ATKBD_STATUS_OUT_FULL) ? 0 : EAGAIN;
} else {
- return (status & ATKBD_STATUS_IN_FULL) ? ERROR_AGAIN : 0;
+ return (status & ATKBD_STATUS_IN_FULL) ? EAGAIN : 0;
}
}
@@ -531,7 +531,7 @@ atkbd_out_wait(void)
for (;;) {
error = atkbd_read_status(true);
- if (error != ERROR_AGAIN) {
+ if (error != EAGAIN) {
break;
}
}
@@ -547,7 +547,7 @@ atkbd_in_wait(void)
for (;;) {
error = atkbd_read_status(false);
- if (error != ERROR_AGAIN) {
+ if (error != EAGAIN) {
break;
}
}
@@ -599,7 +599,7 @@ atkbd_flush(void)
error = atkbd_read(&byte, false);
} while (!error);
- if (error == ERROR_AGAIN) {
+ if (error == EAGAIN) {
error = 0;
}
diff --git a/arch/x86/machine/cga.c b/arch/x86/machine/cga.c
index b519ba1..2fdb608 100644
--- a/arch/x86/machine/cga.c
+++ b/arch/x86/machine/cga.c
@@ -16,12 +16,12 @@
*/
#include <assert.h>
+#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <kern/console.h>
-#include <kern/error.h>
#include <kern/init.h>
#include <kern/cbuf.h>
#include <kern/macros.h>
@@ -180,7 +180,7 @@ cga_bbuf_get_phys_cursor(const struct cga_bbuf *bbuf, uint16_t *cursorp)
assert((cursor & 1) == 0);
if (cursor >= CGA_MEMORY_SIZE) {
- return ERROR_NODEV;
+ return ENODEV;
}
*cursorp = (cursor >> 1);
diff --git a/arch/x86/machine/ioapic.c b/arch/x86/machine/ioapic.c
index 82fbd6d..f90e120 100644
--- a/arch/x86/machine/ioapic.c
+++ b/arch/x86/machine/ioapic.c
@@ -16,10 +16,10 @@
*/
#include <assert.h>
+#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
-#include <kern/error.h>
#include <kern/init.h>
#include <kern/intr.h>
#include <kern/kmem.h>
diff --git a/arch/x86/machine/pic.c b/arch/x86/machine/pic.c
index 8ef5753..3c7e762 100644
--- a/arch/x86/machine/pic.c
+++ b/arch/x86/machine/pic.c
@@ -16,6 +16,7 @@
*/
#include <assert.h>
+#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
diff --git a/arch/x86/machine/pmap.c b/arch/x86/machine/pmap.c
index 2b4c23c..182c765 100644
--- a/arch/x86/machine/pmap.c
+++ b/arch/x86/machine/pmap.c
@@ -19,13 +19,13 @@
*/
#include <assert.h>
+#include <errno.h>
#include <stdalign.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <kern/cpumap.h>
-#include <kern/error.h>
#include <kern/init.h>
#include <kern/kmem.h>
#include <kern/list.h>
@@ -666,7 +666,7 @@ pmap_update_oplist_create(struct pmap_update_oplist **oplistp)
oplist = kmem_cache_alloc(&pmap_update_oplist_cache);
if (oplist == NULL) {
- return ERROR_NOMEM;
+ return ENOMEM;
}
*oplistp = oplist;
@@ -1122,7 +1122,7 @@ pmap_kextract(uintptr_t va, phys_addr_t *pap)
pte = &ptp[pmap_pte_index(va, pt_level)];
if (!pmap_pte_valid(*pte)) {
- return ERROR_FAULT;
+ return EFAULT;
}
if ((level == 0) || pmap_pte_large(*pte)) {
@@ -1146,7 +1146,7 @@ pmap_create(struct pmap **pmapp)
pmap = kmem_cache_alloc(&pmap_cache);
if (pmap == NULL) {
- return ERROR_NOMEM;
+ return ENOMEM;
}
for (i = 0; i < ARRAY_SIZE(pmap->cpu_tables); i++) {
@@ -1194,7 +1194,7 @@ pmap_enter_local(struct pmap *pmap, uintptr_t va, phys_addr_t pa,
if (page == NULL) {
log_warning("pmap: page table page allocation failure");
- return ERROR_NOMEM;
+ return ENOMEM;
}
ptp_pa = vm_page_to_pa(page);
diff --git a/arch/x86/machine/uart.c b/arch/x86/machine/uart.c
index 10a3288..be9ad72 100644
--- a/arch/x86/machine/uart.c
+++ b/arch/x86/machine/uart.c
@@ -16,11 +16,11 @@
*/
#include <assert.h>
+#include <errno.h>
#include <stdint.h>
#include <kern/arg.h>
#include <kern/console.h>
-#include <kern/error.h>
#include <kern/init.h>
#include <kern/intr.h>
#include <kern/log.h>
@@ -173,7 +173,7 @@ uart_intr(void *arg)
byte = uart_read(uart, UART_REG_IIR);
if (byte & UART_IIR_NOT_PENDING) {
- return ERROR_AGAIN;
+ return EAGAIN;
}
byte &= UART_IIR_SRC_MASK;
@@ -268,7 +268,7 @@ static int __init
uart_init_check_speed(unsigned int speed)
{
if (speed > UART_SPEED_MAX) {
- return ERROR_INVAL;
+ return EINVAL;
}
return 0;
@@ -288,7 +288,7 @@ uart_init_convert_parity_char(char c, unsigned int *parity)
*parity = UART_PARITY_EVEN;
break;
default:
- return ERROR_INVAL;
+ return EINVAL;
}
return 0;
@@ -301,7 +301,7 @@ uart_init_check_data_bits(unsigned int data_bits)
case 5 ... 8:
break;
default:
- return ERROR_INVAL;
+ return EINVAL;
}
return 0;