Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v2.6.14-rc2 116 lines 3.5 kB view raw
1/* 2 * PreP compliant NVRAM access 3 * This needs to be updated for PPC64 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 8 * 2 of the License, or (at your option) any later version. 9 */ 10 11#ifndef _PPC64_NVRAM_H 12#define _PPC64_NVRAM_H 13 14#define NVRW_CNT 0x20 15#define NVRAM_HEADER_LEN 16 /* sizeof(struct nvram_header) */ 16#define NVRAM_BLOCK_LEN 16 17#define NVRAM_MAX_REQ (2080/NVRAM_BLOCK_LEN) 18#define NVRAM_MIN_REQ (1056/NVRAM_BLOCK_LEN) 19 20#define NVRAM_AS0 0x74 21#define NVRAM_AS1 0x75 22#define NVRAM_DATA 0x77 23 24 25/* RTC Offsets */ 26 27#define MOTO_RTC_SECONDS 0x1FF9 28#define MOTO_RTC_MINUTES 0x1FFA 29#define MOTO_RTC_HOURS 0x1FFB 30#define MOTO_RTC_DAY_OF_WEEK 0x1FFC 31#define MOTO_RTC_DAY_OF_MONTH 0x1FFD 32#define MOTO_RTC_MONTH 0x1FFE 33#define MOTO_RTC_YEAR 0x1FFF 34#define MOTO_RTC_CONTROLA 0x1FF8 35#define MOTO_RTC_CONTROLB 0x1FF9 36 37#define NVRAM_SIG_SP 0x02 /* support processor */ 38#define NVRAM_SIG_OF 0x50 /* open firmware config */ 39#define NVRAM_SIG_FW 0x51 /* general firmware */ 40#define NVRAM_SIG_HW 0x52 /* hardware (VPD) */ 41#define NVRAM_SIG_FLIP 0x5a /* Apple flip/flop header */ 42#define NVRAM_SIG_APPL 0x5f /* Apple "system" (???) */ 43#define NVRAM_SIG_SYS 0x70 /* system env vars */ 44#define NVRAM_SIG_CFG 0x71 /* config data */ 45#define NVRAM_SIG_ELOG 0x72 /* error log */ 46#define NVRAM_SIG_VEND 0x7e /* vendor defined */ 47#define NVRAM_SIG_FREE 0x7f /* Free space */ 48#define NVRAM_SIG_OS 0xa0 /* OS defined */ 49#define NVRAM_SIG_PANIC 0xa1 /* Apple OSX "panic" */ 50 51/* If change this size, then change the size of NVNAME_LEN */ 52struct nvram_header { 53 unsigned char signature; 54 unsigned char checksum; 55 unsigned short length; 56 char name[12]; 57}; 58 59struct nvram_partition { 60 struct list_head partition; 61 struct nvram_header header; 62 unsigned int index; 63}; 64 65 66extern int nvram_write_error_log(char * buff, int length, unsigned int err_type); 67extern int nvram_read_error_log(char * buff, int length, unsigned int * err_type); 68extern int nvram_clear_error_log(void); 69extern struct nvram_partition *nvram_find_partition(int sig, const char *name); 70 71extern int pSeries_nvram_init(void); 72extern int pmac_nvram_init(void); 73extern int bpa_nvram_init(void); 74 75/* PowerMac specific nvram stuffs */ 76 77enum { 78 pmac_nvram_OF, /* Open Firmware partition */ 79 pmac_nvram_XPRAM, /* MacOS XPRAM partition */ 80 pmac_nvram_NR /* MacOS Name Registry partition */ 81}; 82 83/* Return partition offset in nvram */ 84extern int pmac_get_partition(int partition); 85 86/* Direct access to XPRAM on PowerMacs */ 87extern u8 pmac_xpram_read(int xpaddr); 88extern void pmac_xpram_write(int xpaddr, u8 data); 89 90/* Synchronize NVRAM */ 91extern int nvram_sync(void); 92 93/* Some offsets in XPRAM */ 94#define PMAC_XPRAM_MACHINE_LOC 0xe4 95#define PMAC_XPRAM_SOUND_VOLUME 0x08 96 97/* Machine location structure in PowerMac XPRAM */ 98struct pmac_machine_location { 99 unsigned int latitude; /* 2+30 bit Fractional number */ 100 unsigned int longitude; /* 2+30 bit Fractional number */ 101 unsigned int delta; /* mix of GMT delta and DLS */ 102}; 103 104/* 105 * /dev/nvram ioctls 106 * 107 * Note that PMAC_NVRAM_GET_OFFSET is still supported, but is 108 * definitely obsolete. Do not use it if you can avoid it 109 */ 110 111#define OBSOLETE_PMAC_NVRAM_GET_OFFSET \ 112 _IOWR('p', 0x40, int) 113 114#define IOC_NVRAM_GET_OFFSET _IOWR('p', 0x42, int) /* Get NVRAM partition offset */ 115 116#endif /* _PPC64_NVRAM_H */