diff options
-rw-r--r-- | Documentation/ia64/aliasing.rst (renamed from Documentation/ia64/aliasing.txt) | 73 | ||||
-rw-r--r-- | Documentation/ia64/efirtc.rst (renamed from Documentation/ia64/efirtc.txt) | 120 | ||||
-rw-r--r-- | Documentation/ia64/err_inject.rst (renamed from Documentation/ia64/err_inject.txt) | 359 | ||||
-rw-r--r-- | Documentation/ia64/fsys.rst (renamed from Documentation/ia64/fsys.txt) | 133 | ||||
-rw-r--r-- | Documentation/ia64/ia64.rst (renamed from Documentation/ia64/README) | 26 | ||||
-rw-r--r-- | Documentation/ia64/index.rst | 18 | ||||
-rw-r--r-- | Documentation/ia64/irq-redir.rst (renamed from Documentation/ia64/IRQ-redir.txt) | 31 | ||||
-rw-r--r-- | Documentation/ia64/mca.rst (renamed from Documentation/ia64/mca.txt) | 10 | ||||
-rw-r--r-- | Documentation/ia64/serial.rst (renamed from Documentation/ia64/serial.txt) | 36 | ||||
-rw-r--r-- | Documentation/ia64/xen.rst | 206 | ||||
-rw-r--r-- | Documentation/ia64/xen.txt | 183 | ||||
-rw-r--r-- | MAINTAINERS | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/efi.c | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/fsys.S | 2 | ||||
-rw-r--r-- | arch/ia64/mm/ioremap.c | 2 | ||||
-rw-r--r-- | arch/ia64/pci/pci.c | 2 |
16 files changed, 669 insertions, 536 deletions
diff --git a/Documentation/ia64/aliasing.txt b/Documentation/ia64/aliasing.rst index 5a4dea6abebd..a08b36aba015 100644 --- a/Documentation/ia64/aliasing.txt +++ b/Documentation/ia64/aliasing.rst @@ -1,20 +1,25 @@ - MEMORY ATTRIBUTE ALIASING ON IA-64 +================================== +Memory Attribute Aliasing on IA-64 +================================== - Bjorn Helgaas - <bjorn.helgaas@hp.com> - May 4, 2006 +Bjorn Helgaas <bjorn.helgaas@hp.com> +May 4, 2006 -MEMORY ATTRIBUTES + +Memory Attributes +================= Itanium supports several attributes for virtual memory references. The attribute is part of the virtual translation, i.e., it is contained in the TLB entry. The ones of most interest to the Linux kernel are: - WB Write-back (cacheable) + == ====================== + WB Write-back (cacheable) UC Uncacheable WC Write-coalescing + == ====================== System memory typically uses the WB attribute. The UC attribute is used for memory-mapped I/O devices. The WC attribute is uncacheable @@ -29,7 +34,8 @@ MEMORY ATTRIBUTES support either WB or UC access to main memory, while others support only WB access. -MEMORY MAP +Memory Map +========== Platform firmware describes the physical memory map and the supported attributes for each region. At boot-time, the kernel uses @@ -55,7 +61,8 @@ MEMORY MAP The efi_memmap table is preserved unmodified because the original boot-time information is required for kexec. -KERNEL IDENTITY MAPPINGS +Kernel Identify Mappings +======================== Linux/ia64 identity mappings are done with large pages, currently either 16MB or 64MB, referred to as "granules." Cacheable mappings @@ -74,17 +81,20 @@ KERNEL IDENTITY MAPPINGS are only partially populated, or populated with a combination of UC and WB regions. -USER MAPPINGS +User Mappings +============= User mappings are typically done with 16K or 64K pages. The smaller page size allows more flexibility because only 16K or 64K has to be homogeneous with respect to memory attributes. -POTENTIAL ATTRIBUTE ALIASING CASES +Potential Attribute Aliasing Cases +================================== There are several ways the kernel creates new mappings: - mmap of /dev/mem +mmap of /dev/mem +---------------- This uses remap_pfn_range(), which creates user mappings. These mappings may be either WB or UC. If the region being mapped @@ -98,7 +108,8 @@ POTENTIAL ATTRIBUTE ALIASING CASES Since the EFI memory map does not describe MMIO on some machines, this should use an uncacheable mapping as a fallback. - mmap of /sys/class/pci_bus/.../legacy_mem +mmap of /sys/class/pci_bus/.../legacy_mem +----------------------------------------- This is very similar to mmap of /dev/mem, except that legacy_mem only allows mmap of the one megabyte "legacy MMIO" area for a @@ -112,9 +123,10 @@ POTENTIAL ATTRIBUTE ALIASING CASES The /dev/mem mmap constraints apply. - mmap of /proc/bus/pci/.../??.? +mmap of /proc/bus/pci/.../??.? +------------------------------ - This is an MMIO mmap of PCI functions, which additionally may or + This is an MMIO mmap of PCI functions, which additionally may or may not be requested as using the WC attribute. If WC is requested, and the region in kern_memmap is either WC @@ -124,7 +136,8 @@ POTENTIAL ATTRIBUTE ALIASING CASES Otherwise, the user mapping must use the same attribute as the kernel mapping. - read/write of /dev/mem +read/write of /dev/mem +---------------------- This uses copy_from_user(), which implicitly uses a kernel identity mapping. This is obviously safe for things in @@ -138,7 +151,8 @@ POTENTIAL ATTRIBUTE ALIASING CASES eight-byte accesses, and the copy_from_user() path doesn't allow any control over the access size, so this would be dangerous. - ioremap() +ioremap() +--------- This returns a mapping for use inside the kernel. @@ -155,9 +169,11 @@ POTENTIAL ATTRIBUTE ALIASING CASES Failing all of the above, we have to fall back to a UC mapping. -PAST PROBLEM CASES +Past Problem Cases +================== - mmap of various MMIO regions from /dev/mem by "X" on Intel platforms +mmap of various MMIO regions from /dev/mem by "X" on Intel platforms +-------------------------------------------------------------------- The EFI memory map may not report these MMIO regions. @@ -166,12 +182,16 @@ PAST PROBLEM CASES succeed. It may create either WB or UC user mappings, depending on whether the region is in kern_memmap or the EFI memory map. - mmap of 0x0-0x9FFFF /dev/mem by "hwinfo" on HP sx1000 with VGA enabled +mmap of 0x0-0x9FFFF /dev/mem by "hwinfo" on HP sx1000 with VGA enabled +---------------------------------------------------------------------- The EFI memory map reports the following attributes: + + =============== ======= ================== 0x00000-0x9FFFF WB only 0xA0000-0xBFFFF UC only (VGA frame buffer) 0xC0000-0xFFFFF WB only + =============== ======= ================== This mmap is done with user pages, not kernel identity mappings, so it is safe to use WB mappings. @@ -182,7 +202,8 @@ PAST PROBLEM CASES never generate an uncacheable reference to the WB-only areas unless the driver explicitly touches them. - mmap of 0x0-0xFFFFF legacy_mem by "X" +mmap of 0x0-0xFFFFF legacy_mem by "X" +------------------------------------- If the EFI memory map reports that the entire range supports the same attributes, we can allow the mmap (and we will prefer WB if @@ -197,15 +218,18 @@ PAST PROBLEM CASES that doesn't report the VGA frame buffer at all), we should fail the mmap and force the user to map just the specific region of interest. - mmap of 0xA0000-0xBFFFF legacy_mem by "X" on HP sx1000 with VGA disabled +mmap of 0xA0000-0xBFFFF legacy_mem by "X" on HP sx1000 with VGA disabled +------------------------------------------------------------------------ + + The EFI memory map reports the following attributes:: - The EFI memory map reports the following attributes: 0x00000-0xFFFFF WB only (no VGA MMIO hole) This is a special case of the previous case, and the mmap should fail for the same reason as above. - read of /sys/devices/.../rom +read of /sys/devices/.../rom +---------------------------- For VGA devices, this may cause an ioremap() of 0xC0000. This used to be done with a UC mapping, because the VGA frame buffer @@ -215,7 +239,8 @@ PAST PROBLEM CASES We should use WB page table mappings to avoid covering the VGA frame buffer. -NOTES +Notes +===== [1] SDM rev 2.2, vol 2, sec 4.4.1. [2] SDM rev 2.2, vol 2, sec 4.4.6. diff --git a/Documentation/ia64/efirtc.txt b/Documentation/ia64/efirtc.rst index 057e6bebda8f..2f7ff5026308 100644 --- a/Documentation/ia64/efirtc.txt +++ b/Documentation/ia64/efirtc.rst @@ -1,12 +1,16 @@ +========================== EFI Real Time Clock driver -------------------------------- +========================== + S. Eranian <eranian@hpl.hp.com> + March 2000 -I/ Introduction +1. Introduction +=============== This document describes the efirtc.c driver has provided for -the IA-64 platform. +the IA-64 platform. The purpose of this driver is to supply an API for kernel and user applications to get access to the Time Service offered by EFI version 0.92. @@ -16,112 +20,124 @@ SetTime(), GetWakeupTime(), SetWakeupTime() which are all supported by this driver. We describe those calls as well the design of the driver in the following sections. -II/ Design Decisions +2. Design Decisions +=================== -The original ideas was to provide a very simple driver to get access to, -at first, the time of day service. This is required in order to access, in a -portable way, the CMOS clock. A program like /sbin/hwclock uses such a clock +The original ideas was to provide a very simple driver to get access to, +at first, the time of day service. This is required in order to access, in a +portable way, the CMOS clock. A program like /sbin/hwclock uses such a clock to initialize the system view of the time during boot. Because we wanted to minimize the impact on existing user-level apps using the CMOS clock, we decided to expose an API that was very similar to the one -used today with the legacy RTC driver (driver/char/rtc.c). However, because +used today with the legacy RTC driver (driver/char/rtc.c). However, because EFI provides a simpler services, not all ioctl() are available. Also -new ioctl()s have been introduced for things that EFI provides but not the +new ioctl()s have been introduced for things that EFI provides but not the legacy. EFI uses a slightly different way of representing the time, noticeably the reference date is different. Year is the using the full 4-digit format. The Epoch is January 1st 1998. For backward compatibility reasons we don't -expose this new way of representing time. Instead we use something very +expose this new way of representing time. Instead we use something very similar to the struct tm, i.e. struct rtc_time, as used by hwclock. One of the reasons for doing it this way is to allow for EFI to still evolve without necessarily impacting any of the user applications. The decoupling enables flexibility and permits writing wrapper code is ncase things change. The driver exposes two interfaces, one via the device file and a set of -ioctl()s. The other is read-only via the /proc filesystem. +ioctl()s. The other is read-only via the /proc filesystem. As of today we don't offer a /proc/sys interface. To allow for a uniform interface between the legacy RTC and EFI time service, -we have created the include/linux/rtc.h header file to contain only the -"public" API of the two drivers. The specifics of the legacy RTC are still +we have created the include/linux/rtc.h header file to contain only the +"public" API of the two drivers. The specifics of the legacy RTC are still in include/linux/mc146818rtc.h. - -III/ Time of day service + +3. Time of day service +====================== The part of the driver gives access to the time of day service of EFI. Two ioctl()s, compatible with the legacy RTC calls: - Read the CMOS clock: ioctl(d, RTC_RD_TIME, &rtc); + Read the CMOS clock:: + + ioctl(d, RTC_RD_TIME, &rtc); + + Write the CMOS clock:: - Write the CMOS clock: ioctl(d, RTC_SET_TIME, &rtc); + ioctl(d, RTC_SET_TIME, &rtc); The rtc is a pointer to a data structure defined in rtc.h which is close -to a struct tm: - -struct rtc_time { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; -}; +to a struct tm:: + + struct rtc_time { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + }; The driver takes care of converting back an forth between the EFI time and this format. Those two ioctl()s can be exercised with the hwclock command: -For reading: -# /sbin/hwclock --show -Mon Mar 6 15:32:32 2000 -0.910248 seconds +For reading:: -For setting: -# /sbin/hwclock --systohc + # /sbin/hwclock --show + Mon Mar 6 15:32:32 2000 -0.910248 seconds + +For setting:: + + # /sbin/hwclock --systohc Root privileges are required to be able to set the time of day. -IV/ Wakeup Alarm service +4. Wakeup Alarm service +======================= EFI provides an API by which one can program when a machine should wakeup, i.e. reboot. This is very different from the alarm provided by the legacy RTC which is some kind of interval timer alarm. For this reason we don't use the same ioctl()s to get access to the service. Instead we have -introduced 2 news ioctl()s to the interface of an RTC. +introduced 2 news ioctl()s to the interface of an RTC. We have added 2 new ioctl()s that are specific to the EFI driver: - Read the current state of the alarm - ioctl(d, RTC_WKLAM_RD, &wkt) + Read the current state of the alarm:: + + ioctl(d, RTC_WKLAM_RD, &wkt) + + Set the alarm or change its status:: + + ioctl(d, RTC_WKALM_SET, &wkt) - Set the alarm or change its status - ioctl(d, RTC_WKALM_SET, &wkt) +The wkt structure encapsulates a struct rtc_time + 2 extra fields to get +status information:: -The wkt structure encapsulates a struct rtc_time + 2 extra fields to get -status information: - -struct rtc_wkalrm { + struct rtc_wkalrm { - unsigned char enabled; /* =1 if alarm is enabled */ - unsigned char pending; /* =1 if alarm is pending */ + unsigned char enabled; /* =1 if alarm is enabled */ + unsigned char pending; /* =1 if alarm is pending */ - struct rtc_time time; -} + struct rtc_time time; + } As of today, none of the existing user-level apps supports this feature. -However writing such a program should be hard by simply using those two -ioctl(). +However writing such a program should be hard by simply using those two +ioctl(). Root privileges are required to be able to set the alarm. -V/ References. +5. References +============= Checkout the following Web site for more information on EFI: diff --git a/Documentation/ia64/err_inject.txt b/Documentation/ia64/err_inject.rst index 9f651c181429..900f71e93a29 100644 --- a/Documentation/ia64/err_inject.txt +++ b/Documentation/ia64/err_inject.rst @@ -1,4 +1,4 @@ - +======================================== IPF Machine Check (MC) error inject tool ======================================== @@ -32,94 +32,94 @@ Errata: Itanium 2 Processors Specification Update lists some errata against the pal_mc_error_inject PAL procedure. The following err.conf has been tested on latest Montecito PAL. -err.conf: +err.conf:: -#This is configuration file for err_inject_tool. -#The format of the each line is: -#cpu, loop, interval, err_type_info, err_struct_info, err_data_buffer -#where -# cpu: logical cpu number the error will be inject in. -# loop: times the error will be injected. -# interval: In second. every so often one error is injected. -# err_type_info, err_struct_info: PAL parameters. -# -#Note: All values are hex w/o or w/ 0x prefix. + #This is configuration file for err_inject_tool. + #The format of the each line is: + #cpu, loop, interval, err_type_info, err_struct_info, err_data_buffer + #where + # cpu: logical cpu number the error will be inject in. + # loop: times the error will be injected. + # interval: In second. every so often one error is injected. + # err_type_info, err_struct_info: PAL parameters. + # + #Note: All values are hex w/o or w/ 0x prefix. -#On cpu2, inject only total 0x10 errors, interval 5 seconds -#corrected, data cache, hier-2, physical addr(assigned by tool code). -#working on Montecito latest PAL. -2, 10, 5, 4101, 95 + #On cpu2, inject only total 0x10 errors, interval 5 seconds + #corrected, data cache, hier-2, physical addr(assigned by tool code). + #working on Montecito latest PAL. + 2, 10, 5, 4101, 95 -#On cpu4, inject and consume total 0x10 errors, interval 5 seconds -#corrected, data cache, hier-2, physical addr(assigned by tool code). -#working on Montecito latest PAL. -4, 10, 5, 4109, 95 + #On cpu4, inject and consume total 0x10 errors, interval 5 seconds + #corrected, data cache, hier-2, physical addr(assigned by tool code). + #working on Montecito latest PAL. + 4, 10, 5, 4109, 95 -#On cpu15, inject and consume total 0x10 errors, interval 5 seconds -#recoverable, DTR0, hier-2. -#working on Montecito latest PAL. -0xf, 0x10, 5, 4249, 15 + #On cpu15, inject and consume total 0x10 errors, interval 5 seconds + #recoverable, DTR0, hier-2. + #working on Montecito latest PAL. + 0xf, 0x10, 5, 4249, 15 The sample application source code: -err_injection_tool.c: - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or - * NON INFRINGEMENT. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Copyright (C) 2006 Intel Co - * Fenghua Yu <fenghua.yu@intel.com> - * - */ -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <stdio.h> -#include <sched.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <errno.h> -#include <time.h> -#include <sys/ipc.h> -#include <sys/sem.h> -#include <sys/wait.h> -#include <sys/mman.h> -#include <sys/shm.h> - -#define MAX_FN_SIZE 256 -#define MAX_BUF_SIZE 256 -#define DATA_BUF_SIZE 256 -#define NR_CPUS 512 -#define MAX_TASK_NUM 2048 -#define MIN_INTERVAL 5 // seconds -#define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte. -#define PARA_FIELD_NUM 5 -#define MASK_SIZE (NR_CPUS/64) -#define PATH_FORMAT "/sys/devices/system/cpu/cpu%d/err_inject/" - -int sched_setaffinity(pid_t pid, unsigned int len, unsigned long *mask); - -int verbose; -#define vbprintf if (verbose) printf - -int log_info(int cpu, const char *fmt, ...) -{ +err_injection_tool.c:: + + /* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or + * NON INFRINGEMENT. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Copyright (C) 2006 Intel Co + * Fenghua Yu <fenghua.yu@intel.com> + * + */ + #include <sys/types.h> + #include <sys/stat.h> + #include <fcntl.h> + #include <stdio.h> + #include <sched.h> + #include <unistd.h> + #include <stdlib.h> + #include <stdarg.h> + #include <string.h> + #include <errno.h> + #include <time.h> + #include <sys/ipc.h> + #include <sys/sem.h> + #include <sys/wait.h> + #include <sys/mman.h> + #include <sys/shm.h> + + #define MAX_FN_SIZE 256 + #define MAX_BUF_SIZE 256 + #define DATA_BUF_SIZE 256 + #define NR_CPUS 512 + #define MAX_TASK_NUM 2048 + #define MIN_INTERVAL 5 // seconds + #define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte. + #define PARA_FIELD_NUM 5 + #define MASK_SIZE (NR_CPUS/64) + #define PATH_FORMAT "/sys/devices/system/cpu/cpu%d/err_inject/" + + int sched_setaffinity(pid_t pid, unsigned int len, unsigned long *mask); + + int verbose; + #define vbprintf if (verbose) printf + + int log_info(int cpu, const char *fmt, ...) + { FILE *log; char fn[MAX_FN_SIZE]; char buf[MAX_BUF_SIZE]; @@ -142,12 +142,12 @@ int log_info(int cpu, const char *fmt, ...) fclose(log); return 0; -} + } -typedef unsigned long u64; -typedef unsigned int u32; + typedef unsigned long u64; + typedef unsigned int u32; -typedef union err_type_info_u { + typedef union err_type_info_u { struct { u64 mode : 3, /* 0-2 */ err_inj : 3, /* 3-5 */ @@ -157,9 +157,9 @@ typedef union err_type_info_u { reserved : 48; /* 16-63 */ } err_type_info_u; u64 err_type_info; -} err_type_info_t; + } err_type_info_t; -typedef union err_struct_info_u { + typedef union err_struct_info_u { struct { u64 siv : 1, /* 0 */ c_t : 2, /* 1-2 */ @@ -197,9 +197,9 @@ typedef union err_struct_info_u { u64 reserved; } err_struct_info_bus_processor_interconnect; u64 err_struct_info; -} err_struct_info_t; + } err_struct_info_t; -typedef union err_data_buffer_u { + typedef union err_data_buffer_u { struct { u64 trigger_addr; /* 0-63 */ u64 inj_addr; /* 64-127 */ @@ -221,9 +221,9 @@ typedef union err_data_buffer_u { u64 reserved; /* 0-63 */ } err_data_buffer_bus_processor_interconnect; u64 err_data_buffer[ERR_DATA_BUFFER_SIZE]; -} err_data_buffer_t; + } err_data_buffer_t; -typedef union capabilities_u { + typedef union capabilities_u { struct { u64 i : 1, d : 1, @@ -276,9 +276,9 @@ typedef union capabilities_u { struct { u64 reserved; } capabilities_bus_processor_interconnect; -} capabilities_t; + } capabilities_t; -typedef struct resources_s { + typedef struct resources_s { u64 ibr0 : 1, ibr2 : 1, ibr4 : 1, @@ -288,24 +288,24 @@ typedef struct resources_s { dbr4 : 1, dbr6 : 1, reserved : 48; -} resources_t; + } resources_t; -long get_page_size(void) -{ + long get_page_size(void) + { long page_size=sysconf(_SC_PAGESIZE); return page_size; -} + } -#define PAGE_SIZE (get_page_size()==-1?0x4000:get_page_size()) -#define SHM_SIZE (2*PAGE_SIZE*NR_CPUS) -#define SHM_VA 0x2000000100000000 + #define PAGE_SIZE (get_page_size()==-1?0x4000:get_page_size()) + #define SHM_SIZE (2*PAGE_SIZE*NR_CPUS) + #define SHM_VA 0x2000000100000000 -int shmid; -void *shmaddr; + int shmid; + void *shmaddr; -int create_shm(void) -{ + int create_shm(void) + { key_t key; char fn[MAX_FN_SIZE]; @@ -343,34 +343,34 @@ int create_shm(void) mlock(shmaddr, SHM_SIZE); return 0; -} + } -int free_shm() -{ + int free_shm() + { munlock(shmaddr, SHM_SIZE); - shmdt(shmaddr); + shmdt(shmaddr); semctl(shmid, 0, IPC_RMID); return 0; -} + } -#ifdef _SEM_SEMUN_UNDEFINED -union semun -{ + #ifdef _SEM_SEMUN_UNDEFINED + union semun + { int val; struct semid_ds *buf; unsigned short int *array; struct seminfo *__buf; -}; -#endif + }; + #endif -u32 mode=1; /* 1: physical mode; 2: virtual mode. */ -int one_lock=1; -key_t key[NR_CPUS]; -int semid[NR_CPUS]; + u32 mode=1; /* 1: physical mode; 2: virtual mode. */ + int one_lock=1; + key_t key[NR_CPUS]; + int semid[NR_CPUS]; -int create_sem(int cpu) -{ + int create_sem(int cpu) + { union semun arg; char fn[MAX_FN_SIZE]; int sid; @@ -407,37 +407,37 @@ int create_sem(int cpu) } return 0; -} + } -static int lock(int cpu) -{ + static int lock(int cpu) + { struct sembuf lock; lock.sem_num = cpu; lock.sem_op = 1; semop(semid[cpu], &lock, 1); - return 0; -} + return 0; + } -static int unlock(int cpu) -{ + static int unlock(int cpu) + { struct sembuf unlock; unlock.sem_num = cpu; unlock.sem_op = -1; semop(semid[cpu], &unlock, 1); - return 0; -} + return 0; + } -void free_sem(int cpu) -{ + void free_sem(int cpu) + { semctl(semid[cpu], 0, IPC_RMID); -} + } -int wr_multi(char *fn, unsigned long *data, int size) -{ + int wr_multi(char *fn, unsigned long *data, int size) + { int fd; char buf[MAX_BUF_SIZE]; int ret; @@ -459,15 +459,15 @@ int wr_multi(char *fn, unsigned long *data, int size) ret=write(fd, buf, sizeof(buf)); close(fd); return ret; -} + } -int wr(char *fn, unsigned long data) -{ + int wr(char *fn, unsigned long data) + { return wr_multi(fn, &data, 1); -} + } -int rd(char *fn, unsigned long *data) -{ + int rd(char *fn, unsigned long *data) + { int fd; char buf[MAX_BUF_SIZE]; @@ -480,10 +480,10 @@ int rd(char *fn, unsigned long *data) *data=strtoul(buf, NULL, 16); close(fd); return 0; -} + } -int rd_status(char *path, int *status) -{ + int rd_status(char *path, int *status) + { char fn[MAX_FN_SIZE]; sprintf(fn, "%s/status", path); if (rd(fn, (u64*)status)<0) { @@ -492,10 +492,10 @@ int rd_status(char *path, int *status) } return 0; -} + } -int rd_capabilities(char *path, u64 *capabilities) -{ + int rd_capabilities(char *path, u64 *capabilities) + { char fn[MAX_FN_SIZE]; sprintf(fn, "%s/capabilities", path); if (rd(fn, capabilities)<0) { @@ -504,10 +504,10 @@ int rd_capabilities(char *path, u64 *capabilities) } return 0; -} + } -int rd_all(char *path) -{ + int rd_all(char *path) + { unsigned long err_type_info, err_struct_info, err_data_buffer; int status; unsigned long capabilities, resources; @@ -556,11 +556,11 @@ int rd_all(char *path) printf("resources=%lx\n", resources); return 0; -} + } -int query_capabilities(char *path, err_type_info_t err_type_info, + int query_capabilities(char *path, err_type_info_t err_type_info, u64 *capabilities) -{ + { char fn[MAX_FN_SIZE]; err_struct_info_t err_struct_info; err_data_buffer_t err_data_buffer; @@ -583,10 +583,10 @@ int query_capabilities(char *path, err_type_info_t err_type_info, return -1; return 0; -} + } -int query_all_capabilities() -{ + int query_all_capabilities() + { int status; err_type_info_t err_type_info; int err_sev, err_struct, struct_hier; @@ -629,12 +629,12 @@ int query_all_capabilities() } return 0; -} + } -int err_inject(int cpu, char *path, err_type_info_t err_type_info, + int err_inject(int cpu, char *path, err_type_info_t err_type_info, err_struct_info_t err_struct_info, err_data_buffer_t err_data_buffer) -{ + { int status; char fn[MAX_FN_SIZE]; @@ -667,13 +667,13 @@ int err_inject(int cpu, char *path, err_type_info_t err_type_info, } return status; -} + } -static int construct_data_buf(char *path, err_type_info_t err_type_info, + static int construct_data_buf(char *path, err_type_info_t err_type_info, err_struct_info_t err_struct_info, err_data_buffer_t *err_data_buffer, void *va1) -{ + { char fn[MAX_FN_SIZE]; u64 virt_addr=0, phys_addr=0; @@ -710,22 +710,22 @@ static int construct_data_buf(char *path, err_type_info_t err_type_info, } return 0; -} + } -typedef struct { + typedef struct { u64 cpu; u64 loop; u64 interval; u64 err_type_info; u64 err_struct_info; u64 err_data_buffer[ERR_DATA_BUFFER_SIZE]; -} parameters_t; + } parameters_t; -parameters_t line_para; -int para; + parameters_t line_para; + int para; -static int empty_data_buffer(u64 *err_data_buffer) -{ + static int empty_data_buffer(u64 *err_data_buffer) + { int empty=1; int i; @@ -734,10 +734,10 @@ static int empty_data_buffer(u64 *err_data_buffer) empty=0; return empty; -} + } -int err_inj() -{ + int err_inj() + { err_type_info_t err_type_info; err_struct_info_t err_struct_info; err_data_buffer_t err_data_buffer; @@ -951,10 +951,10 @@ int err_inj() printf("All done.\n"); return 0; -} + } -void help() -{ + void help() + { printf("err_inject_tool:\n"); printf("\t-q: query all capabilities. default: off\n"); printf("\t-m: procedure mode. 1: physical 2: virtual. default: 1\n"); @@ -977,10 +977,10 @@ void help() printf("The tool will take err.conf file as "); printf("input to inject single or multiple errors "); printf("on one or multiple cpus in parallel.\n"); -} + } -int main(int argc, char **argv) -{ + int main(int argc, char **argv) + { char c; int do_err_inj=0; int do_query_all=0; @@ -1031,7 +1031,7 @@ int main(int argc, char **argv) if (count!=PARA_FIELD_NUM+3) { line_para.err_data_buffer[0]=-1, line_para.err_data_buffer[1]=-1, - line_para.err_data_buffer[2]=-1; + line_para.err_data_buffer[2]=-1; count=sscanf(optarg, "%lx, %lx, %lx, %lx, %lx\n", &line_para.cpu, &line_para.loop, @@ -1064,5 +1064,4 @@ int main(int argc, char **argv) help(); return 0; -} - + } diff --git a/Documentation/ia64/fsys.txt b/Documentation/ia64/fsys.rst index 59dd689d9b86..a702d2cc94b6 100644 --- a/Documentation/ia64/fsys.txt +++ b/Documentation/ia64/fsys.rst @@ -1,9 +1,9 @@ --*-Mode: outline-*- - - Light-weight System Calls for IA-64 - ----------------------------------- +=================================== +Light-weight System Calls for IA-64 +=================================== Started: 13-Jan-2003 + Last update: 27-Sep-2003 David Mosberger-Tang @@ -52,12 +52,13 @@ privilege level is at level 0, this means that fsys-mode requires some care (see below). -* How to tell fsys-mode +How to tell fsys-mode +===================== Linux operates in fsys-mode when (a) the privilege level is 0 (most privileged) and (b) the stacks have NOT been switched to kernel memory yet. For convenience, the header file <asm-ia64/ptrace.h> provides -three macros: +three macros:: user_mode(regs) user_stack(task,regs) @@ -70,11 +71,12 @@ to by "regs" was executing in user mode (privilege level 3). user_stack() returns TRUE if the state pointed to by "regs" was executing on the user-level stack(s). Finally, fsys_mode() returns TRUE if the CPU state pointed to by " |