// SPDX-License-Identifier: GPL-2.0-or-later /* * arch/parisc/kernel/firmware.c - safe PDC access routines * * PDC == Processor Dependent Code * * See PDC documentation at * https://parisc.wiki.kernel.org/index.php/Technical_Documentation * for documentation describing the entry points and calling * conventions defined below. * * Copyright 1999 SuSE GmbH Nuernberg (Philipp Rumpf, prumpf@tux.org) * Copyright 1999 The Puffin Group, (Alex deVries, David Kennedy) * Copyright 2003 Grant Grundler <grundler parisc-linux org> * Copyright 2003,2004 Ryan Bradetich <rbrad@parisc-linux.org> * Copyright 2004,2006 Thibaut VARENE <varenet@parisc-linux.org>
*/
/* I think it would be in everyone's best interest to follow this * guidelines when writing PDC wrappers: * * - the name of the pdc wrapper should match one of the macros * used for the first two arguments * - don't use caps for random parts of the name * - use the static PDC result buffers and "copyout" to structs * supplied by the caller to encapsulate alignment restrictions * - hold pdc_lock while in PDC or using static result buffers * - use __pa() to convert virtual (kernel) pointers to physical * ones. * - the name of the struct used for pdc return values should equal * one of the macros used for the first two arguments to the * corresponding PDC call * - keep the order of arguments * - don't be smart (setting trailing NUL bytes for strings, return * something useful even if the call failed) unless you are sure * it's not going to affect functionality or performance * * Example: * int pdc_cache_info(struct pdc_cache_info *cache_info ) * { * int retval; * * spin_lock_irq(&pdc_lock); * retval = mem_pdc_call(PDC_CACHE,PDC_CACHE_INFO,__pa(cache_info),0); * convert_to_wide(pdc_result); * memcpy(cache_info, pdc_result, sizeof(*cache_info)); * spin_unlock_irq(&pdc_lock); * * return retval; * } * prumpf 991016
*/
/* Firmware needs to be initially set to narrow to determine the
* actual firmware width. */ int parisc_narrow_firmware __ro_after_init = NARROW_FIRMWARE; #endif
/* On most currently-supported platforms, IODC I/O calls are 32-bit calls * and MEM_PDC calls are always the same width as the OS. * Some PAT boxes may have 64-bit IODC I/O. * * Ryan Bradetich added the now obsolete CONFIG_PDC_NARROW to allow * 64-bit kernels to run on systems with 32-bit MEM_PDC calls. * This allowed wide kernels to run on Cxxx boxes. * We now detect 32-bit-only PDC and dynamically switch to 32-bit mode * when running a 64-bit kernel on such boxes (e.g. C200 or C360).
*/
#ifdef CONFIG_64BIT long real64_call(unsignedlong function, ...); #endif long real32_call(unsignedlong function, ...);
/** * f_extend - Convert PDC addresses to kernel addresses. * @address: Address returned from PDC. * * This function is used to convert PDC addresses into kernel addresses * when the PDC address size and kernel address size are different.
*/ staticunsignedlong f_extend(unsignedlong address)
{ #ifdef CONFIG_64BIT if(unlikely(parisc_narrow_firmware)) { if((address & 0xff000000) == 0xf0000000) return (0xfffffff0UL << 32) | (u32)address;
/** * convert_to_wide - Convert the return buffer addresses into kernel addresses. * @addr: The return buffer from PDC. * * This function is used to convert the return buffer addresses retrieved from PDC * into kernel addresses when the PDC address size and kernel address size are * different.
*/ staticvoid convert_to_wide(unsignedlong *addr)
{ #ifdef CONFIG_64BIT int i; unsignedint *p = (unsignedint *)addr;
if (unlikely(parisc_narrow_firmware)) { for (i = (NUM_PDC_RESULT-1); i >= 0; --i)
addr[i] = p[i];
} #endif
}
#ifdef CONFIG_64BIT void set_firmware_width_unlocked(void)
{ int ret;
ret = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES,
__pa(pdc_result), 0); if (ret < 0) return;
convert_to_wide(pdc_result); if (pdc_result[0] != NARROW_FIRMWARE)
parisc_narrow_firmware = 0;
}
/** * set_firmware_width - Determine if the firmware is wide or narrow. * * This function must be called before any pdc_* function that uses the * convert_to_wide function.
*/ void set_firmware_width(void)
{ unsignedlong flags;
/* already initialized? */ if (parisc_narrow_firmware != NARROW_FIRMWARE) return;
#if !defined(BOOTLOADER) /** * pdc_emergency_unlock - Unlock the linux pdc lock * * This call unlocks the linux pdc lock in case we need some PDC functions * (like pdc_add_valid) during kernel stack dump.
*/ void pdc_emergency_unlock(void)
{ /* Spinlock DEBUG code freaks out if we unconditionally unlock */ if (spin_is_locked(&pdc_lock))
spin_unlock(&pdc_lock);
}
/** * pdc_add_valid - Verify address can be accessed without causing a HPMC. * @address: Address to be verified. * * This PDC call attempts to read from the specified address and verifies * if the address is valid. * * The return value is PDC_OK (0) in case accessing this address is valid.
*/ int pdc_add_valid(unsignedlong address)
{ int retval; unsignedlong flags;
/** * pdc_instr - Get instruction that invokes PDCE_CHECK in HPMC handler. * @instr: Pointer to variable which will get instruction opcode. * * The return value is PDC_OK (0) in case call succeeded.
*/ int __init pdc_instr(unsignedint *instr)
{ int retval; unsignedlong flags;
/** * pdc_chassis_info - Return chassis information. * @chassis_info: The memory buffer address. * @led_info: The size of the memory buffer address. * @len: The size of the memory buffer address. * * An HVERSION dependent call for returning the chassis information.
*/ int __init pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsignedlong len)
{ int retval; unsignedlong flags;
/** * pdc_pat_chassis_send_log - Sends a PDC PAT CHASSIS log message. * @state: state of the machine * @data: value for that state * * Must be correctly formatted or expect system crash
*/ #ifdef CONFIG_64BIT int pdc_pat_chassis_send_log(unsignedlong state, unsignedlong data)
{ int retval = 0; unsignedlong flags;
/** * pdc_chassis_disp - Updates chassis code * @disp: value to show on display
*/ int pdc_chassis_disp(unsignedlong disp)
{ int retval = 0; unsignedlong flags;
/** * __pdc_cpu_rendezvous - Stop currently executing CPU and do not return.
*/ int __pdc_cpu_rendezvous(void)
{ if (is_pdc_pat()) return mem_pdc_call(PDC_PAT_CPU, PDC_PAT_CPU_RENDEZVOUS); else return mem_pdc_call(PDC_PROC, 1, 0);
}
/** * pdc_cpu_rendezvous_lock - Lock PDC while transitioning to rendezvous state
*/ void pdc_cpu_rendezvous_lock(void) __acquires(&pdc_lock)
{
spin_lock(&pdc_lock);
}
/** * pdc_cpu_rendezvous_unlock - Unlock PDC after reaching rendezvous state
*/ void pdc_cpu_rendezvous_unlock(void) __releases(&pdc_lock)
{
spin_unlock(&pdc_lock);
}
/** * pdc_pat_get_PDC_entrypoint - Get PDC entry point for current CPU * @pdc_entry: pointer to where the PDC entry point should be stored
*/ int pdc_pat_get_PDC_entrypoint(unsignedlong *pdc_entry)
{ int retval = 0; unsignedlong flags;
return retval;
} /** * pdc_chassis_warn - Fetches chassis warnings * @warn: The warning value to be shown
*/ int pdc_chassis_warn(unsignedlong *warn)
{ int retval = 0; unsignedlong flags;
/** * pdc_coproc_cfg - To identify coprocessors attached to the processor. * @pdc_coproc_info: Return buffer address. * * This PDC call returns the presence and status of all the coprocessors * attached to the processor.
*/ int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info)
{ int ret; unsignedlong flags;
spin_lock_irqsave(&pdc_lock, flags);
ret = pdc_coproc_cfg_unlocked(pdc_coproc_info);
spin_unlock_irqrestore(&pdc_lock, flags);
return ret;
}
/** * pdc_iodc_read - Read data from the modules IODC. * @actcnt: The actual number of bytes. * @hpa: The HPA of the module for the iodc read. * @index: The iodc entry point. * @iodc_data: A buffer memory for the iodc options. * @iodc_data_size: Size of the memory buffer. * * This PDC call reads from the IODC of the module specified by the hpa * argument.
*/ int pdc_iodc_read(unsignedlong *actcnt, unsignedlong hpa, unsignedint index, void *iodc_data, unsignedint iodc_data_size)
{ int retval; unsignedlong flags;
/** * pdc_system_map_find_mods - Locate unarchitected modules. * @pdc_mod_info: Return buffer address. * @mod_path: pointer to dev path structure. * @mod_index: fixed address module index. * * To locate and identify modules which reside at fixed I/O addresses, which * do not self-identify via architected bus walks.
*/ int pdc_system_map_find_mods(struct pdc_system_map_mod_info *pdc_mod_info, struct pdc_module_path *mod_path, long mod_index)
{ int retval; unsignedlong flags;
/** * pdc_model_info - Return model information about the processor. * @model: The return buffer. * * Returns the version numbers, identifiers, and capabilities from the processor module.
*/ int pdc_model_info(struct pdc_model *model)
{ int retval; unsignedlong flags;
/** * pdc_model_sysmodel - Get the system model name. * @os_id: The operating system ID asked for (an OS_ID_* value) * @name: A char array of at least 81 characters. * * Get system model name from PDC ROM (e.g. 9000/715 or 9000/778/B160L). * Using OS_ID_HPUX will return the equivalent of the 'modelname' command * on HP/UX.
*/ int pdc_model_sysmodel(unsignedint os_id, char *name)
{ int retval; unsignedlong flags;
/** * pdc_model_versions - Identify the version number of each processor. * @versions: The return buffer. * @id: The id of the processor to check. * * Returns the version number for each processor component. * * This comment was here before, but I do not know what it means :( -RB * id: 0 = cpu revision, 1 = boot-rom-version
*/ int pdc_model_versions(unsignedlong *versions, int id)
{ int retval; unsignedlong flags;
/** * pdc_model_cpuid - Returns the CPU_ID. * @cpu_id: The return buffer. * * Returns the CPU_ID value which uniquely identifies the cpu portion of * the processor module.
*/ int pdc_model_cpuid(unsignedlong *cpu_id)
{ int retval; unsignedlong flags;
spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = 0; /* preset zero (call may not be implemented!) */
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CPU_ID, __pa(pdc_result), 0);
convert_to_wide(pdc_result);
*cpu_id = pdc_result[0];
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
}
/** * pdc_model_capabilities - Returns the platform capabilities. * @capabilities: The return buffer. * * Returns information about platform support for 32- and/or 64-bit * OSes, IO-PDIR coherency, and virtual aliasing.
*/ int pdc_model_capabilities(unsignedlong *capabilities)
{ int retval; unsignedlong flags;
spin_lock_irqsave(&pdc_lock, flags);
pdc_result[0] = 0; /* preset zero (call may not be implemented!) */
retval = mem_pdc_call(PDC_MODEL, PDC_MODEL_CAPABILITIES, __pa(pdc_result), 0);
convert_to_wide(pdc_result); if (retval == PDC_OK) {
*capabilities = pdc_result[0];
} else {
*capabilities = PDC_MODEL_OS32;
}
spin_unlock_irqrestore(&pdc_lock, flags);
return retval;
}
/** * pdc_model_platform_info - Returns machine product and serial number. * @orig_prod_num: Return buffer for original product number. * @current_prod_num: Return buffer for current product number. * @serial_no: Return buffer for serial number. * * Returns strings containing the original and current product numbers and the * serial number of the system.
*/ int pdc_model_platform_info(char *orig_prod_num, char *current_prod_num, char *serial_no)
{ int retval; unsignedlong flags;
/** * pdc_cache_info - Return cache and TLB information. * @cache_info: The return buffer. * * Returns information about the processor's cache and TLB.
*/ int pdc_cache_info(struct pdc_cache_info *cache_info)
{ int retval; unsignedlong flags;
/** * pdc_spaceid_bits - Return whether Space ID hashing is turned on. * @space_bits: Should be 0, if not, bad mojo! * * Returns information about Space ID hashing.
*/ int pdc_spaceid_bits(unsignedlong *space_bits)
{ int retval; unsignedlong flags;
/** * pdc_mem_map_hpa - Find fixed module information. * @address: The return buffer * @mod_path: pointer to dev path structure. * * This call was developed for S700 workstations to allow the kernel to find * the I/O devices (Core I/O). In the future (Kittyhawk and beyond) this * call will be replaced (on workstations) by the architected PDC_SYSTEM_MAP * call. * * This call is supported by all existing S700 workstations (up to Gecko).
*/ int pdc_mem_map_hpa(struct pdc_memory_map *address, struct pdc_module_path *mod_path)
{ int retval; unsignedlong flags;
/** * pdc_lan_station_id - Get the LAN address. * @lan_addr: The return buffer. * @hpa: The network device HPA. * * Get the LAN station address when it is not directly available from the LAN hardware.
*/ int pdc_lan_station_id(char *lan_addr, unsignedlong hpa)
{ int retval; unsignedlong flags;
/** * pdc_stable_read - Read data from Stable Storage. * @staddr: Stable Storage address to access. * @memaddr: The memory address where Stable Storage data shall be copied. * @count: number of bytes to transfer. count is multiple of 4. * * This PDC call reads from the Stable Storage address supplied in staddr * and copies count bytes to the memory address memaddr. * The call will fail if staddr+count > PDC_STABLE size.
*/ int pdc_stable_read(unsignedlong staddr, void *memaddr, unsignedlong count)
{ int retval; unsignedlong flags;
/** * pdc_stable_write - Write data to Stable Storage. * @staddr: Stable Storage address to access. * @memaddr: The memory address where Stable Storage data shall be read from. * @count: number of bytes to transfer. count is multiple of 4. * * This PDC call reads count bytes from the supplied memaddr address, * and copies count bytes to the Stable Storage address staddr. * The call will fail if staddr+count > PDC_STABLE size.
*/ int pdc_stable_write(unsignedlong staddr, void *memaddr, unsignedlong count)
{ int retval; unsignedlong flags;
/** * pdc_stable_get_size - Get Stable Storage size in bytes. * @size: pointer where the size will be stored. * * This PDC call returns the number of bytes in the processor's Stable * Storage, which is the number of contiguous bytes implemented in Stable * Storage starting from staddr=0. size in an unsigned 64-bit integer * which is a multiple of four.
*/ int pdc_stable_get_size(unsignedlong *size)
{ int retval; unsignedlong flags;
/** * pdc_stable_verify_contents - Checks that Stable Storage contents are valid. * * This PDC call is meant to be used to check the integrity of the current * contents of Stable Storage.
*/ int pdc_stable_verify_contents(void)
{ int retval; unsignedlong flags;
/** * pdc_stable_initialize - Sets Stable Storage contents to zero and initialize * the validity indicator. * * This PDC call will erase all contents of Stable Storage. Use with care!
*/ int pdc_stable_initialize(void)
{ int retval; unsignedlong flags;
/** * pdc_get_initiator - Get the SCSI Interface Card params (SCSI ID, SDTR, SE or LVD) * @hwpath: fully bc.mod style path to the device. * @initiator: the array to return the result into * * Get the SCSI operational parameters from PDC. * Needed since HPUX never used BIOS or symbios card NVRAM. * Most ncr/sym cards won't have an entry and just use whatever * capabilities of the card are (eg Ultra, LVD). But there are * several cases where it's useful: * o set SCSI id for Multi-initiator clusters, * o cable too long (ie SE scsi 10Mhz won't support 6m length), * o bus width exported is less than what the interface chip supports.
*/ int pdc_get_initiator(struct hardware_path *hwpath, struct pdc_initiator *initiator)
{ int retval; unsignedlong flags;
spin_lock_irqsave(&pdc_lock, flags);
/* BCJ-XXXX series boxes. E.G. "9000/785/C3000" */ #define IS_SPROCKETS() (strlen(boot_cpu_data.pdc.sys_model_name) == 14 && \
strncmp(boot_cpu_data.pdc.sys_model_name, "9000/785", 8) == 0)
/** * pdc_pci_irt_size - Get the number of entries in the interrupt routing table. * @num_entries: The return value. * @hpa: The HPA for the device. * * This PDC function returns the number of entries in the specified cell's * interrupt table. * Similar to PDC_PAT stuff - but added for Forte/Allegro boxes
*/ int pdc_pci_irt_size(unsignedlong *num_entries, unsignedlong hpa)
{ int retval; unsignedlong flags;
/** * pdc_pci_irt - Get the PCI interrupt routing table. * @num_entries: The number of entries in the table. * @hpa: The Hard Physical Address of the device. * @tbl: * * Get the PCI interrupt routing table for the device at the given HPA. * Similar to PDC_PAT stuff - but added for Forte/Allegro boxes
*/ int pdc_pci_irt(unsignedlong num_entries, unsignedlong hpa, void *tbl)
{ int retval; unsignedlong flags;
#if 0 /* UNTEST CODE - left here in case someone needs it */
/** * pdc_pci_config_read - read PCI config space. * @hpa: Token from PDC to indicate which PCI device * @cfg_addr: Configuration space address to read from * * Read PCI Configuration space *before* linux PCI subsystem is running.
*/ unsignedint pdc_pci_config_read(void *hpa, unsignedlong cfg_addr)
{ int retval; unsignedlong flags;
/** * pdc_pci_config_write - read PCI config space. * @hpa: Token from PDC to indicate which PCI device * @cfg_addr: Configuration space address to write * @val: Value we want in the 32-bit register * * Write PCI Configuration space *before* linux PCI subsystem is running.
*/ void pdc_pci_config_write(void *hpa, unsignedlong cfg_addr, unsignedint val)
{ int retval; unsignedlong flags;
#ifdef CONFIG_64BIT /* * 64-bit kernels should not call this PDT function in narrow mode. * The pdt_entries_ptr array above will now contain 32-bit values
*/ if (WARN_ON_ONCE((retval == PDC_OK) && parisc_narrow_firmware)) return PDC_ERROR; #endif
return retval;
}
/** * pdc_pim_toc11 - Fetch TOC PIM 1.1 data from firmware. * @ret: pointer to return buffer
*/ int pdc_pim_toc11(struct pdc_toc_pim_11 *ret)
{ int retval; unsignedlong flags;
/** * pdc_tod_set - Set the Time-Of-Day clock. * @sec: The number of seconds since epoch. * @usec: The number of micro seconds. * * Set the Time-Of-Day clock.
*/ int pdc_tod_set(unsignedlong sec, unsignedlong usec)
{ int retval; unsignedlong flags;
/* FIXME: Is this pdc used? I could not find type reference to ftc_bitmap * so I guessed at unsigned long. Someone who knows what this does, can fix * it later. :)
*/ int pdc_do_firm_test_reset(unsignedlong ftc_bitmap)
{ int retval; unsignedlong flags;
/* * pdc_soft_power_info - Enable soft power switch. * @power_reg: address of soft power register * * Return the absolute address of the soft power switch register
*/ int __init pdc_soft_power_info(unsignedlong *power_reg)
{ int retval; unsignedlong flags;
/* * pdc_soft_power_button{_panic} - Control the soft power button behaviour * @sw_control: 0 for hardware control, 1 for software control * * * This PDC function places the soft power button under software or * hardware control. * Under software control the OS may control to when to allow to shut * down the system. Under hardware control pressing the power button * powers off the system immediately. * * The _panic version relies on spin_trylock to prevent deadlock * on panic path.
*/ int pdc_soft_power_button(int sw_control)
{ int retval; unsignedlong flags;
/* * pdc_io_reset - Hack to avoid overlapping range registers of Bridges devices. * Primarily a problem on T600 (which parisc-linux doesn't support) but * who knows what other platform firmware might do with this OS "hook".
*/ void pdc_io_reset(void)
{ unsignedlong flags;
/* * pdc_io_reset_devices - Hack to Stop USB controller * * If PDC used the usb controller, the usb controller * is still running and will crash the machines during iommu * setup, because of still running DMA. This PDC call * stops the USB controller. * Normally called after calling pdc_io_reset().
*/ void pdc_io_reset_devices(void)
{ unsignedlong flags;
/* locked by pdc_lock */ staticchar iodc_dbuf[4096] __page_aligned_bss;
/** * pdc_iodc_print - Console print using IODC. * @str: the string to output. * @count: length of str * * Note that only these special chars are architected for console IODC io: * BEL, BS, CR, and LF. Others are passed through. * Since the HP console requires CR+LF to perform a 'newline', we translate * "\n" to "\r\n".
*/ int pdc_iodc_print(constunsignedchar *str, unsigned count)
{ unsignedint i, found = 0; unsignedlong flags;
#if !defined(BOOTLOADER) /** * pdc_iodc_getc - Read a character (non-blocking) from the PDC console. * * Read a character (non-blocking) from the PDC console, returns -1 if * key is not present.
*/ int pdc_iodc_getc(void)
{ int ch; int status; unsignedlong flags;
/* Bail if no console input device. */ if (!PAGE0->mem_kbd.iodc_io) return 0;
/* wait for a keyboard (rs232)-input */
spin_lock_irqsave(&pdc_lock, flags);
real32_call(PAGE0->mem_kbd.iodc_io,
(unsignedlong)PAGE0->mem_kbd.hpa, ENTRY_IO_CIN,
PAGE0->mem_kbd.spa, __pa(PAGE0->mem_kbd.dp.layers),
__pa(pdc_result), 0, __pa(iodc_dbuf), 1, 0);
ch = *iodc_dbuf; /* like convert_to_wide() but for first return value only: */
status = *(int *)&pdc_result;
spin_unlock_irqrestore(&pdc_lock, flags);
if (status == 0) return -1;
return ch;
}
int pdc_sti_call(unsignedlong func, unsignedlong flags, unsignedlong inptr, unsignedlong outputr, unsignedlong glob_cfg, int do_call64)
{ int retval = 0; unsignedlong irqflags;
#ifdef CONFIG_64BIT /** * pdc_pat_cell_get_number - Returns the cell number. * @cell_info: The return buffer. * * This PDC call returns the cell number of the cell from which the call * is made.
*/ int pdc_pat_cell_get_number(struct pdc_pat_cell_num *cell_info)
{ int retval; unsignedlong flags;
/** * pdc_pat_cell_module - Retrieve the cell's module information. * @actcnt: The number of bytes written to mem_addr. * @ploc: The physical location. * @mod: The module index. * @view_type: The view of the address type. * @mem_addr: The return buffer. * * This PDC call returns information about each module attached to the cell * at the specified location.
*/ int pdc_pat_cell_module(unsignedlong *actcnt, unsignedlong ploc, unsignedlong mod, unsignedlong view_type, void *mem_addr)
{ int retval; unsignedlong flags; staticstruct pdc_pat_cell_mod_maddr_block result __attribute__ ((aligned (8)));
/** * pdc_pat_cell_info - Retrieve the cell's information. * @info: The pointer to a struct pdc_pat_cell_info_rtn_block. * @actcnt: The number of bytes which should be written to info. * @offset: offset of the structure. * @cell_number: The cell number which should be asked, or -1 for current cell. * * This PDC call returns information about the given cell (or all cells).
*/ int pdc_pat_cell_info(struct pdc_pat_cell_info_rtn_block *info, unsignedlong *actcnt, unsignedlong offset, unsignedlong cell_number)
{ int retval; unsignedlong flags; struct pdc_pat_cell_info_rtn_block result;
/** * pdc_pat_cpu_get_number - Retrieve the cpu number. * @cpu_info: The return buffer. * @hpa: The Hard Physical Address of the CPU. * * Retrieve the cpu number for the cpu at the specified HPA.
*/ int pdc_pat_cpu_get_number(struct pdc_pat_cpu_num *cpu_info, unsignedlong hpa)
{ int retval; unsignedlong flags;
/** * pdc_pat_get_irt_size - Retrieve the number of entries in the cell's interrupt table. * @num_entries: The return value. * @cell_num: The target cell. * * This PDC function returns the number of entries in the specified cell's * interrupt table.
*/ int pdc_pat_get_irt_size(unsignedlong *num_entries, unsignedlong cell_num)
{ int retval; unsignedlong flags;
/** * pdc_pat_get_irt - Retrieve the cell's interrupt table. * @r_addr: The return buffer. * @cell_num: The target cell. * * This PDC function returns the actual interrupt table for the specified cell.
*/ int pdc_pat_get_irt(void *r_addr, unsignedlong cell_num)
{ int retval; unsignedlong flags;
/** * pdc_pat_pd_get_addr_map - Retrieve information about memory address ranges. * @actual_len: The return buffer. * @mem_addr: Pointer to the memory buffer. * @count: The number of bytes to read from the buffer. * @offset: The offset with respect to the beginning of the buffer. *
*/ int pdc_pat_pd_get_addr_map(unsignedlong *actual_len, void *mem_addr, unsignedlong count, unsignedlong offset)
{ int retval; unsignedlong flags;
/** * pdc_pat_io_pci_cfg_read - Read PCI configuration space. * @pci_addr: PCI configuration space address for which the read request is being made. * @pci_size: Size of read in bytes. Valid values are 1, 2, and 4. * @mem_addr: Pointer to return memory buffer. *
*/ int pdc_pat_io_pci_cfg_read(unsignedlong pci_addr, int pci_size, u32 *mem_addr)
{ int retval; unsignedlong flags;
/** * pdc_pat_io_pci_cfg_write - Retrieve information about memory address ranges. * @pci_addr: PCI configuration space address for which the write request is being made. * @pci_size: Size of write in bytes. Valid values are 1, 2, and 4. * @val: Pointer to 1, 2, or 4 byte value in low order end of argument to be * written to PCI Config space. *
*/ int pdc_pat_io_pci_cfg_write(unsignedlong pci_addr, int pci_size, u32 val)
{ int retval; unsignedlong flags;
/** * pdc_pat_mem_pdt_cell_info - Retrieve information about page deallocation * table of a cell * @rinfo: memory pdt information * @cell: cell number *
*/ int pdc_pat_mem_pdt_cell_info(struct pdc_pat_mem_cell_pdt_retinfo *rinfo, unsignedlong cell)
{ int retval; unsignedlong flags;
/** * pdc_pat_mem_read_cell_pdt - Read PDT entries from (old) PAT firmware * @pret: array of PDT entries * @pdt_entries_ptr: ptr to hold number of PDT entries * @max_entries: maximum number of entries to be read *
*/ int pdc_pat_mem_read_cell_pdt(struct pdc_pat_mem_read_pd_retinfo *pret, unsignedlong *pdt_entries_ptr, unsignedlong max_entries)
{ int retval; unsignedlong flags, entries;
spin_lock_irqsave(&pdc_lock, flags); /* PDC_PAT_MEM_CELL_READ is available on early PAT machines only */
retval = mem_pdc_call(PDC_PAT_MEM, PDC_PAT_MEM_CELL_READ,
__pa(&pdc_result), parisc_cell_num,
__pa(pdt_entries_ptr));
if (retval == PDC_OK) { /* build up return value as for PDC_PAT_MEM_PD_READ */
entries = min(pdc_result[0], max_entries);
pret->pdt_entries = entries;
pret->actual_count_bytes = entries * sizeof(unsignedlong);
}
return retval;
} /** * pdc_pat_mem_read_pd_pdt - Read PDT entries from (newer) PAT firmware * @pret: array of PDT entries * @pdt_entries_ptr: ptr to hold number of PDT entries * @count: number of bytes to read * @offset: offset to start (in bytes) *
*/ int pdc_pat_mem_read_pd_pdt(struct pdc_pat_mem_read_pd_retinfo *pret, unsignedlong *pdt_entries_ptr, unsignedlong count, unsignedlong offset)
{ int retval; unsignedlong flags, entries;
/** * pdc_pat_mem_get_dimm_phys_location - Get physical DIMM slot via PAT firmware * @pret: ptr to hold returned information * @phys_addr: physical address to examine *
*/ int pdc_pat_mem_get_dimm_phys_location( struct pdc_pat_mem_phys_mem_location *pret, unsignedlong phys_addr)
{ int retval; unsignedlong flags;
/***************** 32-bit real-mode calls ***********/ /* The struct below is used * to overlay real_stack (real2.S), preparing a 32-bit call frame. * real32_call_asm() then uses this stack in narrow real mode
*/
struct narrow_stack { /* use int, not long which is 64 bits */ unsignedint arg13; unsignedint arg12; unsignedint arg11; unsignedint arg10; unsignedint arg9; unsignedint arg8; unsignedint arg7; unsignedint arg6; unsignedint arg5; unsignedint arg4; unsignedint arg3; unsignedint arg2; unsignedint arg1; unsignedint arg0; unsignedint frame_marker[8]; unsignedint sp; /* in reality, there's nearly 8k of stack after this */
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.