aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi/rpa_vscsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ibmvscsi/rpa_vscsi.c')
-rw-r--r--drivers/scsi/ibmvscsi/rpa_vscsi.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/scsi/ibmvscsi/rpa_vscsi.c b/drivers/scsi/ibmvscsi/rpa_vscsi.c
index 50cb909f314f..035f615817d7 100644
--- a/drivers/scsi/ibmvscsi/rpa_vscsi.c
+++ b/drivers/scsi/ibmvscsi/rpa_vscsi.c
@@ -33,6 +33,10 @@
33#include <linux/dma-mapping.h> 33#include <linux/dma-mapping.h>
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include "ibmvscsi.h" 35#include "ibmvscsi.h"
36#include "srp.h"
37
38static char partition_name[97] = "UNKNOWN";
39static unsigned int partition_number = -1;
36 40
37/* ------------------------------------------------------------ 41/* ------------------------------------------------------------
38 * Routines for managing the command/response queue 42 * Routines for managing the command/response queue
@@ -148,6 +152,48 @@ static void ibmvscsi_task(void *data)
148 } 152 }
149} 153}
150 154
155static void gather_partition_info(void)
156{
157 struct device_node *rootdn;
158
159 char *ppartition_name;
160 unsigned int *p_number_ptr;
161
162 /* Retrieve information about this partition */
163 rootdn = find_path_device("/");
164 if (!rootdn) {
165 return;
166 }
167
168 ppartition_name =
169 get_property(rootdn, "ibm,partition-name", NULL);
170 if (ppartition_name)
171 strncpy(partition_name, ppartition_name,
172 sizeof(partition_name));
173 p_number_ptr =
174 (unsigned int *)get_property(rootdn, "ibm,partition-no",
175 NULL);
176 if (p_number_ptr)
177 partition_number = *p_number_ptr;
178}
179
180static void set_adapter_info(struct ibmvscsi_host_data *hostdata)
181{
182 memset(&hostdata->madapter_info, 0x00,
183 sizeof(hostdata->madapter_info));
184
185 printk(KERN_INFO "rpa_vscsi: SPR_VERSION: %s\n", SRP_VERSION);
186 strcpy(hostdata->madapter_info.srp_version, SRP_VERSION);
187
188 strncpy(hostdata->madapter_info.partition_name, partition_name,
189 sizeof(hostdata->madapter_info.partition_name));
190
191 hostdata->madapter_info.partition_number = partition_number;
192
193 hostdata->madapter_info.mad_version = 1;
194 hostdata->madapter_info.os_type = 2;
195}
196
151/** 197/**
152 * initialize_crq_queue: - Initializes and registers CRQ with hypervisor 198 * initialize_crq_queue: - Initializes and registers CRQ with hypervisor
153 * @queue: crq_queue to initialize and register 199 * @queue: crq_queue to initialize and register
@@ -177,6 +223,9 @@ int ibmvscsi_init_crq_queue(struct crq_queue *queue,
177 if (dma_mapping_error(queue->msg_token)) 223 if (dma_mapping_error(queue->msg_token))
178 goto map_failed; 224 goto map_failed;
179 225
226 gather_partition_info();
227 set_adapter_info(hostdata);
228
180 rc = plpar_hcall_norets(H_REG_CRQ, 229 rc = plpar_hcall_norets(H_REG_CRQ,
181 vdev->unit_address, 230 vdev->unit_address,
182 queue->msg_token, PAGE_SIZE); 231 queue->msg_token, PAGE_SIZE);
@@ -246,6 +295,8 @@ void ibmvscsi_reset_crq_queue(struct crq_queue *queue,
246 memset(queue->msgs, 0x00, PAGE_SIZE); 295 memset(queue->msgs, 0x00, PAGE_SIZE);
247 queue->cur = 0; 296 queue->cur = 0;
248 297
298 set_adapter_info(hostdata);
299
249 /* And re-open it again */ 300 /* And re-open it again */
250 rc = plpar_hcall_norets(H_REG_CRQ, 301 rc = plpar_hcall_norets(H_REG_CRQ,
251 vdev->unit_address, 302 vdev->unit_address,