type
stringclasses
5 values
content
stringlengths
9
163k
functions
void ide_set_pio(ide_drive_t *drive, u8 req_pio) { ide_hwif_t *hwif = drive->hwif; const struct ide_port_ops *port_ops = hwif->port_ops; u8 host_pio, pio; if (port_ops == NULL || port_ops->set_pio_mode == NULL || (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) return; BUG_ON(hwif->pio_mask == 0x00); host_pi...
functions
u8 ide_rate_filter(ide_drive_t *drive, u8 speed) { ide_hwif_t *hwif = drive->hwif; u8 mode = ide_find_dma_mode(drive, speed); if (mode == 0) { if (hwif->pio_mask) mode = fls(hwif->pio_mask) - 1 + XFER_PIO_0; else mode = XFER_PIO_4; }
functions
int ide_set_xfer_rate(ide_drive_t *drive, u8 rate) { ide_hwif_t *hwif = drive->hwif; const struct ide_port_ops *port_ops = hwif->port_ops; if (port_ops == NULL || port_ops->set_dma_mode == NULL || (hwif->host_flags & IDE_HFLAG_NO_SET_MODE)) return -1; rate = ide_rate_filter(drive, rate); BUG_ON(rate < XF...
includes
#include <stdio.h>
includes
#include <string.h>
includes
#include <stdlib.h>
includes
#include <openssl/evp.h>
includes
#include <openssl/md5.h>
functions
int main(int argc, char *argv[]) { int i,err=0; char **P,**R; char *p; unsigned char md[MD5_DIGEST_LENGTH]; P=test; R=ret; i=1; while (*P != NULL) { EVP_Digest(&(P[0][0]),strlen((char *)*P),md,NULL,EVP_md5(), NULL); p=pt(md); if (strcmp(p,(char *)*R) != 0) { printf("error calculating MD5 on '%s'...
main
int main(int argc, char *argv[]) { printf("No MD5 support\n"); return(0); }
includes
#include <linux/fs.h>
includes
#include <linux/f2fs_fs.h>
includes
#include <linux/buffer_head.h>
includes
#include <linux/mpage.h>
includes
#include <linux/writeback.h>
includes
#include <linux/backing-dev.h>
includes
#include <linux/pagevec.h>
includes
#include <linux/blkdev.h>
includes
#include <linux/bio.h>
includes
#include <linux/prefetch.h>
includes
#include <linux/uio.h>
includes
#include <linux/cleancache.h>
includes
#include <trace/events/f2fs.h>
functions
void f2fs_read_end_io(struct bio *bio) { struct bio_vec *bvec; int i; if (f2fs_bio_encrypted(bio)) { if (bio->bi_error) { f2fs_release_crypto_ctx(bio->bi_private); }
functions
void f2fs_write_end_io(struct bio *bio) { struct f2fs_sb_info *sbi = bio->bi_private; struct bio_vec *bvec; int i; bio_for_each_segment_all(bvec, bio, i) { struct page *page = bvec->bv_page; f2fs_restore_and_release_control_page(&page); if (unlikely(bio->bi_error)) { set_page_dirty(page); set_bit(AS_...
functions
void __submit_merged_bio(struct f2fs_bio_info *io) { struct f2fs_io_info *fio = &io->fio; if (!io->bio) return; if (is_read_io(fio->rw)) trace_f2fs_submit_read_bio(io->sbi->sb, fio, io->bio); else trace_f2fs_submit_write_bio(io->sbi->sb, fio, io->bio); submit_bio(fio->rw, io->bio); io->bio = NULL; }
functions
void f2fs_submit_merged_bio(struct f2fs_sb_info *sbi, enum page_type type, int rw) { enum page_type btype = PAGE_TYPE_OF_BIO(type); struct f2fs_bio_info *io; io = is_read_io(rw) ? &sbi->read_io : &sbi->write_io[btype]; down_write(&io->io_rwsem); /* change META to META_FLUSH in the checkpoint procedure */ i...
functions
int f2fs_submit_page_bio(struct f2fs_io_info *fio) { struct bio *bio; struct page *page = fio->encrypted_page ? fio->encrypted_page : fio->page; trace_f2fs_submit_page_bio(page, fio); f2fs_trace_ios(fio, 0); /* Allocate a new bio */ bio = __bio_alloc(fio->sbi, fio->blk_addr, 1, is_read_io(fio->rw)); if (bio_a...
functions
void f2fs_submit_page_mbio(struct f2fs_io_info *fio) { struct f2fs_sb_info *sbi = fio->sbi; enum page_type btype = PAGE_TYPE_OF_BIO(fio->type); struct f2fs_bio_info *io; bool is_read = is_read_io(fio->rw); struct page *bio_page; io = is_read ? &sbi->read_io : &sbi->write_io[btype]; verify_block_addr(sbi, fio->...
functions
void set_data_blkaddr(struct dnode_of_data *dn) { struct f2fs_node *rn; __le32 *addr_array; struct page *node_page = dn->node_page; unsigned int ofs_in_node = dn->ofs_in_node; f2fs_wait_on_page_writeback(node_page, NODE); rn = F2FS_NODE(node_page); /* Get physical address of data block */ addr_array = blkadd...
functions
int reserve_new_block(struct dnode_of_data *dn) { struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))) return -EPERM; if (unlikely(!inc_valid_block_count(sbi, dn->inode, 1))) return -ENOSPC; trace_f2fs_reserve_new_block(dn->inode, dn->nid, dn->ofs_i...
functions
int f2fs_reserve_block(struct dnode_of_data *dn, pgoff_t index) { bool need_put = dn->inode_page ? false : true; int err; err = get_dnode_of_data(dn, index, ALLOC_NODE); if (err) return err; if (dn->data_blkaddr == NULL_ADDR) err = reserve_new_block(dn); if (err || need_put) f2fs_put_dnode(dn); return er...
functions
int f2fs_get_block(struct dnode_of_data *dn, pgoff_t index) { struct extent_info ei; struct inode *inode = dn->inode; if (f2fs_lookup_extent_cache(inode, index, &ei)) { dn->data_blkaddr = ei.blk + index - ei.fofs; return 0; }
functions
int __allocate_data_block(struct dnode_of_data *dn) { struct f2fs_sb_info *sbi = F2FS_I_SB(dn->inode); struct f2fs_inode_info *fi = F2FS_I(dn->inode); struct f2fs_summary sum; struct node_info ni; int seg = CURSEG_WARM_DATA; pgoff_t fofs; if (unlikely(is_inode_flag_set(F2FS_I(dn->inode), FI_NO_ALLOC))) return...
functions
void __allocate_data_blocks(struct inode *inode, loff_t offset, size_t count) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct dnode_of_data dn; u64 start = F2FS_BYTES_TO_BLK(offset); u64 len = F2FS_BYTES_TO_BLK(count); bool allocated; u64 end_offset; while (len) { f2fs_balance_fs(sbi); f2fs_loc...
functions
int f2fs_map_blocks(struct inode *inode, struct f2fs_map_blocks *map, int create, int flag) { unsigned int maxblocks = map->m_len; struct dnode_of_data dn; int mode = create ? ALLOC_NODE : LOOKUP_NODE_RA; pgoff_t pgofs, end_offset; int err = 0, ofs = 1; struct extent_info ei; bool allocated = false; map-...
functions
else if (flag == F2FS_GET_BLOCK_READ || flag == F2FS_GET_BLOCK_DIO) { goto put_out; }
functions
else if (create) { err = __allocate_data_block(&dn); if (err) goto put_out; allocated = true; map->m_flags = F2FS_MAP_NEW | F2FS_MAP_MAPPED; map->m_pblk = dn.data_blkaddr; }
functions
int __get_data_block(struct inode *inode, sector_t iblock, struct buffer_head *bh, int create, int flag) { struct f2fs_map_blocks map; int ret; map.m_lblk = iblock; map.m_len = bh->b_size >> inode->i_blkbits; ret = f2fs_map_blocks(inode, &map, create, flag); if (!ret) { map_bh(bh, inode->i_sb, map.m_pblk);...
functions
int get_data_block(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create, int flag) { return __get_data_block(inode, iblock, bh_result, create, flag); }
functions
int get_data_block_dio(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { return __get_data_block(inode, iblock, bh_result, create, F2FS_GET_BLOCK_DIO); }
functions
int get_data_block_bmap(struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { return __get_data_block(inode, iblock, bh_result, create, F2FS_GET_BLOCK_BMAP); }
functions
sector_t logical_to_blk(struct inode *inode, loff_t offset) { return (offset >> inode->i_blkbits); }
functions
loff_t blk_to_logical(struct inode *inode, sector_t blk) { return (blk << inode->i_blkbits); }
functions
int f2fs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 start, u64 len) { struct buffer_head map_bh; sector_t start_blk, last_blk; loff_t isize = i_size_read(inode); u64 logical = 0, phys = 0, size = 0; u32 flags = 0; bool past_eof = false, whole_file = false; int ret = 0; ret = fiemap_c...
functions
else if (size) { ret = fiemap_fill_next_extent(fieinfo, logical, phys, size, flags); size = 0; }
functions
int f2fs_mpage_readpages(struct address_space *mapping, struct list_head *pages, struct page *page, unsigned nr_pages) { struct bio *bio = NULL; unsigned page_idx; sector_t last_block_in_bio = 0; struct inode *inode = mapping->host; const unsigned blkbits = inode->i_blkbits; const unsigned blocksize = 1 << ...
functions
int f2fs_read_data_page(struct file *file, struct page *page) { struct inode *inode = page->mapping->host; int ret = -EAGAIN; trace_f2fs_readpage(page, DATA); /* If the file has inline data, try to read it directly */ if (f2fs_has_inline_data(inode)) ret = f2fs_read_inline_data(inode, page); if (ret == -EAGAI...
functions
int f2fs_read_data_pages(struct file *file, struct address_space *mapping, struct list_head *pages, unsigned nr_pages) { struct inode *inode = file->f_mapping->host; /* If the file has inline data, skip readpages */ if (f2fs_has_inline_data(inode)) return 0; return f2fs_mpage_readpages(mapping, pages, NUL...
functions
int do_write_data_page(struct f2fs_io_info *fio) { struct page *page = fio->page; struct inode *inode = page->mapping->host; struct dnode_of_data dn; int err = 0; set_new_dnode(&dn, inode, NULL, NULL, 0); err = get_dnode_of_data(&dn, page->index, LOOKUP_NODE); if (err) return err; fio->blk_addr = dn.data_bl...
functions
int f2fs_write_data_page(struct page *page, struct writeback_control *wbc) { struct inode *inode = page->mapping->host; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); loff_t i_size = i_size_read(inode); const pgoff_t end_index = ((unsigned long long) i_size) >> PAGE_CACHE_SHIFT; unsigned offset = 0; boo...
functions
int __f2fs_writepage(struct page *page, struct writeback_control *wbc, void *data) { struct address_space *mapping = data; int ret = mapping->a_ops->writepage(page, wbc); mapping_set_error(mapping, ret); return ret; }
functions
int f2fs_write_cache_pages(struct address_space *mapping, struct writeback_control *wbc, writepage_t writepage, void *data) { int ret = 0; int done = 0; struct pagevec pvec; int nr_pages; pgoff_t uninitialized_var(writeback_index); pgoff_t index; pgoff_t end; /* Inclusive */ pgoff_t done_index; int cycl...
functions
int f2fs_write_data_pages(struct address_space *mapping, struct writeback_control *wbc) { struct inode *inode = mapping->host; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); bool locked = false; int ret; long diff; trace_f2fs_writepages(mapping->host, wbc, DATA); /* deal with chardevs and other special fi...
functions
void f2fs_write_failed(struct address_space *mapping, loff_t to) { struct inode *inode = mapping->host; if (to > inode->i_size) { truncate_pagecache(inode, inode->i_size); truncate_blocks(inode, inode->i_size, true); }
functions
int f2fs_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); struct page *page = NULL; struct page *ipage; pgoff_t index = ((unsigned long ...
functions
int f2fs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) { struct inode *inode = page->mapping->host; trace_f2fs_write_end(inode, pos, len, copied); set_page_dirty(page); if (pos + copied > i_size_read(inode)) { i_...
functions
int check_direct_IO(struct inode *inode, struct iov_iter *iter, loff_t offset) { unsigned blocksize_mask = inode->i_sb->s_blocksize - 1; if (offset & blocksize_mask) return -EINVAL; if (iov_iter_alignment(iter) & blocksize_mask) return -EINVAL; return 0; }
functions
ssize_t f2fs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset) { struct file *file = iocb->ki_filp; struct address_space *mapping = file->f_mapping; struct inode *inode = mapping->host; size_t count = iov_iter_count(iter); int err; /* we don't need to use inline_data strictly */ if (f...
functions
void f2fs_invalidate_page(struct page *page, unsigned int offset, unsigned int length) { struct inode *inode = page->mapping->host; struct f2fs_sb_info *sbi = F2FS_I_SB(inode); if (inode->i_ino >= F2FS_ROOT_INO(sbi) && (offset % PAGE_CACHE_SIZE || length != PAGE_CACHE_SIZE)) return; if (PageDirty(page)...
functions
int f2fs_release_page(struct page *page, gfp_t wait) { /* If this is dirty page, keep PagePrivate */ if (PageDirty(page)) return 0; /* This is atomic written page, keep Private */ if (IS_ATOMIC_WRITTEN_PAGE(page)) return 0; ClearPagePrivate(page); return 1; }
functions
int f2fs_set_data_page_dirty(struct page *page) { struct address_space *mapping = page->mapping; struct inode *inode = mapping->host; trace_f2fs_set_page_dirty(page, DATA); SetPageUptodate(page); if (f2fs_is_atomic_file(inode)) { if (!IS_ATOMIC_WRITTEN_PAGE(page)) { register_inmem_page(inode, page); ret...
functions
sector_t f2fs_bmap(struct address_space *mapping, sector_t block) { struct inode *inode = mapping->host; /* we don't need to use inline_data strictly */ if (f2fs_has_inline_data(inode)) { int err = f2fs_convert_inline_inode(inode); if (err) return err; }
includes
#include <linux/firmware.h>
includes
#include <linux/pci_ids.h>
includes
#include <linux/uaccess.h>
includes
#include <linux/vmalloc.h>
includes
#include <linux/kernel.h>
includes
#include <linux/module.h>
includes
#include <linux/pci.h>
includes
#include <asm/microcode.h>
includes
#include <asm/processor.h>
includes
#include <asm/msr.h>
defines
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
defines
#define UCODE_MAGIC 0x00414d44
defines
#define UCODE_EQUIV_CPU_TABLE_TYPE 0x00000000
defines
#define UCODE_UCODE_TYPE 0x00000001
defines
#define SECTION_HDR_SIZE 8
defines
#define CONTAINER_HDR_SZ 12
defines
#define F1XH_MPB_MAX_SIZE 2048
defines
#define F14H_MPB_MAX_SIZE 1824
defines
#define F15H_MPB_MAX_SIZE 4096
defines
#define F16H_MPB_MAX_SIZE 3458
structs
struct microcode_amd { struct microcode_header_amd hdr; unsigned int mpb[0]; };
structs
struct ucode_patch { struct list_head plist; void *data; u32 patch_id; u16 equiv_cpu; };
functions
u16 find_equiv_id(unsigned int cpu) { struct ucode_cpu_info *uci = ucode_cpu_info + cpu; int i = 0; if (!equiv_cpu_table) return 0; while (equiv_cpu_table[i].installed_cpu != 0) { if (uci->cpu_sig.sig == equiv_cpu_table[i].installed_cpu) return equiv_cpu_table[i].equiv_cpu; i++; }
functions
u32 find_cpu_family_by_equiv_cpu(u16 equiv_cpu) { int i = 0; BUG_ON(!equiv_cpu_table); while (equiv_cpu_table[i].equiv_cpu != 0) { if (equiv_cpu == equiv_cpu_table[i].equiv_cpu) return equiv_cpu_table[i].installed_cpu; i++; }
functions
void update_cache(struct ucode_patch *new_patch) { struct ucode_patch *p; list_for_each_entry(p, &pcache, plist) { if (p->equiv_cpu == new_patch->equiv_cpu) { if (p->patch_id >= new_patch->patch_id) /* we already have the latest patch */ return; list_replace(&p->plist, &new_patch->plist); kfree(p...
functions
void free_cache(void) { struct ucode_patch *p, *tmp; list_for_each_entry_safe(p, tmp, &pcache, plist) { __list_del(p->plist.prev, p->plist.next); kfree(p->data); kfree(p); }
functions
int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) { struct cpuinfo_x86 *c = &cpu_data(cpu); csig->sig = cpuid_eax(0x00000001); csig->rev = c->microcode; pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev); return 0; }
functions
int verify_patch_size(int cpu, u32 patch_size, unsigned int size) { struct cpuinfo_x86 *c = &cpu_data(cpu); u32 max_size; switch (c->x86) { case 0x14: max_size = F14H_MPB_MAX_SIZE; break; case 0x15: max_size = F15H_MPB_MAX_SIZE; break; case 0x16: max_size = F16H_MPB_MAX_SIZE; break; de...
functions
int apply_microcode_amd(int cpu) { struct cpuinfo_x86 *c = &cpu_data(cpu); struct microcode_amd *mc_amd; struct ucode_cpu_info *uci; struct ucode_patch *p; u32 rev, dummy; BUG_ON(raw_smp_processor_id() != cpu); uci = ucode_cpu_info + cpu; p = find_patch(cpu); if (!p) return 0; mc_amd = p->data; uci->m...
functions
int install_equiv_cpu_table(const u8 *buf) { unsigned int *ibuf = (unsigned int *)buf; unsigned int type = ibuf[1]; unsigned int size = ibuf[2]; if (type != UCODE_EQUIV_CPU_TABLE_TYPE || !size) { pr_err("empty section/" "invalid type field in container file section header\n"); return -EINVAL; }
functions
void free_equiv_cpu_table(void) { vfree(equiv_cpu_table); equiv_cpu_table = NULL; }
functions
void cleanup(void) { free_equiv_cpu_table(); free_cache(); }
functions
int verify_and_add_patch(unsigned int cpu, u8 *fw, unsigned int leftover) { struct cpuinfo_x86 *c = &cpu_data(cpu); struct microcode_header_amd *mc_hdr; struct ucode_patch *patch; unsigned int patch_size, crnt_size, ret; u32 proc_fam; u16 proc_id; patch_size = *(u32 *)(fw + 4); crnt_size = patch_size + SECT...
functions
ucode_state load_microcode_amd(int cpu, const u8 *data, size_t size) { enum ucode_state ret = UCODE_ERROR; unsigned int leftover; u8 *fw = (u8 *)data; int crnt_size = 0; int offset; offset = install_equiv_cpu_table(data); if (offset < 0) { pr_err("failed to create equivalent cpu table\n"); return ret; }
functions
ucode_state request_microcode_amd(int cpu, struct device *device, bool refresh_fw) { char fw_name[36] = "amd-ucode/microcode_amd.bin"; struct cpuinfo_x86 *c = &cpu_data(cpu); enum ucode_state ret = UCODE_NFOUND; const struct firmware *fw; /* reload ucode container only on the boot cpu */ if (!refresh_...
functions
ucode_state request_microcode_user(int cpu, const void __user *buf, size_t size) { return UCODE_ERROR; }
functions
void microcode_fini_cpu_amd(int cpu) { struct ucode_cpu_info *uci = ucode_cpu_info + cpu; uci->mc = NULL; }