aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2018-10-19 16:06:36 -0400
committerHelge Deller <deller@gmx.de>2018-10-19 16:22:07 -0400
commitfe8376dbbd6ac1febb0fd6389e3ec4f349e70c71 (patch)
tree3dcb2f4532311bf1be2411ba659e164129cfe1e7
parent32c1ceeabda3e37dd94129f915823e7cf0441fc9 (diff)
parisc: Add PDC PAT cell_info() and pd_get_pdc_revisions() functions
Add wrappers for the PDC_PAT_CELL_GET_INFO and PDC_PAT_PD_GET_PDC_INTERF_REV PAT PDC subfunctions. Both provide access to the PAT capability bitfield which can guide us if simultaneous PTLBs are allowed on the bus, and if firmware will rendezvous all processors within PDCE_Check in case of an HPMC. Signed-off-by: Helge Deller <deller@gmx.de>
-rw-r--r--arch/parisc/include/asm/pdcpat.h54
-rw-r--r--arch/parisc/kernel/firmware.c57
2 files changed, 98 insertions, 13 deletions
diff --git a/arch/parisc/include/asm/pdcpat.h b/arch/parisc/include/asm/pdcpat.h
index 7bf63fb87455..bce9ee1c1c99 100644
--- a/arch/parisc/include/asm/pdcpat.h
+++ b/arch/parisc/include/asm/pdcpat.h
@@ -173,6 +173,16 @@
173/* PDC PAT PD */ 173/* PDC PAT PD */
174#define PDC_PAT_PD 74L /* Protection Domain Info */ 174#define PDC_PAT_PD 74L /* Protection Domain Info */
175#define PDC_PAT_PD_GET_ADDR_MAP 0L /* Get Address Map */ 175#define PDC_PAT_PD_GET_ADDR_MAP 0L /* Get Address Map */
176#define PDC_PAT_PD_GET_PDC_INTERF_REV 1L /* Get PDC Interface Revisions */
177
178#define PDC_PAT_CAPABILITY_BIT_PDC_SERIALIZE (1UL << 0)
179#define PDC_PAT_CAPABILITY_BIT_PDC_POLLING (1UL << 1)
180#define PDC_PAT_CAPABILITY_BIT_PDC_NBC (1UL << 2) /* non-blocking calls */
181#define PDC_PAT_CAPABILITY_BIT_PDC_UFO (1UL << 3)
182#define PDC_PAT_CAPABILITY_BIT_PDC_IODC_32 (1UL << 4)
183#define PDC_PAT_CAPABILITY_BIT_PDC_IODC_64 (1UL << 5)
184#define PDC_PAT_CAPABILITY_BIT_PDC_HPMC_RENDEZ (1UL << 6)
185#define PDC_PAT_CAPABILITY_BIT_SIMULTANEOUS_PTLB (1UL << 7)
176 186
177/* PDC_PAT_PD_GET_ADDR_MAP entry types */ 187/* PDC_PAT_PD_GET_ADDR_MAP entry types */
178#define PAT_MEMORY_DESCRIPTOR 1 188#define PAT_MEMORY_DESCRIPTOR 1
@@ -305,18 +315,29 @@ struct pdc_pat_pd_addr_map_entry {
305** PDC_PAT_CELL_GET_INFO return block 315** PDC_PAT_CELL_GET_INFO return block
306*/ 316*/
307typedef struct pdc_pat_cell_info_rtn_block { 317typedef struct pdc_pat_cell_info_rtn_block {
308 unsigned long cpu_info;
309 unsigned long cell_info;
310 unsigned long cell_location;
311 unsigned long reo_location;
312 unsigned long mem_size;
313 unsigned long dimm_status;
314 unsigned long pdc_rev; 318 unsigned long pdc_rev;
315 unsigned long fabric_info0; 319 unsigned long capabilities; /* see PDC_PAT_CAPABILITY_BIT_* */
316 unsigned long fabric_info1; 320 unsigned long reserved0[2];
317 unsigned long fabric_info2; 321 unsigned long cell_info; /* 0x20 */
318 unsigned long fabric_info3; 322 unsigned long cell_phys_location;
319 unsigned long reserved[21]; 323 unsigned long cpu_info;
324 unsigned long cpu_speed;
325 unsigned long io_chassis_phys_location;
326 unsigned long cell_io_information;
327 unsigned long reserved1[2];
328 unsigned long io_slot_info_size; /* 0x60 */
329 struct {
330 unsigned long header, info0, info1;
331 unsigned long phys_loc, hw_path;
332 } io_slot[16];
333 unsigned long cell_mem_size; /* 0x2e8 */
334 unsigned long cell_dimm_info_size;
335 unsigned long dimm_info[16];
336 unsigned long fabric_info_size; /* 0x3f8 */
337 struct { /* 0x380 */
338 unsigned long fabric_info_xbc_port;
339 unsigned long rc_attached_to_xbc;
340 } xbc[8*4];
320} pdc_pat_cell_info_rtn_block_t; 341} pdc_pat_cell_info_rtn_block_t;
321 342
322 343
@@ -334,12 +355,19 @@ typedef struct pdc_pat_cell_mod_maddr_block pdc_pat_cell_mod_maddr_block_t;
334 355
335extern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data); 356extern int pdc_pat_chassis_send_log(unsigned long status, unsigned long data);
336extern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info); 357extern int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info);
337extern int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long mod, unsigned long view_type, void *mem_addr); 358extern int pdc_pat_cell_info(struct pdc_pat_cell_info_rtn_block *info,
359 unsigned long *actcnt, unsigned long offset,
360 unsigned long cell_number);
361extern int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc,
362 unsigned long mod, unsigned long view_type, void *mem_addr);
338extern int pdc_pat_cell_num_to_loc(void *, unsigned long); 363extern int pdc_pat_cell_num_to_loc(void *, unsigned long);
339 364
340extern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, unsigned long hpa); 365extern int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, unsigned long hpa);
341 366
342extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr, unsigned long count, unsigned long offset); 367extern int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
368 unsigned long count, unsigned long offset);
369extern int pdc_pat_pd_get_pdc_revisions(unsigned long *legacy_rev,
370 unsigned long *pat_rev, unsigned long *pdc_cap);
343 371
344extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val); 372extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val);
345extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val); 373extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val);
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 6d471c00c71a..e6f3b49f2fd7 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -1326,6 +1326,36 @@ int pdc_pat_cell_module(unsigned long *actcnt, unsigned long ploc, unsigned long
1326} 1326}
1327 1327
1328/** 1328/**
1329 * pdc_pat_cell_info - Retrieve the cell's information.
1330 * @info: The pointer to a struct pdc_pat_cell_info_rtn_block.
1331 * @actcnt: The number of bytes which should be written to info.
1332 * @offset: offset of the structure.
1333 * @cell_number: The cell number which should be asked, or -1 for current cell.
1334 *
1335 * This PDC call returns information about the given cell (or all cells).
1336 */
1337int pdc_pat_cell_info(struct pdc_pat_cell_info_rtn_block *info,
1338 unsigned long *actcnt, unsigned long offset,
1339 unsigned long cell_number)
1340{
1341 int retval;
1342 unsigned long flags;
1343 struct pdc_pat_cell_info_rtn_block result;
1344
1345 spin_lock_irqsave(&pdc_lock, flags);
1346 retval = mem_pdc_call(PDC_PAT_CELL, PDC_PAT_CELL_GET_INFO,
1347 __pa(pdc_result), __pa(&result), *actcnt,
1348 offset, cell_number);
1349 if (!retval) {
1350 *actcnt = pdc_result[0];
1351 memcpy(info, &result, *actcnt);
1352 }
1353 spin_unlock_irqrestore(&pdc_lock, flags);
1354
1355 return retval;
1356}
1357
1358/**
1329 * pdc_pat_cpu_get_number - Retrieve the cpu number. 1359 * pdc_pat_cpu_get_number - Retrieve the cpu number.
1330 * @cpu_info: The return buffer. 1360 * @cpu_info: The return buffer.
1331 * @hpa: The Hard Physical Address of the CPU. 1361 * @hpa: The Hard Physical Address of the CPU.
@@ -1413,6 +1443,33 @@ int pdc_pat_pd_get_addr_map(unsigned long *actual_len, void *mem_addr,
1413} 1443}
1414 1444
1415/** 1445/**
1446 * pdc_pat_pd_get_PDC_interface_revisions - Retrieve PDC interface revisions.
1447 * @legacy_rev: The legacy revision.
1448 * @pat_rev: The PAT revision.
1449 * @pdc_cap: The PDC capabilities.
1450 *
1451 */
1452int pdc_pat_pd_get_pdc_revisions(unsigned long *legacy_rev,
1453 unsigned long *pat_rev, unsigned long *pdc_cap)
1454{
1455 int retval;
1456 unsigned long flags;
1457
1458 spin_lock_irqsave(&pdc_lock, flags);
1459 retval = mem_pdc_call(PDC_PAT_PD, PDC_PAT_PD_GET_PDC_INTERF_REV,
1460 __pa(pdc_result));
1461 if (retval == PDC_OK) {
1462 *legacy_rev = pdc_result[0];
1463 *pat_rev = pdc_result[1];
1464 *pdc_cap = pdc_result[2];
1465 }
1466 spin_unlock_irqrestore(&pdc_lock, flags);
1467
1468 return retval;
1469}
1470
1471
1472/**
1416 * pdc_pat_io_pci_cfg_read - Read PCI configuration space. 1473 * pdc_pat_io_pci_cfg_read - Read PCI configuration space.
1417 * @pci_addr: PCI configuration space address for which the read request is being made. 1474 * @pci_addr: PCI configuration space address for which the read request is being made.
1418 * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4. 1475 * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4.