aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorJan Glauber <jang@linux.vnet.ibm.com>2012-11-29 06:55:21 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2012-11-30 09:40:47 -0500
commita755a45dd928e05a4fb980d31d4a0dbc49adc562 (patch)
treead7e88579a6a52c06cada11ce59529e3c8888d06 /arch/s390
parentcd24834130ac655d15accee6757e0eaeab4ad4ef (diff)
s390/pci: CLP interface
CLP instructions are used to query the firmware about detected PCI functions, the attributes of those functions and to enable or disable a PCI function. The CLP interface is the equivalent to a PCI bus scan. Signed-off-by: Jan Glauber <jang@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/include/asm/clp.h28
-rw-r--r--arch/s390/include/asm/pci.h7
-rw-r--r--arch/s390/include/asm/pci_clp.h182
-rw-r--r--arch/s390/pci/Makefile2
-rw-r--r--arch/s390/pci/pci.c28
-rw-r--r--arch/s390/pci/pci_clp.c317
6 files changed, 563 insertions, 1 deletions
diff --git a/arch/s390/include/asm/clp.h b/arch/s390/include/asm/clp.h
new file mode 100644
index 000000000000..6c3aecc245ff
--- /dev/null
+++ b/arch/s390/include/asm/clp.h
@@ -0,0 +1,28 @@
1#ifndef _ASM_S390_CLP_H
2#define _ASM_S390_CLP_H
3
4/* CLP common request & response block size */
5#define CLP_BLK_SIZE (PAGE_SIZE * 2)
6
7struct clp_req_hdr {
8 u16 len;
9 u16 cmd;
10} __packed;
11
12struct clp_rsp_hdr {
13 u16 len;
14 u16 rsp;
15} __packed;
16
17/* CLP Response Codes */
18#define CLP_RC_OK 0x0010 /* Command request successfully */
19#define CLP_RC_CMD 0x0020 /* Command code not recognized */
20#define CLP_RC_PERM 0x0030 /* Command not authorized */
21#define CLP_RC_FMT 0x0040 /* Invalid command request format */
22#define CLP_RC_LEN 0x0050 /* Invalid command request length */
23#define CLP_RC_8K 0x0060 /* Command requires 8K LPCB */
24#define CLP_RC_RESNOT0 0x0070 /* Reserved field not zero */
25#define CLP_RC_NODATA 0x0080 /* No data available */
26#define CLP_RC_FC_UNKNOWN 0x0100 /* Function code not recognized */
27
28#endif
diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index ff7b3596f47c..6f98a54950ea 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -8,6 +8,7 @@
8 8
9#include <asm-generic/pci.h> 9#include <asm-generic/pci.h>
10#include <asm-generic/pci-dma-compat.h> 10#include <asm-generic/pci-dma-compat.h>
11#include <asm/pci_clp.h>
11 12
12#define PCIBIOS_MIN_IO 0x1000 13#define PCIBIOS_MIN_IO 0x1000
13#define PCIBIOS_MIN_MEM 0x10000000 14#define PCIBIOS_MIN_MEM 0x10000000
@@ -76,6 +77,12 @@ void zpci_stop_device(struct zpci_dev *);
76void zpci_free_device(struct zpci_dev *); 77void zpci_free_device(struct zpci_dev *);
77int zpci_scan_device(struct zpci_dev *); 78int zpci_scan_device(struct zpci_dev *);
78 79
80/* CLP */
81int clp_find_pci_devices(void);
82int clp_add_pci_device(u32, u32, int);
83int clp_enable_fh(struct zpci_dev *, u8);
84int clp_disable_fh(struct zpci_dev *);
85
79/* Helpers */ 86/* Helpers */
80struct zpci_dev *get_zdev(struct pci_dev *); 87struct zpci_dev *get_zdev(struct pci_dev *);
81struct zpci_dev *get_zdev_by_fid(u32); 88struct zpci_dev *get_zdev_by_fid(u32);
diff --git a/arch/s390/include/asm/pci_clp.h b/arch/s390/include/asm/pci_clp.h
new file mode 100644
index 000000000000..d31d739f8689
--- /dev/null
+++ b/arch/s390/include/asm/pci_clp.h
@@ -0,0 +1,182 @@
1#ifndef _ASM_S390_PCI_CLP_H
2#define _ASM_S390_PCI_CLP_H
3
4#include <asm/clp.h>
5
6/*
7 * Call Logical Processor - Command Codes
8 */
9#define CLP_LIST_PCI 0x0002
10#define CLP_QUERY_PCI_FN 0x0003
11#define CLP_QUERY_PCI_FNGRP 0x0004
12#define CLP_SET_PCI_FN 0x0005
13
14/* PCI function handle list entry */
15struct clp_fh_list_entry {
16 u16 device_id;
17 u16 vendor_id;
18 u32 config_state : 1;
19 u32 : 31;
20 u32 fid; /* PCI function id */
21 u32 fh; /* PCI function handle */
22} __packed;
23
24#define CLP_RC_SETPCIFN_FH 0x0101 /* Invalid PCI fn handle */
25#define CLP_RC_SETPCIFN_FHOP 0x0102 /* Fn handle not valid for op */
26#define CLP_RC_SETPCIFN_DMAAS 0x0103 /* Invalid DMA addr space */
27#define CLP_RC_SETPCIFN_RES 0x0104 /* Insufficient resources */
28#define CLP_RC_SETPCIFN_ALRDY 0x0105 /* Fn already in requested state */
29#define CLP_RC_SETPCIFN_ERR 0x0106 /* Fn in permanent error state */
30#define CLP_RC_SETPCIFN_RECPND 0x0107 /* Error recovery pending */
31#define CLP_RC_SETPCIFN_BUSY 0x0108 /* Fn busy */
32#define CLP_RC_LISTPCI_BADRT 0x010a /* Resume token not recognized */
33#define CLP_RC_QUERYPCIFG_PFGID 0x010b /* Unrecognized PFGID */
34
35/* request or response block header length */
36#define LIST_PCI_HDR_LEN 32
37
38/* Number of function handles fitting in response block */
39#define CLP_FH_LIST_NR_ENTRIES \
40 ((CLP_BLK_SIZE - 2 * LIST_PCI_HDR_LEN) \
41 / sizeof(struct clp_fh_list_entry))
42
43#define CLP_SET_ENABLE_PCI_FN 0 /* Yes, 0 enables it */
44#define CLP_SET_DISABLE_PCI_FN 1 /* Yes, 1 disables it */
45
46#define CLP_UTIL_STR_LEN 64
47
48/* List PCI functions request */
49struct clp_req_list_pci {
50 struct clp_req_hdr hdr;
51 u32 fmt : 4; /* cmd request block format */
52 u32 : 28;
53 u64 reserved1;
54 u64 resume_token;
55 u64 reserved2;
56} __packed;
57
58/* List PCI functions response */
59struct clp_rsp_list_pci {
60 struct clp_rsp_hdr hdr;
61 u32 fmt : 4; /* cmd request block format */
62 u32 : 28;
63 u64 reserved1;
64 u64 resume_token;
65 u32 reserved2;
66 u16 max_fn;
67 u8 reserved3;
68 u8 entry_size;
69 struct clp_fh_list_entry fh_list[CLP_FH_LIST_NR_ENTRIES];
70} __packed;
71
72/* Query PCI function request */
73struct clp_req_query_pci {
74 struct clp_req_hdr hdr;
75 u32 fmt : 4; /* cmd request block format */
76 u32 : 28;
77 u64 reserved1;
78 u32 fh; /* function handle */
79 u32 reserved2;
80 u64 reserved3;
81} __packed;
82
83/* Query PCI function response */
84struct clp_rsp_query_pci {
85 struct clp_rsp_hdr hdr;
86 u32 fmt : 4; /* cmd request block format */
87 u32 : 28;
88 u64 reserved1;
89 u16 vfn; /* virtual fn number */
90 u16 : 7;
91 u16 util_str_avail : 1; /* utility string available? */
92 u16 pfgid : 8; /* pci function group id */
93 u32 fid; /* pci function id */
94 u8 bar_size[PCI_BAR_COUNT];
95 u16 pchid;
96 u32 bar[PCI_BAR_COUNT];
97 u64 reserved2;
98 u64 sdma; /* start dma as */
99 u64 edma; /* end dma as */
100 u64 reserved3[6];
101 u8 util_str[CLP_UTIL_STR_LEN]; /* utility string */
102} __packed;
103
104/* Query PCI function group request */
105struct clp_req_query_pci_grp {
106 struct clp_req_hdr hdr;
107 u32 fmt : 4; /* cmd request block format */
108 u32 : 28;
109 u64 reserved1;
110 u32 : 24;
111 u32 pfgid : 8; /* function group id */
112 u32 reserved2;
113 u64 reserved3;
114} __packed;
115
116/* Query PCI function group response */
117struct clp_rsp_query_pci_grp {
118 struct clp_rsp_hdr hdr;
119 u32 fmt : 4; /* cmd request block format */
120 u32 : 28;
121 u64 reserved1;
122 u16 : 4;
123 u16 noi : 12; /* number of interrupts */
124 u8 version;
125 u8 : 6;
126 u8 frame : 1;
127 u8 refresh : 1; /* TLB refresh mode */
128 u16 reserved2;
129 u16 mui;
130 u64 reserved3;
131 u64 dasm; /* dma address space mask */
132 u64 msia; /* MSI address */
133 u64 reserved4;
134 u64 reserved5;
135} __packed;
136
137/* Set PCI function request */
138struct clp_req_set_pci {
139 struct clp_req_hdr hdr;
140 u32 fmt : 4; /* cmd request block format */
141 u32 : 28;
142 u64 reserved1;
143 u32 fh; /* function handle */
144 u16 reserved2;
145 u8 oc; /* operation controls */
146 u8 ndas; /* number of dma spaces */
147 u64 reserved3;
148} __packed;
149
150/* Set PCI function response */
151struct clp_rsp_set_pci {
152 struct clp_rsp_hdr hdr;
153 u32 fmt : 4; /* cmd request block format */
154 u32 : 28;
155 u64 reserved1;
156 u32 fh; /* function handle */
157 u32 reserved3;
158 u64 reserved4;
159} __packed;
160
161/* Combined request/response block structures used by clp insn */
162struct clp_req_rsp_list_pci {
163 struct clp_req_list_pci request;
164 struct clp_rsp_list_pci response;
165} __packed;
166
167struct clp_req_rsp_set_pci {
168 struct clp_req_set_pci request;
169 struct clp_rsp_set_pci response;
170} __packed;
171
172struct clp_req_rsp_query_pci {
173 struct clp_req_query_pci request;
174 struct clp_rsp_query_pci response;
175} __packed;
176
177struct clp_req_rsp_query_pci_grp {
178 struct clp_req_query_pci_grp request;
179 struct clp_rsp_query_pci_grp response;
180} __packed;
181
182#endif
diff --git a/arch/s390/pci/Makefile b/arch/s390/pci/Makefile
index 78a1344ff7b1..1afd68c4c984 100644
--- a/arch/s390/pci/Makefile
+++ b/arch/s390/pci/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the s390 PCI subsystem. 2# Makefile for the s390 PCI subsystem.
3# 3#
4 4
5obj-$(CONFIG_PCI) += pci.o 5obj-$(CONFIG_PCI) += pci.o pci_clp.o
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c
index 0b80ac7e158f..70f6c56c8d0f 100644
--- a/arch/s390/pci/pci.c
+++ b/arch/s390/pci/pci.c
@@ -29,6 +29,7 @@
29 29
30#include <asm/facility.h> 30#include <asm/facility.h>
31#include <asm/pci_insn.h> 31#include <asm/pci_insn.h>
32#include <asm/pci_clp.h>
32 33
33#define DEBUG /* enable pr_debug */ 34#define DEBUG /* enable pr_debug */
34 35
@@ -436,6 +437,20 @@ static void zpci_free_domain(struct zpci_dev *zdev)
436 spin_unlock(&zpci_domain_lock); 437 spin_unlock(&zpci_domain_lock);
437} 438}
438 439
440int zpci_enable_device(struct zpci_dev *zdev)
441{
442 int rc;
443
444 rc = clp_enable_fh(zdev, ZPCI_NR_DMA_SPACES);
445 if (rc)
446 goto out;
447 pr_info("Enabled fh: 0x%x fid: 0x%x\n", zdev->fh, zdev->fid);
448 return 0;
449out:
450 return rc;
451}
452EXPORT_SYMBOL_GPL(zpci_enable_device);
453
439int zpci_create_device(struct zpci_dev *zdev) 454int zpci_create_device(struct zpci_dev *zdev)
440{ 455{
441 int rc; 456 int rc;
@@ -455,8 +470,15 @@ int zpci_create_device(struct zpci_dev *zdev)
455 if (zdev->state == ZPCI_FN_STATE_STANDBY) 470 if (zdev->state == ZPCI_FN_STATE_STANDBY)
456 return 0; 471 return 0;
457 472
473 rc = zpci_enable_device(zdev);
474 if (rc)
475 goto out_start;
458 return 0; 476 return 0;
459 477
478out_start:
479 mutex_lock(&zpci_list_lock);
480 list_del(&zdev->entry);
481 mutex_unlock(&zpci_list_lock);
460out_bus: 482out_bus:
461 zpci_free_domain(zdev); 483 zpci_free_domain(zdev);
462out: 484out:
@@ -489,6 +511,7 @@ int zpci_scan_device(struct zpci_dev *zdev)
489 return 0; 511 return 0;
490 512
491out: 513out:
514 clp_disable_fh(zdev);
492 return -EIO; 515 return -EIO;
493} 516}
494EXPORT_SYMBOL_GPL(zpci_scan_device); 517EXPORT_SYMBOL_GPL(zpci_scan_device);
@@ -547,9 +570,14 @@ static int __init pci_base_init(void)
547 if (rc) 570 if (rc)
548 goto out_mem; 571 goto out_mem;
549 572
573 rc = clp_find_pci_devices();
574 if (rc)
575 goto out_find;
576
550 zpci_scan_devices(); 577 zpci_scan_devices();
551 return 0; 578 return 0;
552 579
580out_find:
553 zpci_mem_exit(); 581 zpci_mem_exit();
554out_mem: 582out_mem:
555 return rc; 583 return rc;
diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c
new file mode 100644
index 000000000000..291da1a96560
--- /dev/null
+++ b/arch/s390/pci/pci_clp.c
@@ -0,0 +1,317 @@
1/*
2 * Copyright IBM Corp. 2012
3 *
4 * Author(s):
5 * Jan Glauber <jang@linux.vnet.ibm.com>
6 */
7
8#define COMPONENT "zPCI"
9#define pr_fmt(fmt) COMPONENT ": " fmt
10
11#include <linux/kernel.h>
12#include <linux/slab.h>
13#include <linux/err.h>
14#include <linux/delay.h>
15#include <linux/pci.h>
16#include <asm/pci_clp.h>
17
18/*
19 * Call Logical Processor
20 * Retry logic is handled by the caller.
21 */
22static inline u8 clp_instr(void *req)
23{
24 u64 ilpm;
25 u8 cc;
26
27 asm volatile (
28 " .insn rrf,0xb9a00000,%[ilpm],%[req],0x0,0x2\n"
29 " ipm %[cc]\n"
30 " srl %[cc],28\n"
31 : [cc] "=d" (cc), [ilpm] "=d" (ilpm)
32 : [req] "a" (req)
33 : "cc", "memory");
34 return cc;
35}
36
37static void *clp_alloc_block(void)
38{
39 struct page *page = alloc_pages(GFP_KERNEL, get_order(CLP_BLK_SIZE));
40 return (page) ? page_address(page) : NULL;
41}
42
43static void clp_free_block(void *ptr)
44{
45 free_pages((unsigned long) ptr, get_order(CLP_BLK_SIZE));
46}
47
48static void clp_store_query_pci_fngrp(struct zpci_dev *zdev,
49 struct clp_rsp_query_pci_grp *response)
50{
51 switch (response->version) {
52 case 1:
53 zdev->max_bus_speed = PCIE_SPEED_5_0GT;
54 break;
55 default:
56 zdev->max_bus_speed = PCI_SPEED_UNKNOWN;
57 break;
58 }
59}
60
61static int clp_query_pci_fngrp(struct zpci_dev *zdev, u8 pfgid)
62{
63 struct clp_req_rsp_query_pci_grp *rrb;
64 int rc;
65
66 rrb = clp_alloc_block();
67 if (!rrb)
68 return -ENOMEM;
69
70 memset(rrb, 0, sizeof(*rrb));
71 rrb->request.hdr.len = sizeof(rrb->request);
72 rrb->request.hdr.cmd = CLP_QUERY_PCI_FNGRP;
73 rrb->response.hdr.len = sizeof(rrb->response);
74 rrb->request.pfgid = pfgid;
75
76 rc = clp_instr(rrb);
77 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
78 clp_store_query_pci_fngrp(zdev, &rrb->response);
79 else {
80 pr_err("Query PCI FNGRP failed with response: %x cc: %d\n",
81 rrb->response.hdr.rsp, rc);
82 rc = -EIO;
83 }
84 clp_free_block(rrb);
85 return rc;
86}
87
88static int clp_store_query_pci_fn(struct zpci_dev *zdev,
89 struct clp_rsp_query_pci *response)
90{
91 int i;
92
93 for (i = 0; i < PCI_BAR_COUNT; i++) {
94 zdev->bars[i].val = le32_to_cpu(response->bar[i]);
95 zdev->bars[i].size = response->bar_size[i];
96 }
97 zdev->pchid = response->pchid;
98 zdev->pfgid = response->pfgid;
99 return 0;
100}
101
102static int clp_query_pci_fn(struct zpci_dev *zdev, u32 fh)
103{
104 struct clp_req_rsp_query_pci *rrb;
105 int rc;
106
107 rrb = clp_alloc_block();
108 if (!rrb)
109 return -ENOMEM;
110
111 memset(rrb, 0, sizeof(*rrb));
112 rrb->request.hdr.len = sizeof(rrb->request);
113 rrb->request.hdr.cmd = CLP_QUERY_PCI_FN;
114 rrb->response.hdr.len = sizeof(rrb->response);
115 rrb->request.fh = fh;
116
117 rc = clp_instr(rrb);
118 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK) {
119 rc = clp_store_query_pci_fn(zdev, &rrb->response);
120 if (rc)
121 goto out;
122 if (rrb->response.pfgid)
123 rc = clp_query_pci_fngrp(zdev, rrb->response.pfgid);
124 } else {
125 pr_err("Query PCI failed with response: %x cc: %d\n",
126 rrb->response.hdr.rsp, rc);
127 rc = -EIO;
128 }
129out:
130 clp_free_block(rrb);
131 return rc;
132}
133
134int clp_add_pci_device(u32 fid, u32 fh, int configured)
135{
136 struct zpci_dev *zdev;
137 int rc;
138
139 zdev = zpci_alloc_device();
140 if (IS_ERR(zdev))
141 return PTR_ERR(zdev);
142
143 zdev->fh = fh;
144 zdev->fid = fid;
145
146 /* Query function properties and update zdev */
147 rc = clp_query_pci_fn(zdev, fh);
148 if (rc)
149 goto error;
150
151 if (configured)
152 zdev->state = ZPCI_FN_STATE_CONFIGURED;
153 else
154 zdev->state = ZPCI_FN_STATE_STANDBY;
155
156 rc = zpci_create_device(zdev);
157 if (rc)
158 goto error;
159 return 0;
160
161error:
162 zpci_free_device(zdev);
163 return rc;
164}
165
166/*
167 * Enable/Disable a given PCI function defined by its function handle.
168 */
169static int clp_set_pci_fn(u32 *fh, u8 nr_dma_as, u8 command)
170{
171 struct clp_req_rsp_set_pci *rrb;
172 int rc, retries = 1000;
173
174 rrb = clp_alloc_block();
175 if (!rrb)
176 return -ENOMEM;
177
178 do {
179 memset(rrb, 0, sizeof(*rrb));
180 rrb->request.hdr.len = sizeof(rrb->request);
181 rrb->request.hdr.cmd = CLP_SET_PCI_FN;
182 rrb->response.hdr.len = sizeof(rrb->response);
183 rrb->request.fh = *fh;
184 rrb->request.oc = command;
185 rrb->request.ndas = nr_dma_as;
186
187 rc = clp_instr(rrb);
188 if (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY) {
189 retries--;
190 if (retries < 0)
191 break;
192 msleep(1);
193 }
194 } while (rrb->response.hdr.rsp == CLP_RC_SETPCIFN_BUSY);
195
196 if (!rc && rrb->response.hdr.rsp == CLP_RC_OK)
197 *fh = rrb->response.fh;
198 else {
199 pr_err("Set PCI FN failed with response: %x cc: %d\n",
200 rrb->response.hdr.rsp, rc);
201 rc = -EIO;
202 }
203 clp_free_block(rrb);
204 return rc;
205}
206
207int clp_enable_fh(struct zpci_dev *zdev, u8 nr_dma_as)
208{
209 u32 fh = zdev->fh;
210 int rc;
211
212 rc = clp_set_pci_fn(&fh, nr_dma_as, CLP_SET_ENABLE_PCI_FN);
213 if (!rc)
214 /* Success -> store enabled handle in zdev */
215 zdev->fh = fh;
216 return rc;
217}
218
219int clp_disable_fh(struct zpci_dev *zdev)
220{
221 u32 fh = zdev->fh;
222 int rc;
223
224 if (!zdev_enabled(zdev))
225 return 0;
226
227 dev_info(&zdev->pdev->dev, "disabling fn handle: 0x%x\n", fh);
228 rc = clp_set_pci_fn(&fh, 0, CLP_SET_DISABLE_PCI_FN);
229 if (!rc)
230 /* Success -> store disabled handle in zdev */
231 zdev->fh = fh;
232 else
233 dev_err(&zdev->pdev->dev,
234 "Failed to disable fn handle: 0x%x\n", fh);
235 return rc;
236}
237
238static void clp_check_pcifn_entry(struct clp_fh_list_entry *entry)
239{
240 int present, rc;
241
242 if (!entry->vendor_id)
243 return;
244
245 /* TODO: be a little bit more scalable */
246 present = zpci_fid_present(entry->fid);
247
248 if (present)
249 pr_debug("%s: device %x already present\n", __func__, entry->fid);
250
251 /* skip already used functions */
252 if (present && entry->config_state)
253 return;
254
255 /* aev 306: function moved to stand-by state */
256 if (present && !entry->config_state) {
257 /*
258 * The handle is already disabled, that means no iota/irq freeing via
259 * the firmware interfaces anymore. Need to free resources manually
260 * (DMA memory, debug, sysfs)...
261 */
262 zpci_stop_device(get_zdev_by_fid(entry->fid));
263 return;
264 }
265
266 rc = clp_add_pci_device(entry->fid, entry->fh, entry->config_state);
267 if (rc)
268 pr_err("Failed to add fid: 0x%x\n", entry->fid);
269}
270
271int clp_find_pci_devices(void)
272{
273 struct clp_req_rsp_list_pci *rrb;
274 u64 resume_token = 0;
275 int entries, i, rc;
276
277 rrb = clp_alloc_block();
278 if (!rrb)
279 return -ENOMEM;
280
281 do {
282 memset(rrb, 0, sizeof(*rrb));
283 rrb->request.hdr.len = sizeof(rrb->request);
284 rrb->request.hdr.cmd = CLP_LIST_PCI;
285 /* store as many entries as possible */
286 rrb->response.hdr.len = CLP_BLK_SIZE - LIST_PCI_HDR_LEN;
287 rrb->request.resume_token = resume_token;
288
289 /* Get PCI function handle list */
290 rc = clp_instr(rrb);
291 if (rc || rrb->response.hdr.rsp != CLP_RC_OK) {
292 pr_err("List PCI failed with response: 0x%x cc: %d\n",
293 rrb->response.hdr.rsp, rc);
294 rc = -EIO;
295 goto out;
296 }
297
298 WARN_ON_ONCE(rrb->response.entry_size !=
299 sizeof(struct clp_fh_list_entry));
300
301 entries = (rrb->response.hdr.len - LIST_PCI_HDR_LEN) /
302 rrb->response.entry_size;
303 pr_info("Detected number of PCI functions: %u\n", entries);
304
305 /* Store the returned resume token as input for the next call */
306 resume_token = rrb->response.resume_token;
307
308 for (i = 0; i < entries; i++)
309 clp_check_pcifn_entry(&rrb->response.fh_list[i]);
310 } while (resume_token);
311
312 pr_debug("Maximum number of supported PCI functions: %u\n",
313 rrb->response.max_fn);
314out:
315 clp_free_block(rrb);
316 return rc;
317}