pam: pass device to init_pam and use it to set owner
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
84af6d9f97
commit
3cd2cf4375
@ -26,6 +26,8 @@
|
|||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "qom/object.h"
|
||||||
#include "sysemu/sysemu.h"
|
#include "sysemu/sysemu.h"
|
||||||
#include "hw/pci-host/pam.h"
|
#include "hw/pci-host/pam.h"
|
||||||
|
|
||||||
@ -49,24 +51,24 @@ void smram_set_smm(uint8_t *host_smm_enabled, int smm, uint8_t smram,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_pam(MemoryRegion *ram_memory, MemoryRegion *system_memory,
|
void init_pam(DeviceState *dev, MemoryRegion *ram_memory,
|
||||||
MemoryRegion *pci_address_space, PAMMemoryRegion *mem,
|
MemoryRegion *system_memory, MemoryRegion *pci_address_space,
|
||||||
uint32_t start, uint32_t size)
|
PAMMemoryRegion *mem, uint32_t start, uint32_t size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* RAM */
|
/* RAM */
|
||||||
memory_region_init_alias(&mem->alias[3], NULL, "pam-ram", ram_memory,
|
memory_region_init_alias(&mem->alias[3], OBJECT(dev), "pam-ram", ram_memory,
|
||||||
start, size);
|
start, size);
|
||||||
/* ROM (XXX: not quite correct) */
|
/* ROM (XXX: not quite correct) */
|
||||||
memory_region_init_alias(&mem->alias[1], NULL, "pam-rom", ram_memory,
|
memory_region_init_alias(&mem->alias[1], OBJECT(dev), "pam-rom", ram_memory,
|
||||||
start, size);
|
start, size);
|
||||||
memory_region_set_readonly(&mem->alias[1], true);
|
memory_region_set_readonly(&mem->alias[1], true);
|
||||||
|
|
||||||
/* XXX: should distinguish read/write cases */
|
/* XXX: should distinguish read/write cases */
|
||||||
memory_region_init_alias(&mem->alias[0], NULL, "pam-pci", pci_address_space,
|
memory_region_init_alias(&mem->alias[0], OBJECT(dev), "pam-pci", pci_address_space,
|
||||||
start, size);
|
start, size);
|
||||||
memory_region_init_alias(&mem->alias[2], NULL, "pam-pci", pci_address_space,
|
memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", pci_address_space,
|
||||||
start, size);
|
start, size);
|
||||||
|
|
||||||
for (i = 0; i < 4; ++i) {
|
for (i = 0; i < 4; ++i) {
|
||||||
|
@ -275,10 +275,10 @@ static PCIBus *i440fx_common_init(const char *device_name,
|
|||||||
memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
|
memory_region_add_subregion_overlap(f->system_memory, 0xa0000,
|
||||||
&f->smram_region, 1);
|
&f->smram_region, 1);
|
||||||
memory_region_set_enabled(&f->smram_region, false);
|
memory_region_set_enabled(&f->smram_region, false);
|
||||||
init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
|
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
|
||||||
&f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
|
&f->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
|
||||||
for (i = 0; i < 12; ++i) {
|
for (i = 0; i < 12; ++i) {
|
||||||
init_pam(f->ram_memory, f->system_memory, f->pci_address_space,
|
init_pam(dev, f->ram_memory, f->system_memory, f->pci_address_space,
|
||||||
&f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
|
&f->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
|
||||||
PAM_EXPAN_SIZE);
|
PAM_EXPAN_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -269,10 +269,10 @@ static int mch_init(PCIDevice *d)
|
|||||||
memory_region_add_subregion_overlap(mch->system_memory, 0xa0000,
|
memory_region_add_subregion_overlap(mch->system_memory, 0xa0000,
|
||||||
&mch->smram_region, 1);
|
&mch->smram_region, 1);
|
||||||
memory_region_set_enabled(&mch->smram_region, false);
|
memory_region_set_enabled(&mch->smram_region, false);
|
||||||
init_pam(mch->ram_memory, mch->system_memory, mch->pci_address_space,
|
init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space,
|
||||||
&mch->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
|
&mch->pam_regions[0], PAM_BIOS_BASE, PAM_BIOS_SIZE);
|
||||||
for (i = 0; i < 12; ++i) {
|
for (i = 0; i < 12; ++i) {
|
||||||
init_pam(mch->ram_memory, mch->system_memory, mch->pci_address_space,
|
init_pam(DEVICE(mch), mch->ram_memory, mch->system_memory, mch->pci_address_space,
|
||||||
&mch->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
|
&mch->pam_regions[i+1], PAM_EXPAN_BASE + i * PAM_EXPAN_SIZE,
|
||||||
PAM_EXPAN_SIZE);
|
PAM_EXPAN_SIZE);
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,8 @@ void smram_update(MemoryRegion *smram_region, uint8_t smram,
|
|||||||
uint8_t smm_enabled);
|
uint8_t smm_enabled);
|
||||||
void smram_set_smm(uint8_t *host_smm_enabled, int smm, uint8_t smram,
|
void smram_set_smm(uint8_t *host_smm_enabled, int smm, uint8_t smram,
|
||||||
MemoryRegion *smram_region);
|
MemoryRegion *smram_region);
|
||||||
void init_pam(MemoryRegion *ram, MemoryRegion *system, MemoryRegion *pci,
|
void init_pam(DeviceState *dev, MemoryRegion *ram, MemoryRegion *system,
|
||||||
PAMMemoryRegion *mem, uint32_t start, uint32_t size);
|
MemoryRegion *pci, PAMMemoryRegion *mem, uint32_t start, uint32_t size);
|
||||||
void pam_update(PAMMemoryRegion *mem, int idx, uint8_t val);
|
void pam_update(PAMMemoryRegion *mem, int idx, uint8_t val);
|
||||||
|
|
||||||
#endif /* QEMU_PAM_H */
|
#endif /* QEMU_PAM_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user