Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

parisc: Add PDC PAT call to get free running 64-bit counter

PDC PAT defines this optional function. Testing on my C8000 workstation
and a rp3440 server did not indicate that they provide such counter.
Nevertheless, add the function since we should try to use such a
counter if it's available. In Qemu it should be simple to add it.

Signed-off-by: Helge Deller <deller@gmx.de>

+31 -3
+5 -2
arch/parisc/include/asm/pdcpat.h
··· 179 179 #define PDC_PAT_PD 74L /* Protection Domain Info */ 180 180 #define PDC_PAT_PD_GET_ADDR_MAP 0L /* Get Address Map */ 181 181 #define PDC_PAT_PD_GET_PDC_INTERF_REV 1L /* Get PDC Interface Revisions */ 182 + #define PDC_PAT_PD_GET_PLATFORM_COUNTER 10L /* Get 64-bit free running counter */ 182 183 183 184 #define PDC_PAT_CAPABILITY_BIT_PDC_SERIALIZE (1UL << 0) 184 185 #define PDC_PAT_CAPABILITY_BIT_PDC_POLLING (1UL << 1) ··· 374 373 unsigned long count, unsigned long offset); 375 374 extern int pdc_pat_pd_get_pdc_revisions(unsigned long *legacy_rev, 376 375 unsigned long *pat_rev, unsigned long *pdc_cap); 376 + extern int pdc_pat_pd_get_platform_counter(uint64_t **addr, 377 + unsigned long *freq, unsigned long *uniq); 377 378 378 - extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val); 379 - extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val); 379 + extern int pdc_pat_io_pci_cfg_read(unsigned long pci_addr, int pci_size, u32 *val); 380 + extern int pdc_pat_io_pci_cfg_write(unsigned long pci_addr, int pci_size, u32 val); 380 381 381 382 extern int pdc_pat_mem_pdt_info(struct pdc_pat_mem_retinfo *rinfo); 382 383 extern int pdc_pat_mem_pdt_cell_info(struct pdc_pat_mem_cell_pdt_retinfo *rinfo,
+26 -1
arch/parisc/kernel/firmware.c
··· 1643 1643 return retval; 1644 1644 } 1645 1645 1646 + /** 1647 + * pdc_pat_pd_get_platform_counter - Retrieve address of free-running 64-bit counter. 1648 + * @addr: The address of the 64-bit counter. 1649 + * @freq: The frequency of the counter, or -1 if unknown. 1650 + * @unique: Although monotonic growing, may it return the same number twice? 1651 + * 1652 + */ 1653 + int pdc_pat_pd_get_platform_counter(uint64_t **addr, 1654 + unsigned long *freq, unsigned long *unique) 1655 + { 1656 + int retval; 1657 + unsigned long flags; 1658 + 1659 + spin_lock_irqsave(&pdc_lock, flags); 1660 + retval = mem_pdc_call(PDC_PAT_PD, PDC_PAT_PD_GET_PLATFORM_COUNTER, 1661 + __pa(pdc_result)); 1662 + if (retval == PDC_OK) { 1663 + *addr = (uint64_t *)pdc_result[0]; 1664 + *freq = pdc_result[1]; 1665 + *unique = pdc_result[2]; 1666 + } 1667 + spin_unlock_irqrestore(&pdc_lock, flags); 1668 + 1669 + return retval; 1670 + } 1646 1671 1647 1672 /** 1648 1673 * pdc_pat_io_pci_cfg_read - Read PCI configuration space. 1649 1674 * @pci_addr: PCI configuration space address for which the read request is being made. 1650 - * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4. 1675 + * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4. 1651 1676 * @mem_addr: Pointer to return memory buffer. 1652 1677 * 1653 1678 */