Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
arch/x86/mm/physaddr.c
bool __virt_addr_valid(unsigned long x) { unsigned long y = x - __START_KERNEL_map; if (unlikely(x > y)) { x = y + phys_base; if (y >= KERNEL_IMAGE_SIZE) return false; } else { x = y + (__START_KERNEL_map - PAGE_OFFSET); /* carry flag will be set if starting x was >= PAGE_OFFSET */ if...
[ 1, 0 ]
Linux Kernel
arch/x86/mm/pkeys.c
static __init int setup_init_pkru(char *opt) { u32 new_init_pkru; if (kstrtouint(opt, 0, &new_init_pkru)) return 1; WRITE_ONCE(init_pkru_value, new_init_pkru); return 1; }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/pti.c
static void __init pti_print_if_secure(const char *reason) { if (!boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN)) pr_info("%s\n", reason); }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/pti.c
void __init pti_check_boottime_disable(void) { char arg[5]; int ret; pti_mode = PTI_AUTO; if (hypervisor_is_type(X86_HYPER_XEN_PV)) { pti_mode = PTI_FORCE_OFF; pti_print_if_insecure("disabled on XEN PV."); return; } ret = cmdline_find_option(boot_command_line, "pti", arg, sizeof(arg)); if (...
[ 1, 0 ]
Linux Kernel
arch/x86/mm/pti.c
static void pti_clone_kernel_text(void) { unsigned long start = PFN_ALIGN(_text); unsigned long end_clone = (unsigned long)__end_rodata_aligned; unsigned long end_global = PFN_ALIGN((unsigned long)_etext); if (!pti_kernel_image_global_ok()) return; pr_debug("mapping partial kernel image into user addre...
[ 1, 0 ]
Linux Kernel
arch/x86/mm/pti.c
static void pti_set_kernel_image_nonglobal(void) { unsigned long start = PFN_ALIGN(_text); unsigned long end = ALIGN((unsigned long)_end, PMD_PAGE_SIZE); /* * This clears _PAGE_GLOBAL from the entire kernel image. * pti_clone_kernel_text() map put _PAGE_GLOBAL back for * areas that are mapped to usersp...
[ 1, 0 ]
Linux Kernel
arch/x86/mm/pti.c
void __init pti_init(void) { if (!boot_cpu_has(X86_FEATURE_PTI)) return; pr_info("enabled\n"); #ifdef CONFIG_X86_32 if (cpuid_ecx(0x1) & BIT(17)) { /* Use printk to work around pr_fmt() */ printk(KERN_WARNING "\n"); printk(KERN_WARNING "***********************************************...
[ 0, 0 ]
Linux Kernel
arch/x86/mm/srat.c
void __init acpi_numa_x2apic_affinity_init(struct acpi_srat_x2apic_cpu_affinity *pa) { int pxm, node; int apic_id; if (srat_disabled()) return; if (pa->header.length < sizeof(struct acpi_srat_x2apic_cpu_affinity)) { bad_srat(); return; } if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0) return;...
[ 1, 0 ]
Linux Kernel
arch/x86/mm/testmmiotrace.c
static void do_write_test(void __iomem *p) { unsigned int i; pr_info("write test.\n"); mmiotrace_printk("Write test.\n"); for (i = 0; i < 256; i++) iowrite8(i, p + i); for (i = 1024; i < (5 * 1024); i += 2) iowrite16(v16(i), p + i); for (i = (5 * 1024); i < (16 * 1024); i += 4) iowrite32(v32...
[ 1, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
static inline unsigned long build_cr3_noflush(pgd_t *pgd, u16 asid) { VM_WARN_ON_ONCE(asid > MAX_ASID_AVAILABLE); VM_WARN_ON_ONCE(!boot_cpu_has(X86_FEATURE_PCID)); return __sme_pa(pgd) | kern_pcid(asid) | CR3_NOFLUSH; }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
void switch_mm(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) { unsigned long flags; local_irq_save(flags); switch_mm_irqs_off(prev, next, tsk); local_irq_restore(flags); }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
static unsigned long mm_mangle_tif_spec_bits(struct task_struct *next) { unsigned long next_tif = read_task_thread_flags(next); unsigned long spec_bits = (next_tif >> TIF_SPEC_IB) & LAST_USER_MM_SPEC_MASK; BUILD_BUG_ON(TIF_SPEC_L1D_FLUSH != TIF_SPEC_IB + 1); return (unsigned long)next->mm | spec_bits; }
[ 1, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
void cr4_update_pce(void *ignored) { cr4_update_pce_mm(this_cpu_read(cpu_tlbstate.loaded_mm)); }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) { if (this_cpu_read(cpu_tlbstate.loaded_mm) == &init_mm) return; this_cpu_write(cpu_tlbstate_shared.is_lazy, true); }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
void initialize_tlbstate_and_flush(void) { int i; struct mm_struct *mm = this_cpu_read(cpu_tlbstate.loaded_mm); u64 tlb_gen = atomic64_read(&init_mm.context.tlb_gen); unsigned long cr3 = __read_cr3(); WARN_ON((cr3 & CR3_ADDR_MASK) != __pa(mm->pgd)); /* * Assert that CR4.PCIDE is set if needed. (CR4.PC...
[ 1, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
static struct flush_tlb_info * get_flush_tlb_info(struct mm_struct *mm, unsigned long start, unsigned long end, unsigned int stride_shift, bool freed_tables, u64 new_tlb_gen) { struct flush_tlb_info *info = this_cpu_ptr(&flush_tlb_info); #ifdef CONFIG_DEBUG_VM BUG_ON(this_cpu...
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
static void do_flush_tlb_all(void *info) { count_vm_tlb_event(NR_TLB_REMOTE_FLUSH_RECEIVED); __flush_tlb_all(); }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
void flush_tlb_all(void) { count_vm_tlb_event(NR_TLB_REMOTE_FLUSH); on_each_cpu(do_flush_tlb_all, NULL, 1); }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
STATIC_NOPV void native_flush_tlb_one_user(unsigned long addr) { u32 loaded_mm_asid = this_cpu_read(cpu_tlbstate.loaded_mm_asid); asm volatile("invlpg (%0)" ::"r"(addr) : "memory"); if (!static_cpu_has(X86_FEATURE_PTI)) return; if (!this_cpu_has(X86_FEATURE_INVPCID_SINGLE)) invalidate_user_asid(loade...
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
STATIC_NOPV void native_flush_tlb_global(void) { unsigned long flags; if (static_cpu_has(X86_FEATURE_INVPCID)) { invpcid_flush_all(); return; } /* * Read-modify-write to CR4 - protect it from preemption and * from interrupts. (Use the raw variant because this code can * be called from deep i...
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
void flush_tlb_local(void) { __flush_tlb_local(); }
[ 0, 0 ]
Linux Kernel
arch/x86/mm/tlb.c
bool nmi_uaccess_okay(void) { struct mm_struct *loaded_mm = this_cpu_read(cpu_tlbstate.loaded_mm); struct mm_struct *current_mm = current->mm; VM_WARN_ON_ONCE(!loaded_mm); if (loaded_mm != current_mm) return false; VM_WARN_ON_ONCE(current_mm->pgd != __va(read_cr3_pa())); return true; }
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len) { if (len == 1) *ptr = bytes; else if (len == 2) *(u16 *)ptr = bytes; else { *(u32 *)ptr = bytes; barrier(); } return ptr + len; } #define EMIT(bytes, len) \ do { ...
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static int bpf_size_to_x86_bytes(int bpf_size) { if (bpf_size == BPF_W) return 4; else if (bpf_size == BPF_H) return 2; else if (bpf_size == BPF_B) return 1; else if (bpf_size == BPF_DW) return 4; else return 0; } /* * List of x86 cond jumps opcodes (. + s8) * Add 0x10 (and an extra 0x0...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static bool is_ereg(u32 reg) { return (1 << reg) & (BIT(BPF_REG_5) | BIT(AUX_REG) | BIT(BPF_REG_7) | BIT(BPF_REG_8) | BIT(BPF_REG_9) | BIT(X86_REG_R9) | BIT(BPF_REG_AX)); }
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static void jit_fill_hole(void *area, unsigned int size) { memset(area, 0xcc, size); }
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static void emit_prologue(u8 **pprog, u32 stack_depth, bool ebpf_from_cbpf, bool tail_call_reachable, bool is_subprog) { u8 *prog = *pprog; EMIT_ENDBR(); memcpy(prog, x86_nops[5], X86_PATCH_SIZE); prog += X86_PATCH_SIZE; if (!ebpf_from_cbpf) { if (tail_call_reachable && !is_subp...
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t, void *old_addr, void *new_addr) { if (!is_kernel_text((long)ip) && !is_bpf_text_address((long)ip)) return -EINVAL; /* * See emit_prologue(), for IBT builds the trampoline hook is preceded * with an ENDBR instruction. *...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static void emit_insn_suffix(u8 **pprog, u32 ptr_reg, u32 val_reg, int off) { u8 *prog = *pprog; if (is_imm8(off)) { EMIT2(add_2reg(0x40, ptr_reg, val_reg), off); } else { /* 4-byte signed displacement */ EMIT1_off32(add_2reg(0x80, ptr_reg, val_reg), off); } *pprog = prog; }
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static void maybe_emit_1mod(u8 **pprog, u32 reg, bool is64) { u8 *prog = *pprog; if (is64) EMIT1(add_1mod(0x48, reg)); else if (is_ereg(reg)) EMIT1(add_1mod(0x40, reg)); *pprog = prog; }
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static void emit_ldx(u8 **pprog, u32 size, u32 dst_reg, u32 src_reg, int off) { u8 *prog = *pprog; switch (size) { case BPF_B: EMIT3(add_2mod(0x48, src_reg, dst_reg), 0x0F, 0xB6); break; case BPF_H: /* Emit 'movzx rax, word ptr [rax + off]' */ EMIT3(add_2mod(0x48, src_reg, dst_reg), 0x0F, 0xB7...
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, struct bpf_tramp_links *tl, int stack_size, int run_ctx_off, u8 **branches) { u8 *prog = *pprog; int i; emit_mov_imm32(&prog, false, BPF_REG_0, 0); emit_stx(&prog, BPF_DW, BPF_R...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp.c
int arch_prepare_bpf_dispatcher(void *image, void *buf, s64 *funcs, int num_funcs) { u8 *prog = buf; sort(funcs, num_funcs, sizeof(funcs[0]), cmp_ips, NULL); return emit_bpf_dispatcher(&prog, 0, num_funcs - 1, funcs, image, buf); }
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len) { if (len == 1) *ptr = bytes; else if (len == 2) *(u16 *)ptr = bytes; else { *(u32 *)ptr = bytes; barrier(); } return ptr + len; } #define EMIT(bytes, len) \ do { ...
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static bool is_imm8(int value) { return value <= 127 && value >= -128; }
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static bool is_simm32(s64 value) { return value == (s64)(s32)value; } #define STACK_OFFSET(k) (k) #define TCALL_CNT (MAX_BPF_JIT_REG + 0) #define IA32_EAX (0x0) #define IA32_EBX (0x3) #define IA32_ECX (0x1) #define IA32_EDX (0x2) #define IA32_ESI (0x6) #define IA32_EDI (0x7) #define IA32_EBP (0x5) #define IA32_ESP (0...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static u8 add_1reg(u8 byte, u32 dst_reg) { return byte + dst_reg; }
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static void jit_fill_hole(void *area, unsigned int size) { memset(area, 0xcc, size); }
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static inline void emit_ia32_mov_i(const u8 dst, const u32 val, bool dstk, u8 **pprog) { u8 *prog = *pprog; int cnt = 0; if (dstk) { if (val == 0) { EMIT2(0x33, add_2reg(0xC0, IA32_EAX, IA32_EAX)); /* mov dword ptr [ebp+off],eax */ EMIT3(0x89, add_2reg(0x...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static inline void emit_ia32_mov_r(const u8 dst, const u8 src, bool dstk, bool sstk, u8 **pprog) { u8 *prog = *pprog; int cnt = 0; u8 sreg = sstk ? IA32_EAX : src; if (sstk) EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_EAX), STACK_VAR(src)); if (dstk) /* mov dword ptr...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static inline void emit_ia32_mov_r64(const bool is64, const u8 dst[], const u8 src[], bool dstk, bool sstk, u8 **pprog, const struct bpf_prog_aux *aux) { emit_ia32_mov_r(dst_lo, src_lo, dstk, sstk, pprog); ...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static inline void emit_ia32_shift_r(const u8 op, const u8 dst, const u8 src, bool dstk, bool sstk, u8 **pprog) { u8 *prog = *pprog; int cnt = 0; u8 dreg = dstk ? IA32_EAX : dst; u8 b2; if (dstk) EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_EAX), STACK_VAR(dst)); if ...
[ 1, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static inline void emit_ia32_alu_r64(const bool is64, const u8 op, const u8 dst[], const u8 src[], bool dstk, bool sstk, u8 **pprog, const struct bpf_prog_aux *aux) { u8 *prog = *pprog; emit_ia32_alu_r(is...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static inline void emit_ia32_alu_i64(const bool is64, const u8 op, const u8 dst[], const u32 val, bool dstk, u8 **pprog, const struct bpf_prog_aux *aux) { u8 *prog = *pprog; u32 hi = 0; if (is64 && (val...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static inline void emit_ia32_neg64(const u8 dst[], bool dstk, u8 **pprog) { u8 *prog = *pprog; int cnt = 0; u8 dreg_lo = dstk ? IA32_EAX : dst_lo; u8 dreg_hi = dstk ? IA32_EDX : dst_hi; if (dstk) { EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_EAX), STACK_VAR(dst_lo)); EMIT3(0x8B, add_2reg(0x40, IA32_EBP...
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static int emit_jmp_edx(u8 **pprog, u8 *ip) { u8 *prog = *pprog; int cnt = 0; #ifdef CONFIG_RETPOLINE EMIT1_off32(0xE9, (u8 *)__x86_indirect_thunk_edx - (ip + 5)); #else EMIT2(0xFF, 0xE2); #endif *pprog = prog; return cnt; }
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static void emit_push_r32(const u8 src[], u8 **pprog) { u8 *prog = *pprog; int cnt = 0; EMIT3(0x8B, add_2reg(0x40, IA32_EBP, IA32_ECX), STACK_VAR(src_lo)); /* push ecx */ EMIT1(0x51); *pprog = prog; }
[ 0, 0 ]
Linux Kernel
arch/x86/net/bpf_jit_comp32.c
static u8 get_cond_jmp_opcode(const u8 op, bool is_cmp_lo) { u8 jmp_cond; switch (op) { case BPF_JEQ: jmp_cond = IA32_JE; break; case BPF_JSET: case BPF_JNE: jmp_cond = IA32_JNE; break; case BPF_JGT: /* GT is unsigned '>', JA in x86 */ jmp_cond = IA32_JA; break; case BPF_JLT: ...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/acpi.c
void __init pci_acpi_crs_quirks(void) { int year = dmi_get_bios_year(); if (year >= 0 && year < 2008 && iomem_resource.end <= 0xffffffff) pci_use_crs = false; if (year >= 2023) pci_use_e820 = false; dmi_check_system(pci_crs_quirks); /* * If the user specifies "pci=use_crs" or "pci=nocrs" explic...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/acpi.c
static void teardown_mcfg_map(struct acpi_pci_root_info *ci) { struct pci_root_info *info; info = container_of(ci, struct pci_root_info, common); if (info->mcfg_added) { pci_mmconfig_delete(info->sd.domain, info->start_bus, info->end_bus); info->mcfg_added = false; } }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/acpi.c
static int pci_acpi_root_init_info(struct acpi_pci_root_info *ci) { return setup_mcfg_map(ci); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/acpi.c
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) { int domain = root->segment; int busnum = root->secondary.start; int node = pci_acpi_root_get_node(root); struct pci_bus *bus; if (pci_ignore_seg) root->segment = domain = 0; if (domain && !pci_domains_supported) { printk(KERN_WARNING...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/acpi.c
int __init pci_acpi_init(void) { struct pci_dev *dev = NULL; if (acpi_noirq) return -ENODEV; printk(KERN_INFO "PCI: Using ACPI for IRQ routing\n"); acpi_irq_penalty_init(); pcibios_enable_irq = acpi_pci_irq_enable; pcibios_disable_irq = acpi_pci_irq_disable; x86_init.pci.init_irq = x86_init_noop; ...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/amd_bus.c
static int amd_bus_cpu_online(unsigned int cpu) { u64 reg; rdmsrl(MSR_AMD64_NB_CFG, reg); if (!(reg & ENABLE_CF8_EXT_CFG)) { reg |= ENABLE_CF8_EXT_CFG; wrmsrl(MSR_AMD64_NB_CFG, reg); } return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/amd_bus.c
static int __init pci_io_ecs_init(void) { int ret; if (boot_cpu_data.x86 < 0x10) return 0; /* Try the PCI method first. */ if (early_pci_allowed()) pci_enable_pci_io_ecs(); ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "pci/amd_bus:online", amd_bus_cpu_online, NULL); WARN...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/amd_bus.c
static int __init amd_postcore_init(void) { if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD && boot_cpu_data.x86_vendor != X86_VENDOR_HYGON) return 0; early_root_info_init(); pci_io_ecs_init(); return 0; }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/bus_numa.c
void update_res(struct pci_root_info *info, resource_size_t start, resource_size_t end, unsigned long flags, int merge) { struct resource *res; struct pci_root_res *root_res; if (start > end) return; if (start == MAX_RESOURCE) return; if (!merge) goto addit; list_for_each_ent...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/ce4100.c
static void __init init_sim_regs(void) { int i; for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { if (bus1_fixups[i].init) bus1_fixups[i].init(&bus1_fixups[i]); } }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/ce4100.c
int bridge_read(unsigned int devfn, int reg, int len, u32 *value) { u32 av_bridge_base, av_bridge_limit; int retval = 0; switch (reg) { case PCI_BASE_ADDRESS_0: case PCI_BASE_ADDRESS_0 + 1: case PCI_BASE_ADDRESS_0 + 2: case PCI_BASE_ADDRESS_0 + 3: *value = 0; break; /* Since subordinate bus...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/ce4100.c
static int ce4100_bus1_read(unsigned int devfn, int reg, int len, u32 *value) { unsigned long flags; int i; for (i = 0; i < ARRAY_SIZE(bus1_fixups); i++) { if (bus1_fixups[i].dev_func == devfn && bus1_fixups[i].reg == (reg & ~3) && bus1_fixups[i].read) { raw_spin_lock_irqsave(&pci_config_lock...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/ce4100.c
int __init ce4100_pci_init(void) { init_sim_regs(); raw_pci_ops = &ce4100_pci_conf; return 1; }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) { return raw_pci_read(pci_domain_nr(bus), bus->number, devfn, where, size, value); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
void pcibios_fixup_bus(struct pci_bus *b) { struct pci_dev *dev; pci_read_bridge_bases(b); list_for_each_entry(dev, &b->devices, bus_list) pcibios_fixup_device_resources(dev); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
void pcibios_add_bus(struct pci_bus *bus) { acpi_pci_add_bus(bus); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
void pcibios_remove_bus(struct pci_bus *bus) { acpi_pci_remove_bus(bus); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
static int __init find_sort_method(const struct dmi_system_id *d) { dmi_walk(read_dmi_type_b1, (void *)d); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
void __init dmi_check_pciprobe(void) { dmi_check_system(pciprobe_dmi_table); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
void pcibios_scan_root(int busnum) { struct pci_bus *bus; struct pci_sysdata *sd; LIST_HEAD(resources); sd = kzalloc(sizeof(*sd), GFP_KERNEL); if (!sd) { printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busnum); return; } sd->node = x86_pci_root_bus_node(busnum); x86_pci_root_bus_resources...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/common.c
int pcibios_device_add(struct pci_dev *dev) { struct pci_setup_rom *rom; struct irq_domain *msidom; struct setup_data *data; u64 pa_data; pa_data = boot_params.hdr.setup_data; while (pa_data) { data = memremap(pa_data, sizeof(*rom), MEMREMAP_WB); if (!data) return -ENOMEM; if (data->type...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/common.c
int pcibios_enable_device(struct pci_dev *dev, int mask) { int err; if ((err = pci_enable_resources(dev, mask)) < 0) return err; if (!pci_dev_msi_enabled(dev)) return pcibios_enable_irq(dev); return 0; }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/direct.c
static int pci_conf1_write(unsigned int seg, unsigned int bus, unsigned int devfn, int reg, int len, u32 value) { unsigned long flags; if (seg || (bus > 255) || (devfn > 255) || (reg > 4095)) return -EINVAL; raw_spin_lock_irqsave(&pci_config_lock, flags); outl(PCI_CONF1_ADDRES...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/direct.c
static int __init pci_sanity_check(const struct pci_raw_ops *o) { u32 x = 0; int devfn; if (pci_probe & PCI_NO_CHECKS) return 1; if (dmi_get_bios_year() >= 2001) return 1; for (devfn = 0; devfn < 0x100; devfn++) { if (o->read(0, 0, devfn, PCI_CLASS_DEVICE, 2, &x)) continue; if (x == P...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/direct.c
static int __init pci_check_type2(void) { unsigned long flags; int works = 0; local_irq_save(flags); outb(0x00, 0xCFB); outb(0x00, 0xCF8); outb(0x00, 0xCFA); if (inb(0xCF8) == 0x00 && inb(0xCFA) == 0x00 && pci_sanity_check(&pci_direct_conf2)) { works = 1; } local_irq_restore(flags); r...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/early.c
void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val) { outl(0x80000000 | (bus << 16) | (slot << 11) | (func << 8) | offset, 0xcf8); outl(val, 0xcfc); }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/early.c
void write_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset, u16 val) { outl(0x80000000 | (bus << 16) | (slot << 11) | (func << 8) | offset, 0xcf8); outw(val, 0xcfc + (offset & 2)); }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/fixup.c
static void pci_fixup_latency(struct pci_dev *d) { dev_dbg(&d->dev, "Setting max latency to 32\n"); pcibios_max_latency = 32; }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/fixup.c
static void pci_fixup_msi_k8t_onboard_sound(struct pci_dev *dev) { unsigned char val; if (!dmi_check_system(msi_k8t_dmi_table)) return; pci_read_config_byte(dev, 0x50, &val); if (val & 0x40) { pci_write_config_byte(dev, 0x50, val & (~0x40)); /* verify the change for status output */ pci_read_c...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/fixup.c
static void pci_post_fixup_toshiba_ohci1394(struct pci_dev *dev) { if (!dmi_check_system(toshiba_ohci1394_dmi_table)) return; /* Restore config space on Toshiba laptops */ pci_write_config_word(dev, PCI_CACHE_LINE_SIZE, toshiba_line_size); pci_read_config_byte(dev, PCI_INTERRUPT_LINE, (u8 *)&dev->irq); p...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/fixup.c
static void pci_early_fixup_cyrix_5530(struct pci_dev *dev) { u8 r; pci_read_config_byte(dev, 0x42, &r); r &= 0xfd; pci_write_config_byte(dev, 0x42, r); }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/fixup.c
static void pci_fixup_amd_ehci_pme(struct pci_dev *dev) { dev_info(&dev->dev, "PME# does not work under D3, disabling it\n"); dev->pme_support &= ~((PCI_PM_CAP_PME_D3hot | PCI_PM_CAP_PME_D3cold) >> PCI_PM_CAP_PME_SHIFT); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/fixup.c
static void pci_fixup_amd_fch_xhci_pme(struct pci_dev *dev) { dev_info(&dev->dev, "PME# does not work under D0, disabling it\n"); dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/i386.c
static void pcibios_save_fw_addr(struct pci_dev *dev, int idx, resource_size_t fw_addr) { unsigned long flags; struct pcibios_fwaddrmap *map; if (pcibios_fw_addr_done) return; spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags); map = pcibios_fwaddrmap_lookup(dev); if (...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/i386.c
static void pcibios_allocate_bridge_resources(struct pci_dev *dev) { int idx; struct resource *r; for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { r = &dev->resource[idx]; if (!r->flags) continue; if (r->parent) continue; if (!r->start || pci_claim_bridge_resource(de...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/i386.c
static void pcibios_allocate_resources(struct pci_bus *bus, int pass) { struct pci_dev *dev; struct pci_bus *child; list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_allocate_dev_resources(dev, pass); child = dev->subordinate; if (child) pcibios_allocate_resources(child, pass); } ...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/i386.c
static void pcibios_allocate_dev_rom_resource(struct pci_dev *dev) { struct resource *r; r = &dev->resource[PCI_ROM_RESOURCE]; if (!r->flags || !r->start) return; if (r->parent) /* Already allocated */ return; if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { r->end -= r->start; r->start ...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/intel_mid_pci.c
static int fixed_bar_cap(struct pci_bus *bus, unsigned int devfn) { int pos; u32 pcie_cap = 0, cap_data; pos = PCIE_CAP_OFFSET; if (!raw_pci_ext_ops) return 0; while (pos) { if (raw_pci_ext_ops->read(pci_domain_nr(bus), bus->number, devfn, pos, 4, &pcie_cap)) ret...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/intel_mid_pci.c
static int pci_device_update_fixed(struct pci_bus *bus, unsigned int devfn, int reg, int len, u32 val, int offset) { u32 size; unsigned int domain, busnum; int bar = (reg - PCI_BASE_ADDRESS_0) >> 2; domain = pci_domain_nr(bus); busnum = bus->number; if (val == ~0 && len ...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/intel_mid_pci.c
static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) { if (type1_access_ok(bus->number, devfn, where)) return pci_direct_conf1.read(pci_domain_nr(bus), bus->number, devfn, where, size, value); return raw_pci_ext_ops->...
[ 0, 0 ]
Linux Kernel
arch/x86/pci/intel_mid_pci.c
int __init intel_mid_pci_init(void) { pr_info("Intel MID platform detected, using MID PCI ops\n"); pci_mmcfg_late_init(); pcibios_enable_irq = intel_mid_pci_irq_enable; pcibios_disable_irq = intel_mid_pci_irq_disable; pci_root_ops = intel_mid_pci_ops; pci_soc_mode = 1; acpi_noirq_set(); return 1; }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/intel_mid_pci.c
static void mid_power_off_one_device(struct pci_dev *dev) { u16 pmcsr; pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); dev->current_state = (pci_power_t __force)(pmcsr & PCI_PM_CTRL_STATE_MASK); pci_set_power_state(dev, PCI_D3hot); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/intel_mid_pci.c
static void mid_power_off_devices(struct pci_dev *dev) { int id; if (!pci_soc_mode) return; id = intel_mid_pwr_get_lss_id(dev); if (id < 0) return; mid_power_off_one_device(dev); }
[ 0, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static inline struct irq_routing_table *pirq_check_routing_table(u8 *addr, u8 *limit) { struct irq_routing_table *rt; int i; u8 sum; rt = (struct irq_routing_table *)addr; if (rt->signature != PIRQ_SIGNATURE || rt->version != PIRQ_VERSION || ...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static inline struct irq_routing_table *pirq_convert_irt_table(u8 *addr, u8 *limit) { struct irt_routing_table *ir; struct irq_routing_table *rt; u16 size; u8 sum; int i; ir = (struct irt_routing_table *)addr; if (ir->signature != IRT_SIGNATU...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static void __init pirq_peer_trick(void) { struct irq_routing_table *rt = pirq_table; u8 busmap[256]; int i; struct irq_info *e; memset(busmap, 0, sizeof(busmap)); for (i = 0; i < (rt->size - sizeof(struct irq_routing_table)) / sizeof(struct irq_info); i++) { e = &rt->slots...
[ 1, 1 ]
Linux Kernel
arch/x86/pci/irq.c
static u8 read_pc_conf_nybble(u8 base, u8 index) { u8 reg = base + (index >> 1); u8 x; x = pc_conf_get(reg); return index & 1 ? x >> 4 : x & 0xf; }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static unsigned int read_config_nybble(struct pci_dev *router, unsigned offset, unsigned nr) { u8 x; unsigned reg = offset + (nr >> 1); pci_read_config_byte(router, reg, &x); return (nr & 1) ? (x >> 4) : (x & 0xf); }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static int pirq_esc_get(struct pci_dev *router, struct pci_dev *dev, int pirq) { unsigned long flags; int reg; u8 x; reg = pirq; if (reg >= 1 && reg <= 4) reg += PC_CONF_I82374_PIRQ_ROUTE_CONTROL - 1; raw_spin_lock_irqsave(&pc_conf_lock, flags); pc_conf_set(PC_CONF_I82374_ESC_ID, PC_CONF_I82374_ESC...
[ 1, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static int pirq_ib_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) { int reg; reg = pirq; if (reg >= 1 && reg <= 2) reg += PCI_I82426EX_PIRQ_ROUTE_CONTROL - 1; pci_write_config_byte(router, reg, irq); return 1; }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq) { static const unsigned int pirqmap[5] = {3, 2, 5, 1, 1}; WARN_ON_ONCE(pirq > 5); write_config_nybble(router, 0x55, pirqmap[pirq - 1], irq); return 1; }
[ 1, 0 ]
Linux Kernel
arch/x86/pci/irq.c
static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq) { static const unsigned char pirqmap[4] = {1, 0, 2, 3}; WARN_ON_ONCE(pirq > 4); return read_config_nybble(router, 0x43, pirqmap[pirq - 1]); }
[ 1, 1 ]