/***********************license start************************************ * Copyright (c) 2003-2017 Cavium, Inc. * All rights reserved. * * License: one of 'Cavium License' or 'GNU General Public License Version 2' * * This file is provided under the terms of the Cavium License (see below) * or under the terms of GNU General Public License, Version 2, as * published by the Free Software Foundation. When using or redistributing * this file, you may do so under either license. * * Cavium License: Redistribution and use in source and binary forms, with * or without modification, are permitted provided that the following * conditions are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Cavium Inc. nor the names of its contributors may be * used to endorse or promote products derived from this software without * specific prior written permission. * * This Software, including technical data, may be subject to U.S. export * control laws, including the U.S. Export Administration Act and its * associated regulations, and may be subject to export or import * regulations in other countries. * * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) * WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A * PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET * ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE * ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES * WITH YOU. ***********************license end**************************************/ #include "common.h" #include "zip_crypto.h" #define DRV_NAME … static struct zip_device *zip_dev[MAX_ZIP_DEVICES]; static const struct pci_device_id zip_id_table[] = …; static void zip_debugfs_init(void); static void zip_debugfs_exit(void); static int zip_register_compression_device(void); static void zip_unregister_compression_device(void); void zip_reg_write(u64 val, u64 __iomem *addr) { … } u64 zip_reg_read(u64 __iomem *addr) { … } /* * Allocates new ZIP device structure * Returns zip_device pointer or NULL if cannot allocate memory for zip_device */ static struct zip_device *zip_alloc_device(struct pci_dev *pdev) { … } /** * zip_get_device - Get ZIP device based on node id of cpu * * @node: Node id of the current cpu * Return: Pointer to Zip device structure */ struct zip_device *zip_get_device(int node) { … } /** * zip_get_node_id - Get the node id of the current cpu * * Return: Node id of the current cpu */ int zip_get_node_id(void) { … } /* Initializes the ZIP h/w sub-system */ static int zip_init_hw(struct zip_device *zip) { … } static void zip_reset(struct zip_device *zip) { … } static int zip_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { … } static void zip_remove(struct pci_dev *pdev) { … } /* PCI Sub-System Interface */ static struct pci_driver zip_driver = …; /* Kernel Crypto Subsystem Interface */ static struct crypto_alg zip_comp_deflate = …; static struct crypto_alg zip_comp_lzs = …; static struct scomp_alg zip_scomp_deflate = …; static struct scomp_alg zip_scomp_lzs = …; static int zip_register_compression_device(void) { … } static void zip_unregister_compression_device(void) { … } /* * debugfs functions */ #ifdef CONFIG_DEBUG_FS #include <linux/debugfs.h> /* Displays ZIP device statistics */ static int zip_stats_show(struct seq_file *s, void *unused) { … } /* Clears stats data */ static int zip_clear_show(struct seq_file *s, void *unused) { … } static struct zip_registers zipregs[64] = …; /* Prints registers' contents */ static int zip_regs_show(struct seq_file *s, void *unused) { … } DEFINE_SHOW_ATTRIBUTE(…); DEFINE_SHOW_ATTRIBUTE(…); DEFINE_SHOW_ATTRIBUTE(…); /* Root directory for thunderx_zip debugfs entry */ static struct dentry *zip_debugfs_root; static void zip_debugfs_init(void) { … } static void zip_debugfs_exit(void) { … } #else static void __init zip_debugfs_init(void) { } static void __exit zip_debugfs_exit(void) { } #endif /* debugfs - end */ module_pci_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …; MODULE_DEVICE_TABLE(pci, zip_id_table);