^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * License. See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * (C) Copyright 2020 Hewlett Packard Enterprise Development LP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) 2004-2008 Silicon Graphics, Inc. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * Cross Partition (XP) base.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * XP provides a base from which its users can interact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * with XPC, yet not be dependent on XPC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "xp.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /* define the XP debug device structures to be used with dev_dbg() et al */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct device_driver xp_dbg_name = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) .name = "xp"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct device xp_dbg_subname = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) .init_name = "", /* set to "" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) .driver = &xp_dbg_name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) struct device *xp = &xp_dbg_subname;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /* max #of partitions possible */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) short xp_max_npartitions;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) EXPORT_SYMBOL_GPL(xp_max_npartitions);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) short xp_partition_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) EXPORT_SYMBOL_GPL(xp_partition_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 xp_region_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) EXPORT_SYMBOL_GPL(xp_region_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) unsigned long (*xp_pa) (void *addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) EXPORT_SYMBOL_GPL(xp_pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned long (*xp_socket_pa) (unsigned long gpa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) EXPORT_SYMBOL_GPL(xp_socket_pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) enum xp_retval (*xp_remote_memcpy) (unsigned long dst_gpa,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) const unsigned long src_gpa, size_t len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) EXPORT_SYMBOL_GPL(xp_remote_memcpy);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) int (*xp_cpu_to_nasid) (int cpuid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) EXPORT_SYMBOL_GPL(xp_cpu_to_nasid);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) enum xp_retval (*xp_expand_memprotect) (unsigned long phys_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) EXPORT_SYMBOL_GPL(xp_expand_memprotect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) enum xp_retval (*xp_restrict_memprotect) (unsigned long phys_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) EXPORT_SYMBOL_GPL(xp_restrict_memprotect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) * xpc_registrations[] keeps track of xpc_connect()'s done by the kernel-level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) * users of XPC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct xpc_registration xpc_registrations[XPC_MAX_NCHANNELS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) EXPORT_SYMBOL_GPL(xpc_registrations);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) * Initialize the XPC interface to NULL to indicate that XPC isn't loaded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct xpc_interface xpc_interface = { };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) EXPORT_SYMBOL_GPL(xpc_interface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * XPC calls this when it (the XPC module) has been loaded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) xpc_set_interface(void (*connect) (int),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) void (*disconnect) (int),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) enum xp_retval (*send) (short, int, u32, void *, u16),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) enum xp_retval (*send_notify) (short, int, u32, void *, u16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) xpc_notify_func, void *),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) void (*received) (short, int, void *),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) enum xp_retval (*partid_to_nasids) (short, void *))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) xpc_interface.connect = connect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) xpc_interface.disconnect = disconnect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) xpc_interface.send = send;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) xpc_interface.send_notify = send_notify;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) xpc_interface.received = received;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) xpc_interface.partid_to_nasids = partid_to_nasids;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) EXPORT_SYMBOL_GPL(xpc_set_interface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * XPC calls this when it (the XPC module) is being unloaded.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) xpc_clear_interface(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) memset(&xpc_interface, 0, sizeof(xpc_interface));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) EXPORT_SYMBOL_GPL(xpc_clear_interface);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * Register for automatic establishment of a channel connection whenever
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) * a partition comes up.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) * Arguments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) * ch_number - channel # to register for connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) * func - function to call for asynchronous notification of channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) * state changes (i.e., connection, disconnection, error) and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) * the arrival of incoming messages.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) * key - pointer to optional user-defined value that gets passed back
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) * to the user on any callouts made to func.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) * payload_size - size in bytes of the XPC message's payload area which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * contains a user-defined message. The user should make
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * this large enough to hold their largest message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * nentries - max #of XPC message entries a message queue can contain.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) * The actual number, which is determined when a connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * is established and may be less then requested, will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * passed to the user via the xpConnected callout.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * assigned_limit - max number of kthreads allowed to be processing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * messages (per connection) at any given instant.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * idle_limit - max number of kthreads allowed to be idle at any given
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * instant.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) enum xp_retval
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) u16 nentries, u32 assigned_limit, u32 idle_limit)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct xpc_registration *registration;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) DBUG_ON(payload_size == 0 || nentries == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) DBUG_ON(func == NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) DBUG_ON(assigned_limit == 0 || idle_limit > assigned_limit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) if (XPC_MSG_SIZE(payload_size) > XPC_MSG_MAX_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) return xpPayloadTooBig;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) registration = &xpc_registrations[ch_number];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) if (mutex_lock_interruptible(®istration->mutex) != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) return xpInterrupted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /* if XPC_CHANNEL_REGISTERED(ch_number) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) if (registration->func != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) mutex_unlock(®istration->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) return xpAlreadyRegistered;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* register the channel for connection */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) registration->entry_size = XPC_MSG_SIZE(payload_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) registration->nentries = nentries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) registration->assigned_limit = assigned_limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) registration->idle_limit = idle_limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) registration->key = key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) registration->func = func;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) mutex_unlock(®istration->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) if (xpc_interface.connect)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) xpc_interface.connect(ch_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) return xpSuccess;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) EXPORT_SYMBOL_GPL(xpc_connect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) * Remove the registration for automatic connection of the specified channel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) * when a partition comes up.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) * Before returning this xpc_disconnect() will wait for all connections on the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) * specified channel have been closed/torndown. So the caller can be assured
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) * that they will not be receiving any more callouts from XPC to their
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) * function registered via xpc_connect().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) * Arguments:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * ch_number - channel # to unregister.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) xpc_disconnect(int ch_number)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct xpc_registration *registration;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) DBUG_ON(ch_number < 0 || ch_number >= XPC_MAX_NCHANNELS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) registration = &xpc_registrations[ch_number];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * We've decided not to make this a down_interruptible(), since we
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * figured XPC's users will just turn around and call xpc_disconnect()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) * again anyways, so we might as well wait, if need be.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) mutex_lock(®istration->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) /* if !XPC_CHANNEL_REGISTERED(ch_number) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) if (registration->func == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) mutex_unlock(®istration->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) /* remove the connection registration for the specified channel */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) registration->func = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) registration->key = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) registration->nentries = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) registration->entry_size = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) registration->assigned_limit = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) registration->idle_limit = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) if (xpc_interface.disconnect)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) xpc_interface.disconnect(ch_number);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) mutex_unlock(®istration->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) EXPORT_SYMBOL_GPL(xpc_disconnect);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) static int __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) xp_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) enum xp_retval ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) int ch_number;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) /* initialize the connection registration mutex */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) for (ch_number = 0; ch_number < XPC_MAX_NCHANNELS; ch_number++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) mutex_init(&xpc_registrations[ch_number].mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) if (is_uv_system())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) ret = xp_init_uv();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) if (ret != xpSuccess)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) module_init(xp_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) static void __exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) xp_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) if (is_uv_system())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) xp_exit_uv();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) module_exit(xp_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) MODULE_AUTHOR("Silicon Graphics, Inc.");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) MODULE_DESCRIPTION("Cross Partition (XP) base");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) MODULE_LICENSE("GPL");