2 * ASPEED AST2400 SMC Controller (SPI Flash Only)
4 * Copyright (C) 2016 IBM Corp.
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 #include "hw/ssi/ssi.h"
30 typedef struct AspeedSegments
{
35 struct AspeedSMCState
;
36 typedef struct AspeedSMCController
{
42 uint8_t conf_enable_w0
;
44 const AspeedSegments
*segments
;
45 hwaddr flash_window_base
;
46 uint32_t flash_window_size
;
49 } AspeedSMCController
;
51 typedef struct AspeedSMCFlash
{
52 struct AspeedSMCState
*controller
;
61 #define TYPE_ASPEED_SMC "aspeed.smc"
62 #define ASPEED_SMC(obj) OBJECT_CHECK(AspeedSMCState, (obj), TYPE_ASPEED_SMC)
63 #define ASPEED_SMC_CLASS(klass) \
64 OBJECT_CLASS_CHECK(AspeedSMCClass, (klass), TYPE_ASPEED_SMC)
65 #define ASPEED_SMC_GET_CLASS(obj) \
66 OBJECT_GET_CLASS(AspeedSMCClass, (obj), TYPE_ASPEED_SMC)
68 typedef struct AspeedSMCClass
{
69 SysBusDevice parent_obj
;
70 const AspeedSMCController
*ctrl
;
73 #define ASPEED_SMC_R_MAX (0x100 / 4)
75 typedef struct AspeedSMCState
{
76 SysBusDevice parent_obj
;
78 const AspeedSMCController
*ctrl
;
81 MemoryRegion mmio_flash
;
91 uint32_t regs
[ASPEED_SMC_R_MAX
];
93 /* depends on the controller type */
98 uint8_t conf_enable_w0
;
100 AspeedSMCFlash
*flashes
;
103 #endif /* ASPEED_SMC_H */