diff options
author | Remy Noel <mocramis@gmail.com> | 2018-02-25 17:36:21 +0100 |
---|---|---|
committer | Remy Noel <mocramis@gmail.com> | 2018-02-25 18:19:05 +0100 |
commit | c8030a59c79846363587381a41f1d71f1bde5177 (patch) | |
tree | 898d36fb4f5de32a8600a1d6be9c099b17210869 /arch/x86/machine | |
parent | cba7db6931932953fd0113a70019049234eb0b08 (diff) | |
parent | 045500a2c88f4e6b877a4695908eb129340f6782 (diff) |
Merge branch 'master' into perfmon
Diffstat (limited to 'arch/x86/machine')
-rw-r--r-- | arch/x86/machine/atcons.c | 7 | ||||
-rw-r--r-- | arch/x86/machine/atkbd.c | 18 | ||||
-rw-r--r-- | arch/x86/machine/atomic.h | 20 | ||||
-rw-r--r-- | arch/x86/machine/cga.c | 4 | ||||
-rw-r--r-- | arch/x86/machine/cpu.h | 12 | ||||
-rw-r--r-- | arch/x86/machine/ioapic.c | 2 | ||||
-rw-r--r-- | arch/x86/machine/ioapic.h | 6 | ||||
-rw-r--r-- | arch/x86/machine/pic.c | 1 | ||||
-rw-r--r-- | arch/x86/machine/pmap.c | 10 | ||||
-rw-r--r-- | arch/x86/machine/pmu_amd.c | 4 | ||||
-rw-r--r-- | arch/x86/machine/pmu_intel.c | 10 | ||||
-rw-r--r-- | arch/x86/machine/uart.c | 10 |
12 files changed, 53 insertions, 51 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/atomic.h b/arch/x86/machine/atomic.h index de695b9..ce41358 100644 --- a/arch/x86/machine/atomic.h +++ b/arch/x86/machine/atomic.h @@ -22,7 +22,7 @@ #ifndef _X86_ATOMIC_H #define _X86_ATOMIC_H -#ifndef _KERN_ATOMIC_H +#ifndef KERN_ATOMIC_H #error "don't include <machine/atomic.h> directly, use <kern/atomic.h> instead" #endif @@ -48,11 +48,11 @@ */ #define atomic_load_64(ptr, mo) \ MACRO_BEGIN \ - uint64_t ___ret = 0; \ + uint64_t ret___ = 0; \ \ - __atomic_compare_exchange_n((uint64_t *)(ptr), &___ret, 0, \ + __atomic_compare_exchange_n((uint64_t *)(ptr), &ret___, 0, \ false, mo, __ATOMIC_RELAXED); \ - ___ret; \ + ret___; \ MACRO_END #define atomic_load(ptr, mo) \ @@ -65,17 +65,17 @@ MACRO_BEGIN \ if (sizeof(*(ptr)) != 8) { \ __atomic_store_n(ptr, val, mo); \ } else { \ - typeof(*(ptr)) ___oval, ___nval; \ - bool ___done; \ + typeof(*(ptr)) oval___, nval___; \ + bool done___; \ \ - ___oval = *(ptr); \ - ___nval = (val); \ + oval___ = *(ptr); \ + nval___ = (val); \ \ do { \ - ___done = __atomic_compare_exchange_n(ptr, &___oval, ___nval, \ + done___ = __atomic_compare_exchange_n(ptr, &oval___, nval___, \ false, mo, \ __ATOMIC_RELAXED); \ - } while (!___done); \ + } while (!done___); \ \ } \ MACRO_END 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/cpu.h b/arch/x86/machine/cpu.h index d7a6498..719a6a5 100644 --- a/arch/x86/machine/cpu.h +++ b/arch/x86/machine/cpu.h @@ -442,13 +442,13 @@ extern void *cpu_local_area; #define cpu_local_ptr(var) \ MACRO_BEGIN \ - typeof(var) *___ptr = &(var); \ + typeof(var) *ptr___ = &(var); \ \ asm("add %%fs:%1, %0" \ - : "+r" (___ptr) \ + : "+r" (ptr___) \ : "m" (cpu_local_area)); \ \ - ___ptr; \ + ptr___; \ MACRO_END #define cpu_local_var(var) (*cpu_local_ptr(var)) @@ -461,13 +461,13 @@ MACRO_END #define cpu_local_read(var) \ MACRO_BEGIN \ - typeof(var) ___val; \ + typeof(var) val___; \ \ asm("mov %%fs:%1, %0" \ - : "=r" (___val) \ + : "=r" (val___) \ : "m" (var)); \ \ - ___val; \ + val___; \ MACRO_END static inline struct cpu * 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/ioapic.h b/arch/x86/machine/ioapic.h index b9a702d..88999b9 100644 --- a/arch/x86/machine/ioapic.h +++ b/arch/x86/machine/ioapic.h @@ -15,8 +15,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef _KERN_IOAPIC_H -#define _KERN_IOAPIC_H +#ifndef KERN_IOAPIC_H +#define KERN_IOAPIC_H #include <stdbool.h> #include <stdint.h> @@ -38,4 +38,4 @@ void ioapic_register(unsigned int apic_id, uintptr_t addr, void ioapic_override(uint8_t source, uint32_t gsi, bool active_high, bool edge_triggered); -#endif /* _KERN_IOAPIC_H */ +#endif /* KERN_IOAPIC_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/pmu_amd.c b/arch/x86/machine/pmu_amd.c index 815f403..b8b4c78 100644 --- a/arch/x86/machine/pmu_amd.c +++ b/arch/x86/machine/pmu_amd.c @@ -132,7 +132,7 @@ pmu_amd_alloc(unsigned int *pmc_idp, unsigned int raw_event_id) pmu = pmu_amd_get(); if (pmu->pmc_bm == 0) - return ERROR_AGAIN; + return EAGAIN; pmc_id = __builtin_ffs(pmu->pmc_bm) - 1; pmu->pmc_bm &= ~(1U << pmc_id); @@ -208,7 +208,7 @@ pmu_amd_setup(void) /* Support AMD Family 10h processors and later */ if (cpu->family < 16) - return ERROR_NODEV; + return ENODEV; pmu = pmu_amd_get(); pmu->pmc_bm = (1U << PMU_AMD_NR_PMCS) - 1; diff --git a/arch/x86/machine/pmu_intel.c b/arch/x86/machine/pmu_intel.c index e4d3f21..4671a9f 100644 --- a/arch/x86/machine/pmu_intel.c +++ b/arch/x86/machine/pmu_intel.c @@ -130,7 +130,7 @@ static int pmu_intel_translate(unsigned int *raw_event_idp, unsigned event_id) { if (event_id >= ARRAY_SIZE(pmu_intel_raw_events)) - return ERROR_INVAL; + return EINVAL; *raw_event_idp = pmu_intel_raw_events[event_id]; @@ -149,10 +149,10 @@ pmu_intel_alloc(unsigned int *pmc_idp, unsigned int raw_event_id) hw_event_id = pmu_intel_event_codes[raw_event_id].hw_event_id; if (!(pmu->events & hw_event_id)) - return ERROR_INVAL; + return EINVAL; if (pmu->pmc_bm == 0) - return ERROR_AGAIN; + return EAGAIN; pmc_id = __builtin_ffs(pmu->pmc_bm) - 1; pmu->pmc_bm &= ~(1U << pmc_id); @@ -221,14 +221,14 @@ pmu_intel_setup(void) } if (cpu->cpuid_max_basic < eax) - return ERROR_NODEV; + return ENODEV; pmu = pmu_intel_get(); cpu_cpuid(&eax, &ebx, &ecx, &edx); pmu->version = eax & PMU_INTEL_ID_VERSION_MASK; if ((pmu->version == 0) || (pmu->version > 3)) - return ERROR_NODEV; + return ENODEV; pmu->nr_pmcs = (eax & PMU_INTEL_ID_NR_PMCS_MASK) >> PMU_INTEL_ID_NR_PMCS_OFFSET; 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; |