2 * Copyright 2010 Red Hat Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
43 pms_init(struct pms_ucode
*pms
)
45 pms
->ptr
.u08
= pms
->data
;
46 pms
->reg
= 0xffffffff;
47 pms
->val
= 0xffffffff;
51 pms_fini(struct pms_ucode
*pms
)
54 *pms
->ptr
.u08
++ = 0x7f;
55 pms
->len
= pms
->ptr
.u08
- pms
->data
;
56 } while (pms
->len
& 3);
57 pms
->ptr
.u08
= pms
->data
;
61 pms_unkn(struct pms_ucode
*pms
, u8 v0
)
67 pms_op5f(struct pms_ucode
*pms
, u8 v0
, u8 v1
)
69 *pms
->ptr
.u08
++ = 0x5f;
75 pms_wr32(struct pms_ucode
*pms
, u32 reg
, u32 val
)
77 if (val
!= pms
->val
) {
78 if ((val
& 0xffff0000) == (pms
->val
& 0xffff0000)) {
79 *pms
->ptr
.u08
++ = 0x42;
80 *pms
->ptr
.u16
++ = (val
& 0x0000ffff);
82 *pms
->ptr
.u08
++ = 0xe2;
83 *pms
->ptr
.u32
++ = val
;
89 if ((reg
& 0xffff0000) == (pms
->reg
& 0xffff0000)) {
90 *pms
->ptr
.u08
++ = 0x40;
91 *pms
->ptr
.u16
++ = (reg
& 0x0000ffff);
93 *pms
->ptr
.u08
++ = 0xe0;
94 *pms
->ptr
.u32
++ = reg
;