1331722Seadler/* 2160892Ssobomax * Copyright (c) 2006 Maxim Sobolev <sobomax@FreeBSD.org> 3160892Ssobomax * All rights reserved. 4160892Ssobomax * 5160892Ssobomax * Redistribution and use in source and binary forms, with or without 6160892Ssobomax * modification, are permitted provided that the following conditions 7160892Ssobomax * are met: 8160892Ssobomax * 1. Redistributions of source code must retain the above copyright 9160892Ssobomax * notice, this list of conditions and the following disclaimer. 10160892Ssobomax * 2. Redistributions in binary form must reproduce the above copyright 11160892Ssobomax * notice, this list of conditions and the following disclaimer in the 12160892Ssobomax * documentation and/or other materials provided with the distribution. 13160892Ssobomax * 14160892Ssobomax * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 15160892Ssobomax * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16160892Ssobomax * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17160892Ssobomax * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 18160892Ssobomax * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19160892Ssobomax * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20160892Ssobomax * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21160892Ssobomax * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 22160892Ssobomax * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 23160892Ssobomax * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 24160892Ssobomax * POSSIBILITY OF SUCH DAMAGE. 25160892Ssobomax * 26160892Ssobomax * $FreeBSD$ 27160892Ssobomax */ 28160892Ssobomax 29160892Ssobomax#ifndef _POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ 30160892Ssobomax#define _POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ 31160892Ssobomax 32160892Ssobomax#define NVRAM_SIZE 0x2000 33160892Ssobomax 34160892Ssobomax#define CORE99_SIGNATURE 0x5a 35160892Ssobomax 36212240Smav#define SM_FLASH_CMD_ERASE_CONFIRM 0xd0 37212240Smav#define SM_FLASH_CMD_ERASE_SETUP 0x20 38212240Smav#define SM_FLASH_CMD_RESET 0xff 39212240Smav#define SM_FLASH_CMD_WRITE_SETUP 0x40 40212240Smav#define SM_FLASH_CMD_CLEAR_STATUS 0x50 41212240Smav#define SM_FLASH_CMD_READ_STATUS 0x70 42212240Smav 43212240Smav#define SM_FLASH_STATUS_DONE 0x80 44212240Smav#define SM_FLASH_STATUS_ERR 0x38 45212240Smav 46160892Ssobomax#ifdef _KERNEL 47160892Ssobomax 48160892Ssobomaxstruct powermac_nvram_softc { 49160892Ssobomax device_t sc_dev; 50160892Ssobomax phandle_t sc_node; 51160892Ssobomax vm_offset_t sc_bank; 52160892Ssobomax vm_offset_t sc_bank0; 53160892Ssobomax vm_offset_t sc_bank1; 54160892Ssobomax uint8_t sc_data[NVRAM_SIZE]; 55160892Ssobomax 56160892Ssobomax struct cdev * sc_cdev; 57212240Smav int sc_type; 58212240Smav#define FLASH_TYPE_SM 0 59212240Smav#define FLASH_TYPE_AMD 1 60160892Ssobomax int sc_isopen; 61160892Ssobomax int sc_rpos; 62160892Ssobomax int sc_wpos; 63160892Ssobomax}; 64160892Ssobomax 65160892Ssobomax#endif /* _KERNEL */ 66160892Ssobomax 67160892Ssobomaxstruct chrp_header { 68160892Ssobomax uint8_t signature; 69160892Ssobomax uint8_t chrp_checksum; 70160892Ssobomax uint16_t length; 71160892Ssobomax char name[12]; 72160892Ssobomax}; 73160892Ssobomax 74160892Ssobomaxstruct core99_header { 75160892Ssobomax struct chrp_header chrp_header; 76160892Ssobomax uint32_t adler_checksum; 77160892Ssobomax uint32_t generation; 78160892Ssobomax uint32_t reserved[2]; 79160892Ssobomax}; 80160892Ssobomax 81160892Ssobomax#endif /* _POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ */ 82